Strategy as indicator to overcome limits of tick by tick

Forums ProRealTime English forum ProBuilder support Strategy as indicator to overcome limits of tick by tick

Viewing 6 posts - 1 through 6 (of 6 total)
  • #106584

    I’m not sure if this should be in ProOrder or Probuilder as it is both a strategy and an indicator!

    I wanted to test some daily strategy ideas that entered long on dips to a price and closed out at a candles close but having to use pending orders for the entry meant that the test data was very limited and on indices such as the SP500 there had been no major downturns within the data so the test results told me nothing about strategy performance in a market crash. So I decided to code an indicator that simulated the strategy and calculated an equity curve.

    The strategy is just basic rubbish and really it was just an experiment to see how easy or difficult it was to code something. I think I achieved my goal and so can at least test strategies that have one pending order. It is still however impossible to simulate strategies that enter and exit using pending orders within one candle due to us not knowing which order was hit first.

    I post it here in case the theory is of interest to anyone.

     

    #106594

    Interesting and could be very useful!

    Link added to here

    Snippet Link Library

     

    #106601

    I made a few improvements to the strategy, the simulation and the presentation.

    It is now possible to turn the arrows on or off as they can make it difficult to see the equity curve.

    The average for both the bands and the entry and exit filter and their average type can be played with to see what historically worked best.

    You can set a start date. I like to test from around 1995 onward as this is when algorithmic trading started taking off. The equity curve is shown from the first trades entry price so it is easy to compare to buy and hold.

    I also removed the if low < average exit filter and added close if close > an upper band based on average rise from close[1].

    I switched to the SP500 weekly and with p1=52, p2=52, t1=2 and t2=0 it gives a pretty nice return beating buy and hold and missing out on all the major crashes and downturns. It hasn’t performed well in the last year (but it also hasn’t lost much) but then that is not surprising considering the sideways volatile market we have had.

     

     

    1 user thanked author for this post.
    #106629

    I made some further changes to my simulated tick by tick with one pending order simulator.

    It now also shows lines for:

    • trade quantity
    • quantity of winning trades
    • quantity of losing trades
    • average gain/loss per trade,
    • win rate%
    • gain/loss percentage compared to buy and hold
    • biggest draw down
    • maximum draw down % from the maximum equity prior to the draw down

     

    There is also now a band width multiplier to allow testing of slightly narrower or wider bands for the entry and exit points.

    Also there is the option to turn on or off the exit condition to exit any time that you are in profit at the close of a candle.

    I’ve added spread into the equity calculation.

    I’ve also added some comments to the code.

    The images show the strategy on the weekly SP500 with and without the ‘get out if in profit’ turned on and with a 1.5 spread. With the settings as shown it beats buy and hold by 9% and 10% with a biggest draw down of 23% and 24% and a win rate of 78% and 80%. Perhaps it isn’t such a bad strategy idea after all – well it would have been a good one at least if I’d started trading it in 1995!

     

    #106643

    Wow!

    I added below to the entry in the Snippet Library

    • loads of useful features!
    1 user thanked author for this post.
    #106644

    Thanks GraHal – after about five minutes testing it on the DJI instead of the SP500 it became apparent that like all average filter based strategies it is heavily curve fitted/tuned to whatever average type and period has worked well in the past. Oh well at least it was an interesting coding challenge and I reminded myself so much why I hate averages.

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

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