Breakeven & Trailing Stop (fixed)

Forums ProRealTime English forum ProOrder support Breakeven & Trailing Stop (fixed)

  • This topic has 9 replies, 3 voices, and was last updated 5 years ago by avatarLuce.
Viewing 10 posts - 1 through 10 (of 10 total)
  • #101015

    Hi Paul – I wonder wether you can help here.

    I’ve got this far, can you advise on the next step..?

    I’ve coded the below as far as I can get but seem to be just missing one minor detail! I’m Still working on a way to combine a trailing STOP with a trailing STEP that becomes a fixed STOP – i.e Trade is a buy open with a 10pt stop, if it moves 2 up, your stop is now 8, if it moves another 2, it’s now 6 but when it gets to 10, so break even on a 1-1, it becomes fixed. Currently I only get a trailing to stop at breakeven, so still risking the full 10.

     

    #101018

    I’m sure it’s a simple add in but just can’t seem to work it out..!!

    #101021

    To write code, please use the <> “insert PRT code” button, to make code easier to read.

    Thank you.

     

    #101022

    I created another topic since this one has nothing to do with the original post, it’s a completely different code.

    Who’s the PAUL you are referring to?

    #101023

    As to what you asked, you may search the forum, but I think all code snippets/examples deal with breakeven first, not really a true trailing stop!

    So what you want is to trail stop loss until breakeven, then leave it fixed till the next trade, is that correct?

     

    #101025

    Luce – you have posted an identical question here:

    https://www.prorealcode.com/topic/hard-coded-stop-loss-becoming-trailing-stop-loss/#post-101013

    One of the forum rules is that you do not double post as it leads to wasted effort and time for those trying to answer you.

    Please refrain from double posting in future.

    #101027

    Hi Roberto

    Yes basically – I have managed to code it so it trails to the 10 point target point which then becomes fixed, that part is now fine.

    What I’m trying to achieve however is whilst it is reaching the trailing stop target (10) it steps up by 2 each time until it reaches the target. So, you enter the trade, you have a trailing stop for 10 but it triggers immediately by a step of 2 if it moves in your favour by 2, then this becomes 8. If it moves another 2 then the target is now 6. It it moves another 2 the target is now 4 etc until it hits 10, and then it ALL stops and the stop is now fixed.

    Does that make sense..?

    #101029

    This is the trailing stop updated so that it doesn’t move once at breakeven, you’ll have to add a further value, InitialSL which must be the same one used throughout the code (13 in your case):

    InitialSL, your SL, is used as a counter and decremented each TRAILINGSTEP pips till it reaches 0, then it stops working (NewSL, the updated SL price still operates till it, or the target price, is hit).

    #101030

    This your complete code:

    I tested it a bit and it seems to be working.

    Be warned that tight stops and targets may imply your orders being rejected or entered at market, due to the broker’s policy about minimum distance.

    2 users thanked author for this post.
    #101062

    Wow HUGE thanks Roberto – That’s amazing skills – Hugely appreciated!!

     

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

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