Is it possible to set a 2nd exit?

Forums ProRealTime English forum ProOrder support Is it possible to set a 2nd exit?

Viewing 7 posts - 1 through 7 (of 7 total)
  • #227983

    Good day All

    I am using a code provided by Nicolas to adjust my exit when the price has moved a set number of points. Breakeven code for your automated trading strategy – Learning – ProRealTime (prorealcode.com)

    Can I repeat this code with adjusted wording and values to adapt my exit should the price continue higher (long position)?

    I realize a trailing SL can be used, but I would like to know if the above coding is possible and, if so, if it is coded correctly.

     

    Thanks

    Brad

    #227990

    It’s almost correct.

    Replace line 2 with:

    and replace line 19 with:

    to prevent the first move from being executed again AFTER move two has been triggered.

    replace also line 8 with:

    for the same reason.

     

    1 user thanked author for this post.
    #228018

    Thanks, Roberto! I’ll give it a shot and let you know how it goes.

    Brad

    #228717

    Hi Roberto

    I have applied the corrections you pointed out. Thank you.

    I have now applied the same logic to include a third exit. Do you mind checking if I have written this code correctly, please?

    I have also applied a trailing stop as an additional exit condition. Is the code correct in saying that if the price reaches 500 points, a trailing stop of 100 points will start? So if the price moves from 1000 to 1500 and then reverses, the price will exit at 1400?

     

    #228756

    It’s almost correct.

    TradePrice[1], despite it may work in some cases, should be replaced by:

    then I changed the first 5 lines and one of the IF….

     

     

     

    1 user thanked author for this post.
    #228773

    Thanks, Roberto

    I’m assuming the “()” corrections and moving “AdjustMySL1 = 0 and AdjustMySL2 = 0” to the top of the code should be applied to my initial code as well?

     

    Updated  ‘additional move’ code:

     

     

    #228795

    Yes, correct.

     

    1 user thanked author for this post.
Viewing 7 posts - 1 through 7 (of 7 total)

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