Delay EA start to first bar closes
-
I have some once per bar blocks that I don't want to action until the first bar after the EA is initiated has closed. i.e. I load my EA and the onced per bar should start on the first tick of the next bar that opens.
Is this possible? Anyone able to help me on this one? Thanks
-
This can be done with some variable, but
why do you want this, may I ask?
There might be a more elegant solution -
I am counting how many bars close within a defined support/resistance zone. Usually when loading the EA it’s outside the zone and I then use variables to count the closes within to use as a set up for a trade.
But if the last closed trade is in the zone on initiation I want it to count that bar. It does this but then the once per bar counts it again.
-
One solution would be to create a variable that increases every bar by 1;
once per bar --> barcount=barcount+1Now you could make condition: barcount > 1 before your ea would continue the process.
-
Thank you very much for your reply. I really appreciate it as there's not a lot of help on here.
Your suggestion makes sense. I'll give it a go and see if I can get it to work.