Breakout strategy – coding help

Forums ProRealTime English forum ProOrder support Breakout strategy – coding help

Viewing 5 posts - 1 through 5 (of 5 total)
  • #25518

    Hi all,

    First post here. I’ve been trying to code a breakout strategy, but I haven’t been able to get all of it to work. I have searched around the site for any useful code posted by others, but haven’t found anything that does what I need it to. Details are below:

    • GBP/USD 15 mins
    • Breakout box for 4am-6am (GMT) including 6am bar
    • If EMA89 crosses inside this box, no trades that day
    • Order closed if not filled by 4:30PM
    • Flat after 9:45pm

    Entry

    • If EMA89 is always above breakout box in this time period, sell 5 pips below the low of breakout box
    • If EMA89 is always below breakout box in this time period, buy 5 pips above the high of breakout box

    Exit

    • Target: 75 pips
    • Stop: 20 pips. Stop moved to breakeven when profit is 20 pips, and trailed to halfway between high and breakeven.

    Is it possible to put this strategy into code? I can give more detail if necessary

    Kind regards,

    Carl

    #145431

    There you go:

     

    2 users thanked author for this post.
    #146282

    Thanks Roberto, this is great. I’ve been playing around with this to improve performance (now on 1hr timeframe, added code to reinvest profits, etc), but I now want to limit this to only 2 orders per day. The system will currently take the same trade again on the same day if it has already opened and closed a trade. I’ve added some code I found here https://www.prorealcode.com/topic/3-trades-per-day/ but this hasn’t made a difference. Can you see what I’ve done wrong?

     

    #146315

    Try replacing line 41 with:

    and use Count <2 at lines 45 and 50.

    Using <3 will set your max number of trades to 3.

     

    1 user thanked author for this post.
    #146325

    Link to above added as Log 248 to here …

    Snippet Link Library

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

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