matrixyb:
Hello,
In OnTick() function of my EA I have if statement to check an entry condition such as
This condition deals with closed candles therefore as soon as a candle expiries and the entry condition is valid an order has to be sent. However, not only one order is sent I have punch of orders sent around 10 orders!! Why is that?
Sometimes few orders are sent then few seconds another punch are sent again
There is nothing in your code to suggest that it only checks conditions once per bar.
Daniel Cioca #: So if you are in the middle of the 1Hr candle when you start that code.. what would that code say at the first arriving tick ? Is it a new bar?
Please study the following in the CodeBase. It caters for that exact situation.
Detecting the start of a new bar or candle
Fernando Carreiro, 2022.04.24 00:46
Detecting the start of a new bar or candle, in the OnTick() event handler of an expert advisor.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
In OnTick() function of my EA I have if statement to check an entry condition such as
This condition deals with closed candles therefore as soon as a candle expiries and the entry condition is valid an order has to be sent. However, not only one order is sent I have punch of orders sent around 10 orders!! Why is that?
Sometimes few orders are sent then few seconds another punch are sent again