Again on Trailing stop...
-
Hello.
I am new here (and I am not a coder...) and I am tring to do my best to understand fxdreema logic to write a little EA.
I read all the previous messages in the forum regarding Trailing stop but maybe there is something that I am still not understanding... sorry for this!I would like to:
- Open a trade with a SL of 30 pips
- Don't touch the SL until the trade goes in a profit of 15 pips
- When the trade gets 15 pips in profit set a new SL of 15 pips, and this means setting the SL at exactly the open price. This will exclude any loss (excepting slippage, ecc.)
- As the trade makes more profits move the SL up (if it is a BUY) or down (if it is a SELL) 1 pip at a time, keeping it at 15 pips form the current price.
Is this block correct to do that?
https://fxdreema.com/shared/mOBZidUrd
I tried it in live tests and I think there is something wrong, becouse when it moves SL for the first time it doesn't set it at the open price (i.e. the price when the trade started), but it set the SL 15 pips of distance from the open price (open-15 for a buy, open+15 for a sell).
Can please someone tell me if I am getting something wrong?
Thanks for the help
Bye
-
This is the block and the settings look fine... almost. Try with 15 instead of 1.5. Don't divide by 10, there is no need.
-
Hello, thanks for your prompt replay.
I work with a 5 digits broker, so I have to write 1.5 becouse else 15 will means 150 pips.
The problem is:
2016.04.03 01:42:10.228 2013.03.20 00:11 20160403_10 EURUSD,M1: Warning: Too short SL requested (1.28671 or 10 points), minimum will be taken (1.28651 or 30 points)
In this example I tried 10 pips but it said too short SL...
Any workaround?
Thanks
-
__
I work with a 5 digits broker, so I have to write 1.5 becouse else 15 will means 150 pips.
[/quote:v9ujalz7]No, you don't have
Click on the bench icon for the project's setting and look what is on the top. Maybe you will get, maybe not, but the idea is that the same EA works on 4-digit and 5-digit brokers with the same 4-digit numbers -
GiovanniBumbo,
In my EA I do the same thing that you are trying to do (move SL do open price after X profit) but I use the "Break even point" block. It does exactly that and works perfectly.
-
Thanks for the suggestion
-
I do it like in your demo but SL sended to the broker is moving up and down and up and down.
But it should (assuming a buy trade) follow the price with some distance and never go down when it reached a specific level.
Thats how I understand SL.
It fires tons of modifies to the broker but as I said up and down while my buy trade is running...What am I doing wrong?
(I am working at the desktop version)
-
Trailing stop is a process of continuously monitoring the distance between the current price and the SL level. If that distance becomes too big, then SL is moved. But it's important to put SL at appropriate place.
For a Buy trade, this is the process:
if ASK > SL + STOP + STEP then move SL to ASK - STOP
... where ASK and SL are price levels and STOP and STEP are values like 0.0010 added to those price levels
Something is probably wrong with the STEP value. What is it?
-
Hmm i use the trailing stop block and the main problem is that it moves the SL up and down. But as I understand trailing it should only move it in one direction.
For buys only up and for sells only down. I use these settings:
Market mode Specified markets
Filter Buys and Sells
Trail what Stop-Loss
Refernced Price Ask for buy Bid for sell
Trailing Stop is Pips
Pips (a variable with default) 6
trailing step is Pips
Pips 1
Trailing start is open price
opposite stop mode no change (i do not understand this setting)
Level color DeepPinkI sometimes use the virtual stops feature but this isnt changing the behavior...
As written above it moves the SL up and down how to fix it -
It's probably the setting that you don't understand. By "Opposite stop" I mean TP if you are moving SL or SL if you are moving TP. After all, Trailing Stop can actually be used as Trailing TP

-
Ok now I understand this setting but why is the SL (on a buy trade) moving up and down with almost every tick? As I understand SL it should move ONLY up on BUY trades and only down on SELL trades.
I think thats an issue -
2016.05.04 11:44:33.032 '27458': modify order #1352072 sell 0.38 EURUSD at 1.14879 sl: 1.14971 tp: 0.00000 -> sl: 1.14967 tp: 0.00000
2016.05.04 11:44:33.185 '27458': modify order #1352072 sell 0.38 EURUSD at 1.14879 sl: 1.14967 tp: 0.00000 -> sl: 1.15001 tp: 0.00000
2016.05.04 11:44:33.323 '27458': modify order #1352072 sell 0.38 EURUSD at 1.14879 sl: 1.15001 tp: 0.00000 -> sl: 1.14965 tp: 0.00000
2016.05.04 11:44:33.780 '27458': modify order #1352072 sell 0.38 EURUSD at 1.14879 sl: 1.14965 tp: 0.00000 -> sl: 1.14967 tp: 0.00000
2016.05.04 11:44:33.946 '27458': modify order #1352072 sell 0.38 EURUSD at 1.14879 sl: 1.14967 tp: 0.00000 -> sl: 1.14963 tp: 0.00000
2016.05.04 11:44:35.310 '27458': modify order #1352072 sell 0.38 EURUSD at 1.14879 sl: 1.14963 tp: 0.00000 -> sl: 1.14969 tp: 0.00000
2016.05.04 11:44:38.514 '27458': modify order #1352072 sell 0.38 EURUSD at 1.14879 sl: 1.14969 tp: 0.00000 -> sl: 1.14967 tp: 0.00000Its a running sell trade and the SL is moved up and down
-
You know, I just don't remember the situation with this block. It is possible that someting is wrong with it in the desktop version and then I fixed it for the web version. I do remember touching some things... Can you try the block with your settings in a project generated by the web version? Otherwise if you want me to really look into some problem, just give me the project - .mq4 file or upload it into the web version (I can see everyone's projects)
-
I tried this and it works fine for me - http://prntscr.com/b0bmms
I even tried with spread as big as 6 pips, but then each trade is closed as soon as it is created