Reply

Why is my updated SL bouncing up and down?

2 replies

Csaba

Customer, bbp_participant, community, sq-ultimate, 110 replies.

Visit profile

3 years ago #267481

Hello

I tried to make a very simple EA. The theory would be like this:

– open 2 x long trades with the same lot size, if CCI crosses above -100
– both positions have the same SL in pips
– 1 position have TP distance same like the SL, so 1 position will be closed and I let run the 2nd position and here the stop loss is already  in BE

– if the 2nd position goes in my favour and:

-if the price moves up 2 x the SL range, I set the SL in 1 x SL range
-if the price moves up 3 x the SL range, I set the SL in 2 x SL range
– and so on

But my updated SL is bouncing up and down, because all the EA uses “TICK”. But I wanted to have the moved SL to “be sticked” to the new upper level and not going down again… How could I solve it?

Brg, Csaba

 

Attachments:
You must be logged in to view attached files.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

3 years ago #267551

Hello,

you need to save the new SL price into a variable. Then you need to use the Maximum function as the parameter for the Set stop loss function to compare so the maximum price (either stored value or newly calculated price) is used to set SL. This way the stop-loss will only move to higher prices not lower. Let me know if any help needed

0

Csaba

Customer, bbp_participant, community, sq-ultimate, 110 replies.

Visit profile

3 years ago #267734

Hello Tomas

Pfff…. Thank you really, but I am too “young” for this. :))  I guess, that for “saving it to a new variable” and so on I should write code manually not?
If so, then I will stuck here, because I dont have any idea how to do this…

0

Viewing 2 replies - 1 through 2 (of 2 total)