Help with basic strategy

Forums ProRealTime English forum General trading discussions Help with basic strategy

Viewing 8 posts - 1 through 8 (of 8 total)
  • #31813

    Hi,

    Was hoping someone could provide me with some code for a very simple strategy. I cant quite get the code to do what i want it to. below are the parameters;

    Trading on the major FX pairs (usd/jpy, eur/usd, gbp/usd etc)

    Daily bars

    If previous days bar was an up bar (open < close) then I want to sell on the previous days low

    If previous days bar was a down bar (open > close) then i want to buy on the previous days high

    stop will be 10 points

    limit/target will be 40

    If the limit or stop hasnt been hit during the trading day I want to exit on the close of that same day.

    Only want to trade from monday to friday, wary that there is a sunday bar on the FX due to it opening on sunday for a lot of the world (Im in Australia, opens 7am Monday)

    Ideally would like the backtesting to ignore the sunday bar

     

    Thanks for the help with this.

     

    #31872

    Please find below a rough code that should work for your query. I didn’t test it, please make your own and give feedbacks, thank you.

     

    #31890

    I played around with above and got attached results on DAX 100,000 bars @ 5 Min (cos I like 5 mins  TF 🙂

    Had to change code at Line 5, 10 and 15 to get it going  … rightly or wrongly?

    GraHal

    #31895

    Well done Grahal, I should have tested my code!

    I think the order at line 15 should also be a stop one, we are buying higher, looking for a breakout.

    #31896

    Yeah I tried a stop at Line 15, attached are the results.

    I tried all combinations, with one eye on tv watching a film it’s easier (for me) to try stuff than work out if we’re trading higher or lower 🙂

     

     

    #31916

    The backtest should be made on a daily timeframe, because the pending orders only last one bar in my code. I’m on my smartphone, can’t do it myself!

    #31924

    Nice one Nicolas!  Shut phone and brain off, sit in sun, get whiskey … you’re on holiday??

    WF Results for 1000 Daily bars,

    Daily Code:

    GraHal

     

    #31928

    Attached overall result for above code in tick-tick mode with no WF.

    Any ideas to increase % of winning trades?

    I can’t BT more than 1000 x Daily due to that annoying error message … one or more candles are not available … etc.   

    GraHal

Viewing 8 posts - 1 through 8 (of 8 total)

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