the first 4H candle of the week
-
Hello guys
Can anyone tell me how to make pending order above the high with certain points and the same for the low of the first 4h candle of the week and cancel pending order and close the orders at the end of the week please
-
Interesting question. I don't know any way to get that "low of the first 4h candle" value in fxDreema, so I made this example with some calculations in it:
https://fxdreema.com/shared/qKEtPnO4e
I have a "double" (floating number) Variable called CandleCloseOnMonday4H, which I modify in block 3. As you can see, there are few calculations over there, and the result should be Low of that first 4h candle on the previous Monday. It doesn't work properly for the first 4 hours of Monday and that's why I put this Weekday filter block. Then I create 1 new pending order on every day of the week. Each pending order expires in 1 minute, so the chart can be clear. This is only to test how accurate the value is, here I don't care about the pending orders.
To shift the open price of the orders, use some value in the "Price offset" option in "Buy pending order".
I hope you can get an idea what I do in the formula. 86400 is the number of seconds in 1 day and I add .0 to this value when I want to use it as a "double" value, it's where I use this "/" operator. I think it can work without .0, but just in case...
FourOclockOnMonday - this is the time that is at 04:00 on the past Monday. After that I'm trying to calculate how many candles can fit in that time period between now (TimeCurrent()) and FourOclockOnMonday. Everything will be fine if on the chart you have all candles present. But if there is a missing candle for some reason, the result will be kinda fake. There is no chack for whether some candle is missing or not, it's pure math.
3600 is the number of seconds in 1 hour.
TimeDayOfWeek() returns value from 0 to 6, where 0 is Sunday, 1 is Monday and so on...
MathFloor() returns integer numeric value closest from below
MathCeil() returns integer numeric value closest from above
iLow() returns Low of particular candle