Trailing stops EA
-
Hi,
I'm using fxdreema for the first time and this is my first project: https://fxdreema.com/shared/tpp5KmfRc
However, it doesn't work! What I want to do is an EA that automatically sets a stoploss in the low of the previous bar in a buy order or in the high of the previous bar if in a sell order. This must be done only if the previous bar closed in the same direction of the order, that is only move the stoploss if previous bar was bullish for buys o bearish for sells.
Can someone please help me understand why my EA does nothing?

Thank you.
-
If you have no action from this EA, then I think you want to modify manually opened trades. Each EA is set by default to NOT work with manually opened trades, or trades made by other EA. There are 2 ways to deal with this: http://prntscr.com/bmqvx6
http://image.prntscr.com/image/1c9c270f57244fa98668f69a3730cf2b.png -
Yes! Thank you, that was it. I made my first EA

What an excellent tool is fxdreema, congratulations.
-
Hi fxdreema,
In the picture you can see how I'm setting my stoploss for short trades. What I want to accomplish is to set the stoploss on the high of the previous candle + 1 pip + spread. I'm getting the (high of candle + 1pip) part ok, but I haven't been able to add the spread automatically. How can I get it done? Thanks.
-
Try to change this option "Price relative to"
-
I tried every option in "Price relative to" and the result was always the same with all of them: the stoploss of sell orders was set to 1 pip distance but without adding the spread.
In the 6th block "modify stops of sell", of the copy I'm sharing below, I have "Price relative to" set to "bid for buy, ask for sell" but, as I explained before, it only adds 1 pip but not the spread. What else can I try?
-
As MQL4 code this is the spread of the current symbol: ```
MarketInfo(Symbol(), MODE_ASK) - MarketInfo(Symbol(), MODE_BID)Otherwise you can get it's value and put it into a Variable with "Modify Variables" block. -
In the code, how would I find what is shown in the block to add what you suggest? If you could please tell me a part of what the code would say, I would be able to find it and modify the formula. Thank you.
-
The contents of the Adjust field where you now have "+1pips" goes to the output MQL4 code almost directly. This is also true for all input fields. You can write MQL4 functions everywhere, not only numbers
-
It worked. Thanks.