Considering only bars in the same day in an array


Hi there,

I'm having difficulties programming an EA to execute orders after 4 down/up bars. I want it to consider only the bars in the same day but it executes orders based on the previous day last bars. For example, if the last 4 bars of the previous day where positive it will buy within the first bar of the new day if price is higuer than previous day's last 4 bar range. It is a simple code:

double Open[],Close[];

Then I have an "if" statment which compares the last 4 open and close prices to check if they are all up or down bars.

I have put together a datetime structure to open and close orders within the day and that works fine.

I am a beginner so I apologize for my poor coding and thank in advance.

Best regards


Complementing, I tried setting the Open and Close array values to 1 at the end of the day, so that my "if" statement would not let it through, but with no success.



Solved it using iTime shifted by 4 and comparing it to TimeLocal.

Best regards.