Moving Stop Loss

Tagged: , ,

Viewing 13 posts - 1 through 13 (of 13 total)
  • #136945

    Please I have this code below which is running in auto trader, but the 0 stop loss never executes, neither does the trailing stop loss,  how can I get my initial stop loss to move if I am in profit. I am assuming that tradeprice(1) is the market price the trade was entered at, hence if this was running for crude market via auto trader and there was another auto trader running for say ftse, then tradeprice(1) for each trade should point to their respective market entry price.

    Any help will be appreciated, Many thanks



    Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.

    Thank you 🙂



    At line 6 it’s almost impossible that the difference be 5.0 pips, that’s why it never gets triggered.

    SET STOP LOSS 0 simply removes your SL, leaving your trade WITHOUT any stop loss.




    Please so this should move the initial stop loss to new level when the market moves beyond 5 pips?   Many thanks


    Yes, that’s correct!



    Okay, I will try that okay, but I am sure I tried this before and it never worked hence introduced the 0 stop loss in between just to see what will happen and that never worked hence posted code here.

    Many thanks. I am testing this in demo environment.


    @tboafo, here’s 3 different trailing stops you can try. All are very good, each will give different results. The first, by Nicolas is a good place to start and it includes a break even function. The others, by Paul and Roberto are more sophisticated. You’ll have to play around with the variables, obviously.


    3 users thanked author for this post.

    I will explore the the various options. Many thanks


    Yes, as nonetheless suggested, using software snippets for TRAILING STOP is always the best choice. It depends on how large your SL & TP are, in this case SL is very tight, so if you use a volatile instrument and a fairly high TF (5 minutes could be pretty high in this case) it could be very difficult to manage it!



    Link to above 3 x TS added as Log 224 here …

    Snippet Link Library

    I added a Note that Code Authors are Nicolas, Paul and Roberto

    2 users thanked author for this post.

    Hi Roberto,

    I’m a fan of your coding skills.

    You have created many trailing-codes. If you had to choose, which one would you select for a 3-minute timeframe?


    I always use this one, sometimes in percentages, other times in pips.



    Do you have a link to the one in %

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

Create your free account now and post your request to benefit from the help of the community
Register or Login