Example: indicator LifeHack Balance Equity 2
Displays the lines of Balance and Equity only at the time of the birth of a new bar:

- www.mql5.com
Hello,
I use ACCOUNT_PROFIT to close the positions, I would like the info ACCOUNT_PROFIT to give the result only after the opening of a new candle m1 and not at each tick.
Here is the code I use:
Does anyone have the solution ?
Hi
static datetime NewBar = 0; if(NewBar != iTime(Symbol(),PERIOD_M1,0) { double Profit = AccountInfoDouble(ACCOUNT_PROFIT); if(Profit >= TP_Money) CloseALL(); NewBar = iTime(Symbol(),PERIOD_M1,0); }
Thanks Vladimir & Seyed for your help, it works.
What I do not understand is that I do not have the same results with an Price Open and every tick backtest, while the calculation of the strategy at entry and exit is based only on the opening/closing of the candle m1. Do you have any idea why so much difference ?
Backtest Price Open:
Backtest Every Tick:
Thanks Vladimir & Seyed for your help, it works.
What I do not understand is that I do not have the same results with an Price Open and every tick backtest, while the calculation of the strategy at entry and exit is based only on the opening/closing of the candle m1. Do you have any idea why so much difference ?
Backtest Price Open:
Backtest Every Tick:
If you do not understand what the difference is, then I highly recommend using the tick mode " Every Tick "
Help: Real and Generated Ticks

- www.metatrader5.com
Thanks Vladimir & Seyed for your help, it works.
What I do not understand is that I do not have the same results with an Price Open and every tick backtest, while the calculation of the strategy at entry and exit is based only on the opening/closing of the candle m1. Do you have any idea why so much difference ?
Backtest Price Open:
Backtest Every Tick:
If you are sure that strategy only uses prices and informations of latest closed candle and you are not using functions that are tick-influenced (like trailing stop, break even... anything else that uses Ask/Bid for calculations) you will obtain exactly same results.
Probably you get less trades becuase you have less historical data of Ticks instead of 1 minute HOLC.
If you are sure that strategy only uses prices and informations of latest closed candle and you are not using functions that are tick-influenced (like trailing stop, break even... anything else that uses Ask/Bid for calculations) you will obtain exactly same results.
Probably you get less trades becuase you have less historical data of Ticks instead of 1 minute HOLC.
I just backtested in 1 minute HOLC and I get exactly the same result in every tick ;)
Thanks to you all for your help

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I use ACCOUNT_PROFIT to close the positions, I would like the info ACCOUNT_PROFIT to give the result only after the opening of a new candle m1 and not at each tick.
Here is the code I use:
Does anyone have the solution ?