Not logged in
Viewing 3 posts - 1 through 3 (of 3 total)

Forums>AlgoWizard / EA Wizard>General Discussion>Why is my updated SL bouncing up and down?

  • #267481 |
    Customer
    107 Posts

    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.
    #267551
    tomas262
    Administrator
    1826 Posts

    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

    #267734
    Customer
    107 Posts

    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…

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.