Request for a simple strategy to be coded for spread betting

Forums ProRealTime English forum ProOrder support Request for a simple strategy to be coded for spread betting

Viewing 11 posts - 1 through 11 (of 11 total)
  • #108174

    Dear ProRealCoders,

    I’ve enjoyed using this site for a few years now, checking out and testing all the cool systems you guys have coded. This is the first time I’ve posted on the forum, and I hope that this isn’t against any regulation to request a build of a strategy, but I thought I’d ask anyway. The thing that I have no idea how to achieve here is the way I’d like the trailing stop loss to work, need some people with actual mad skills to help me get it live!

    I’m looking to build a simple price action strategy using the following criteria:

    New Daily Hi/Lo with Trailing Stop

    Assets to trade

    • FTSE 100.

    Bet Size

    • £1 per pip.

    Time Frame

    • Daily.

    Conditions for BUY

    • Price is greater than the previous candle’s high. (NOT the close, the high!)
    • Stop loss should be placed 15 pips below the low of the previous candle.
    • With each new candle that’s formed where you’re not stopped out, move the stop loss to 15 pips lower than the previous candles’ low.
    • Open BUY bet on next candle open

    Conditions for SELL

    • Price is less than the previous candle’s low. (NOT the close, the low!)
    • Stop loss should be placed 15 pips above the high of the previous candle.
    • With each new candle that’s formed where you’re not stopped out, move the stop loss to 15 pips higher than the previous candles’ high.
    • Open SELL bet on next candle open

    Condition for EXIT

    • When trailing stop loss is triggered.

    Times to trade

    • No limitations on time of day to trade.

    EXTRA NOTES

    • I don’t plan for this simple system to open any new positions when there’s already a trade open.
    • This is for spread betting NOT CFD trading

     

    I’m incredibly grateful for any help or guidance provided here.

    Many thanks coders!

    Matt

    #108183

    AugustusKing – Welcome to the forums. Your topic is about an automated strategy code so I have moved it to the ProOrder forum which is dedicated to automated strategies. I will move the topic to that forum. Please try to post in the most relevant forum with any future topics.

    1 user thanked author for this post.
    #108185

    Well done @AugustusKing your strategy specification is one of the best laid out / formatted I’ve ever seen on here … I’m sure somebody will help you out soon! 🙂

    1 user thanked author for this post.
    #108186

    I really appreciate that, I have manually backtested over various assets including main fx pairs, indices and commodities and it appears to be profitable to a realistic and sustainable level. Drawdowns are low and it performs robustly across various market conditions. I’m excited to see if anyone is willing to help me code this so that I can test it more extensively and then apply it across multiple asset classes. Appreciate the support.

    #108187

    This does what you describe but not profitably! Image shows FTSE100 daily. Even if you separate the long and short parts of the strategy it is not pretty.

     

    #108192

    Hi, and thank you so much for taking a bash on the code for this. Can I just ask if this trails the stop loss with each new candle that is formed or if it fixes the stop at 15 below the low on entry?

    I only ask because when I run the backtest on the code you’ve given me it gets the entries just as I would do it manually, but the exits are different to where I’m taking them manually, so I feel like I’ve possibly left something out of my description or not conveyed it well.

    I have written on a screengrab of one trade example to highlight where my intended system differs from the code you’ve included. Follow the steps in the order I’ve numbered them. You can see where the PRT backtesting has entered and exited and where I’d need it to exit. Basically the SL is not moving along when a new candle is formed (it’s staying where it was initially placed). This is the major problem here from what I can see.

    Additionally, I notice this code deals in ‘contracts’ rather than ‘bet size’, would this still work for automating trading on a spread bet account within PRT?

    I hope this is helpful. Just want to reiterate how much I appreciate you taking the time to help with this.

    Regards

    Matt

    #108198

    Sorry – I got the exits one candle too far back Try this instead:

     

    1 user thanked author for this post.
    #108202

    Thank you Vonasi,

    That seems to all work as intended at first glance. I will dig a little deeper, but for now, it’s thrown up some unexpected surprises for me (which is a good thing, even if negative!!). I manually backtested it on EUR/USD for 2019 and it was profitable, but on this code it’s not… it’s more likely there was an error with my manual backtest I’m sure, but I’ll double-check things to make sure.

    I can see that it works profitably in the long term on the following markets:

    DAILY CHARTS

    • NIKKEI
    • DAX
    • NASDAQ
    • DOW
    • BRENT CRUDE

    4HR CHARTS

    • DOW
    • NATURAL GAS

    1HR CHARTS

    • Italy 40
    • NASDAQ
    • DOW

    Time to dig a little deeper, actually look at drawdowns, profit factor and how it performs in the various market conditions to see if it’s a viable system to persist with developing 🙂

    Do you, or anyone else have any thoughts, observations or ideas on it?

    Thanks for this Vonasi

    Matt

    #108203

    A fixed SL distance of +/- 15 will not fit all markets. Range on markets changes with time so something like the Dow will have a smaller range in 2010 compared to today but as a percentage of price it is lower so an adaptable SL distance will most likely work better than a fixed one.

    #108204

    A fixed SL distance of +/- 15 will not fit all markets. Range on markets changes with time so something like the Dow will have a smaller range in 2010 compared to today but as a percentage of price it is lower so an adaptable SL distance will most likely work better than a fixed one.

    Yep definitely, will need to go through various markets experimenting with which SL ranges work best, that’ll help!! 🙂

    Thanks, have a great week as well by the way!

    #108208

    I have written on a screengrab

    Gold star for clarity of layout  … what screengrab sw have you used for this?

    AugustusKing wrote:

    Additionally, I notice this code deals in ‘contracts’ rather than ‘bet size’, would this still work for automating trading on a spread bet account within PRT?

    Yes

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

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