Trigger Trailing SL if target is met

Forums ProRealTime English forum ProOrder support Trigger Trailing SL if target is met

Viewing 15 posts - 46 through 60 (of 69 total)
  • #198511

    Yes I think you jumped to DJI but np. For me this happends step by step.

    Buy 8/4 17:30 @32671

    newSL 32721
    newSL 32796

    newSL 33321

    Sold 2/5 20:30 @32471 (900 points below SL?)

    What am I missing?

    #198513

    @phoentzs YES!!!!! 🙂

    And if you pick a low intrerval like 1 min it will match so often that you miss it. With larger interval it becomes more visible.

    #198514

    What am I missing?

    I think you are missing that unless C2 =1 / True that the Trailing Stop (TS) will not function / trail.  If C2=0 the Trail is switched off.

    Remember also that crosses over means crosses over at the end of that bar (when the code is read)NOT has crossed over in the previous bar or some bar prior to that.

    The TS probably needs some extra lines of code to make newSL = 0 when C2 =0.  As the TS code stands, newSL appears to remain at a previous value but is not functioning as a Trailing Stop (due to C2 = 0)?

    Often working out what is and what is not happening is very time consuming, if you are interested enough to want to find out … keep at it, spend time and more time on it, but in the end will it make you money?? 🙂

    Whilst I can do above, and have for myself in the past (teach yourself – the best way to learn!) I tend to concentrate on getting a Trading System to give a good equity curve and good stats etc and then the time  seems worth the effort and it feels like I am working towards a positive goal?

    I feel here we are pursuing a strategy that is not going anywhere anyway??  Ditch the ‘crossing over’ and move on is my advice.

    Anybody who can see what I have not seen in this code / strategy feel free to jump in please!? 🙂

    #198515

    If you omit your exit cross, you miss the exits that end negative and always end up in the SL. If you choose a > b as the trigger for the trail, you will also miss the negative-ended outputs. So the solution remains… leave the exitcross in the code and optimize the trail independently to land a little more hits.

    #198516

    I used Crosses Over with [2] delay if you guys remember, and it’s working great for me. My ide with it triggering a trailing SL and not a sell was to see if I could cram just a little bit more out of it. So the Cross will remain, and the trailing is out. This is a great way to learn, for me atlest 🙂

     

    Tank you guys for taking time to help me.

    #198517

    Ha … I’ve maybe solved it … a Flag which stays at 1 after C2 = 1?

    Results attached

    Code / .itf attached which retains the crosses over! 🙂

    1 user thanked author for this post.
    #198520

    And here we are, we’re even making money now!!!

    Attached with re-optimised settings!!

     

    1 user thanked author for this post.
    #198522

    You beautiful son of a gun!!!!!!

    U did it!!!

    Works fine now, what I can see

    Now time for optimising start and trail values

    1 user thanked author for this post.
    #198523

    Even good on 5 min TF – see attached!

    More interested now I can see profit and good equity curve, it’s only over 10K bars I know but hey that suits me anyway!!

    Make Money while You Sleep! 😉

    1 user thanked author for this post.
    #198545

    Been looking over the data testing tinkering, and it looks like the Trailing Stop only starts when the position is in profit. “trailing will start @trailinstart points profit”. Have I understod this right? And if so is there a way to make the trailingstop to start at cross even if the position is not in profit?

    And also, in the code you send to me last night, you have A21, A22 and A46 and not numbers, what are those and how does that work?

    #198550

    Trailing Stop only starts when the position is in profit

    Yes above is how a normal Trailing Stop normally works.

    is there a way to make the trailingstop to start at cross even if the position is not in profit?

    Does the cross ever occur if the position is not in profit. Use GRAPH to find out and let us know.

    you have A21, A22 and A46 and not numbers, what are those and how does that work?

    Look in the optimiser and you will see the above code line numbers as variable names.

    #198551

    This version will NOT use TRAILINGSTART, as it will start from the Stop Loss, then will increase it by TRAILINGSTEP pips as the price exceeds the previous SL by TRAILINGSTEP * 2 pips.

    I also added a Take Profit to avoid trades lasting several months.

    You will spot a few more changes throughout the code.

    Be warned that strategies based solely on average crossovers are very prone to future losses, as backtests are usually and easily overoptimized.

    2 users thanked author for this post.
    #198553

    Link to above added as Log 333 here …

    Snippet Link Library

    1 user thanked author for this post.
    #198569

    @GraHal

    Yes I use trailingstops everyday in my manuell trading, 90% of them start in the red and some end up in the red to. So to me that “Trailing Stop only starts when the position is in profit” was super strange 🙂

    The cross does occur even when the position is not in profit, but you have to max out SL and even then is not very common. I do get is kinda odd to ask that coz it almost never happends, but for me I need to know what happens at the extremes to understand the big picture.

    Found the optimizer :rofl: now I got the weekend cut out for me :thumbsup:

    @robertogozzi

    O tank you so much, this is just what I was looking for! Now I have another tool to use. Will look over it this weekend :thumbsup:

    1 user thanked author for this post.
    #198580

    Yes above is how a normal Trailing Stop normally works.

    What I should have said is … how a normal coded Trailing Stop works.

    90% of them start in the red

    Above is because you start the manual Trailing Stop after the trade is opened (most trades go in the red immediately after open, if only due to spread)?

    1 user thanked author for this post.
Viewing 15 posts - 46 through 60 (of 69 total)

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