Move to BE on Confirmation of Market Structure

Forums ProRealTime English forum ProOrder support Move to BE on Confirmation of Market Structure

Viewing 15 posts - 1 through 15 (of 20 total)
  • #137284

    Hi All

    One key strategy I use manually is confirmation of direction with market structure or break of market structure. This uses significant higher highs and significant lower lows.

    I am wondering if it is possible to code this? For example if I enter into a Long trade with defined target (say TP=100) and stop loss (say SL=20), then when the market structure continues in my favour I want to move my SL to BE & then continue to move my SL via trailing stop as market continues in my favour

    I currently do this by (on a Long Trade) looking for a past significant high to be broken up after entering ( current higher high) and a higher low been established after a previous significant Low.

    I’ve attached a Line & Point as well as a candlestick chart to illustrate the strategy, so basically I would be looking for a sequence as below as price cycles up:

    1. H2 > H1
    2. L2 > L1
    3. Then move SL to break even
    4. IF H3 > H2 & L3 > L2 Then
    5. Move SL to L1 etc etc
    6. Exit would be if price breaks this market structure say if
    7. H3 < H2 & L3 < L2

    The strategy obviously would need to be scanning previous reference bars from entering into the trade (or last reference bar if first BE condition has already been met) to establish these significant Highs & Lows rather than just the previous bar.

    Does this sound feasible?

    #137288

    There you go (I did not test it, though):

    a significant Swing point is often recognized as such by the space to its left, so I used a LOOKBACK value of 10 bars, which you can adjust to suit your needs.

    Of course this snippet is to be added to your existing code.

     

    2 users thanked author for this post.
    #137290

    Above added as Log 228 to here …

    Snippet Link Library

     

    1 user thanked author for this post.
    #137292

    Thanks Roberto, I’ll give this a go and see how she flies!

    I appreciate it

    #137293

    I changed line 6 to “ Not OnMarket” (there was a missing space). Sorry.

     

    #137297

    Cool, thanks

    Initial tests were getting an error message of:

    Variable not used Sighi2 & Siglo2

     

    #137314

    Indeed they are not used, so you can delete lines 2, 4, 18 and 24.

    1 user thanked author for this post.
    #137413

    Hi Roberto
    Please find attached the code in which I’ve inserted your modified suggestion. I’ve also attached the results.
    I cannot see why it doesn’t take profits at the first break of Market structure (I’ve marked up the chart)?
    The code I’ve used gets me in at a set point on the 20 sec chart & I’me using your code on the 1 hr to monitor when there is a sign of it reversing.
    The plan is if I can get this recognising a change in market structure (either a break, hence reversal or a continuation I can then ask it to either move my stop to BE and follow it up on subsequent significant higher highs etc. Or take profits if a definite
    break of structure.
    Any suggestions
    Steve

    #137416

    I’ll take a look at your code tomorrow morning.

    Please do not add text to your code, unless each line is commented with leading double slashes “//“. Thank you 🙂

    I moved it below your code.

    #137427

    Hi

    Line 21 or 27 something wrong in code?

    #137428

    Great thanks

    #137477

    I tested it on Usd/Cad, 1h + 20s, but no trade was enterd on June 23rd at 13:00 (my first trade was entered on the 24th.

    Can you post a more recent trade (20 seconds only have about 5 days of data history) ?

     

    #137511

    Will do

     

    #137529

    Hi Roberto – I’ve used USD/JPY with a set point at 10691 just to get an entry

    Regards

    Steve

    #137538

    Sorry, buy I don’t jave thet instrument and can’t replicate your trades.

    I have Spot UsdJpy, or IG’s CFD.

     

     

Viewing 15 posts - 1 through 15 (of 20 total)

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