Candle Shift ID for friday
-
Hi,
my EA needs to know the daily low of the friday candle but if you use the shift ID 1 on the daily setting it does not recognise friday as the previous candle??? Can anyone help, thanks. -
Interesting question, and I have no good idea how to make it easily on the EA builder. As a code, I imagine having a loop to find the candle from the last friday, try this for example:
int OnInit() { int shift = 0; while (true) { datetime time = iTime(Symbol(), PERIOD_D1, shift); shift++; if (TimeDayOfWeek(time) == 5) { break; } } Comment(shift); } -
Thanks very much for your reply I will try this and let you know if it works. Much appreciated!
-
I'm not sure where best to place this in the code for it to work.
-