EA is not working the same in backs testing and demo account in MT5
-
LINK OF PROJECT:
https://fxdreema.com/shared/g9hl8o6zdI have a basic EA that opens a trade with a button, can open multiple trades, the EA is checking each trade to see if it is X pips away from open price, if it is, put SL to BE, close partial 50% of the trades and it set a flag "parcial", with this flag another group of blocks is enabled that is checking if a condition is fulfilled and it closes all the trades that are in BE.
the problem is that in back testing is working as expected, if i open trades the logic starts to work till trade
is in X pips as "pips aways" block is requiring and close partial and do the BE, but same block, same logic in demo account once I open a trade it executes right away the BE and closes the trade

BACKTESTING:
it only opens the trade but it doesn't do the BE and the close


DEMO ACCOUNT:
you can see in the journal that open a trade in .04 and then close partial the 50%


-
@sosel I replied to your previous thread. Please don't duplicate threads.
-
sorry, i just saw the answer, I want to explain in more detail my problem I won't do it again, thanks so much I will try moving BE block, but is there a reason why it worked in backtesting and not in demo account?
-
Hi can any one please help me about EA building for arrow indicator,, like buy and sell arrow,
-
i modify the EA to this:

replacing BE block for modifying stops to only use block of the same type, but the problem is the same, once i open a trade it executes all the blocks inside of the loop and i want to stop the loop if the trade is not X pips away of the open price even i tried this to try to break the loop but didn't work :

-
@sosel That 'if position' block on top is unnecessary. Block 142 is already searching for all open trades. Additionally I don't see any reason to break the loop twice. Can you please share the new link project?
-
@l-andorrà I modified it after this picture as the example in the other question, this is my last iteration, but still happening the same, can you please try to download and run it in the demo account, just open a trade with the button "comprar" instantly it opens the trade and close partially, seem like runs everything inside of the loop "for each", it doesn't take the pipis away block, it works in backtesting but no in demo, even I tried to break and skip the loop for next iteration with the block loop(next) attached to the yellow button of pipis away block to skip the trades that are not X pips away from open price but it didn't work

here is the link:
https://fxdreema.com/shared/8TxJzIIbb -
@sosel I recommend you to move the tree block headed by block 53 to the 'on chart' tab. I didn't notice it is on the 'on tick' tab when they work on buttons.
-
I just did it but the result is the same, I'm thinking is a bug with "for each" or "pips away"or I don't know where, I copied the same blocks literally even has the same name in MT4 hehe and is working fine in MT4


-
@sosel Can you please share the link to the project?
-
@l-andorrà i changed the program to MT4, is working as expected