Modify TP including swap & Mt4 Crash
-
Hi guys, I'm looking for a way to modify the take profit of one or more trades just after midnight (using the time filter command), increasing or decreasing it by X pips based on the swap (if positive or negative).
Another question: if the metatrader is closed by mistake, when it is reopened all the charts with the expert advisor inside are loaded, are the trades already opened by him recognized? Because it seems to me that using "pips away from open price" the ea only recognizes the last open trade, not the "original" one. Same thing using the check profit unrealized function, I think that if the metatrader is closed by mistake, the check profit no longer recognizes the "group" with the trades. Has this happened to anyone before?
I've read many topics but none of them exactly answer these questions.
-
With pips away, in the for each trade block you choose the number of the trade you are referencing, don't think removing/adding/closing makes a difference.
-
@jstap I'm not using for each trade. My setup is: IF trade / pips away from price / once per trade / add to volume.
The reason is that there are different pips away from open price with different distances. For example:
Original trade: open at price 11 (ticked id 1)
first pips away -30 pips, open at price 8 (p=1) with add to volume x1.2
second pips away -40 pips, open at price 4 (p=1) with add to volume x1.3If the metatrader is closed and reopened and there are already 3 open trades (original + 2 pips away) it happens that the EA will open a trade after -30 pips from the LAST trade he sees, i.e. the "second pips away -40 pips, opened at price 4", with add to volume x1.2 but with reference p=1. It is as if the "pips away" count started all over again starting from the last pips away opened, using the correct ticked id (p=1) but with the same add to volume as the FIRST first pips away (opened at price 8 with add to volume x1.2 ). This is very strange.
The result is this:
Original trade: opened at price 11 (ticked id 1) with add to volume x1.2
first pips away -30 pips, open at price 8 (p=1) with add to volume x1.2
second pips away -40 pips, open at price 4 (p=1) with add to volume x1.3
-> close and restart the metatrader and this happens:
At price 1 he will open a new trade with add to volume x1.2 and ticked p=1. -
pips away only works correctly under for each block, needs this to select the trade you want to work from.
-
@jstap They have always worked very well for me. If I wanted to use for each trade as you suggest, how would I do the same thing? Now I use IF trade / pips away from price / once per trade / add to volume. Also, are you sure that in case of crash or closure of MT4 all trades are recognized without losing the count as it happens now?
-
Just put the for each above pips away, it will use this block to select the trade to work from.
-
@jstap Ok, I'll try, but in case of accidental closure of the Metatrader, how will the EA know which "for each trade" to restart from?
-
The trade numbers don't change.