how to set TP/SL according to indicator?
-
I have an ATR stop indicator I'd like the EA to take profit and stop loss according to. However I could not get it to work. I tried to configure it first with the buy and sell button, didn't work. Then I tried a block if trade-indicator logic-close trade. Still didn't work. Not only that, it messes up the EA in general it doesn't open and close trade according to logic anymore, it closes the trades immediately after open. However if I remove the tp/sl condition and use the simple fixed pips the ea works fine. so it is a question and a bug report I guess. Please help
-
Well, if trades started to close immediately, this is at least something. People have this problem very often and the reason for that is because their conditions to buy/sell and the conditions to close trades are true at the same time. I don't know how to better explain the problem. It's not a bug in the problems, it's a logical error - the way blocks are connected.
Here is some example that contains very few blocks - https://fxdreema.com/demo/mt4-buy-sell-buy-sell-opposite-conditions - and at first you might think that something horrible will happen. But their settings and location are good.
Whatever you do, remember that all the blocks under "on Tick" run on every tick - over and over again, very quickly.
-
Thanks for the response. I understand what you said (I think) but it does not do that if I left the TP/SL as fixed pips, the EA works fine.
It only changes behavior when I tried to change TP/SL to correspond with an indicator, then The EA loses it's mind. My problem is I can't get the EA to successfully set TP and SL according to an indicator.
-
Maybe the indicator levels are not proper. Or you selected the wrong option? There is difference between "price level", "price fraction" and "pips". If you select the wrong one, you could see error... or fxDreema could try to correct that error and you will see wrong behavior. I think that you selected some option that resulted is small SL/TP, so the trades are closed early.
-
I selected price level, defined by indicator buffers. doesn't work. I even tried different indicators same problem, this time the EA does not open any trades.
-
OK I think I get it what was wrong, now I got the TP and SL to work according to the indicator but I have another problem. Perhaps it's a problem with the indicator but maybe it's how I defined it.
Basically the EA set the TP and SL according to indi but at the level where the trades were taken. I want the EA to follow the movement of the indi to close trades when the current price meets the current levels. Can it be done?
-
Yes, but not in Buy/Sell blocks. Remember - these blocks only do their job once when they are executed, they create their trade and that's all. Well, the only option that appears to continue working is the Expiration option for the MQL4 side.
https://fxdreema.com/demo/mt4-trailing-stop Trailing stop is an example how stops can be moved multiple times. And I would actually recommend this block for your task, if you also want stops to move only in one direction. You can see those Custom options for Trailing Stop.
If you want to modify stops every time, there is a block "Modify stops". Well, SL and TP are not separated in this block.
Or "For each Trade - > modify stops"