Why first trades on demo account does not get the right values?
-
Hello
This is something that I am seeing using my EAs on a demo account and happens backtesting as well.
The problem is that some values are not updated correctly for the first trade that the EA opens. On backtesting is not a big problem but on the demo account it is.


It might be a specific issue of my EAs but I am not sure.
Has anybody seen this particular behavior?
Thanks
-
How is the comment block updated?
-
Hi @miro1360
Thanks for helping.
The EA opens a trade if the conditions are met at the beginning of a new bar ("Once Per Bar"). After the position is created, the value TP1_Pips and other position info is stored in variables

Looking at what I have explained above, I have added a new branch that stores again the value for TP1_Pips if the position exists but for "every tick".

The problem I think is happening is that TP1_Pips value is not stored correctly for the first trade of the EA. Because if the "Comment" is showing
TP1_Pips = 0.0 but the TP line has been placed correctly on the chart,

it looks like that the value has not been stored correctly. This issue seems to be specific for the first trade because it does not happen for the next ones.
-
Separate comment block form other blocks, place it alone, like this:
https://ctrlv.cz/shots/2019/01/03/U4W1.pngor "re-run" this comment block with the block called Run blocks after the update of each variable
-
Hi @miro1360
Thanks for your advice. I placed that "Comment" block as you suggested and it works fine on backtest.


GOOD JOB!!!!
I will check this out on demo account.
:-()
-
