Simulated Trading

Forums ProRealTime English forum ProOrder support Simulated Trading

Viewing 15 posts - 1 through 15 (of 53 total)
  • #80482

    As Nicolas has posted a great new blog on using simulated trading to improve strategy performance at:

    https://www.prorealcode.com/blog/learning/how-to-improve-a-strategy-with-simulated-trades-1/

    I thought that I would post something a little similar (but not as good!) that I wrote a while back. I have never used it in anger in a live or demo strategy as I felt the value of the average period was too critical as to whether it worked well or not. Maybe a better filter can be used?

    I tested it on the SP500 weekly. Obviously there is no real strategy involved as it just buys every week if it is not on the market and sells at the close of a week if it is in profit or if the week has closed higher than the previous weeks high.

    As with all uses of an average it will be curve fitted dependent on the average period selected. Also just like Nicolas’s example the filter does not come into play until x number of trades have passed. It would be possible to alter the code so that these are either real trades or simulated trades depending on your appetite for risk I guess.

    Here are the results with a period of 20:

    Screenshot_4-1

    Maybe a discussion on similar codes and the use of simulated trades will be of interest to someone?

    1 user thanked author for this post.
    #80486

    Thanks for sharing your version.

    In your code you are averaging the equity curve with a period set in time (quantity of candlesticks), so stop me if I’m wrong but the real trading could begin again if the time has passed by sufficiently for the equity curve to be computed with X same value.

    Average[X](data) will get the last X data in the last X candlesticks, so if data is not changing  you could have X times the same data, so the average is wrong 😐

    I made something similar in this old blog article: Trading the strategy profit curve

    #80488

    Yes – that is true. It is something I coded quite a long time ago – and that may have been the reason I gave up on it!

    Maybe it is time to re-visit the idea and see if it can be improved in some way.

    #80498

    Here’s the same strategy entry and exit criteria but this one keeps a simulated record of the last 10 trades. If the last 10 trades add up to an overall loss then real trading stops and simulated trades are recorded. Real trading does not resume until the last last ten trades have returned to an overall profit.

    Once again the filter is not applied to the first 10 trades.

    Screenshot_5-1

    #80501

    This version will start applying the filter after the first trade as I realised that it is not necessary to wait. If the first trade loses then simulated trades are recorded but if it is a winner then live trading continues until the strategy goes into its first 10 trade negative equity.

     

    1 user thanked author for this post.
    #80511

    Nice use of variables without using loops or arrays! 😆

    I’m wondering if this kind of orders management could improve or not a strategy you already know for sure it will not win at the end!

    #80519

    While typing it I was thinking that access to arrays would be nice!

    I guess it would be an improvement to most strategies even losing ones but then there is always the chance that you could have a big loss that keeps you out of the market for the next nine small wins and then just when you get back to live trading another big loss. I suppose that for trading strategies where the wins are a similar size to the losers then this sort of filter might be more beneficial.

    In the weekly SP500 example shown it seems like a reasonable filter to keep a long only strategy out of the market in major corrections.

    #80577

    I thought it would be nice to see if the ten day floating equity curve as a filter would improve a random strategy. So I wrote a strategy that bought the SP500 after a three day drop and sold if the price went over an average – nothing else – no stops or take profits and no more than one position held at a time. I used a spread of 1.6.

    Here are the results:

    Screenshot_2-1

    Then I added the ten trade floating equity curve filter to see if it improved it at all. Here are the results:

    Screenshot_3-2

    The conclusion was that using the filter resulted in more profit, slightly better gain per trade, slightly better win ratio, less time in the market but most importantly a big improvement in draw down.

    This sort of equity curve filtering may have some merit it seems but further testing is needed on the effect of such things such as number of trades used to calculate the floating equity curve before a full conclusion can be reached.

    1 user thanked author for this post.
    #80661

    More patterns for your tests: http://paststat.com/quant-ideas

    1 user thanked author for this post.
    #80683

    Another idea I am testing is comparing a five trade floating equity curve with a ten trade floating equity curve and only trading live if the ten trade curve is above the five trade curve.

     

    1 user thanked author for this post.
    #80703

    You have almost rewrote “Dual momentum” theory from scratch 🙂

    #80735

    You have almost rewrote “Dual momentum” theory from scratch 🙂

    Almost… but with errors! I just noticed that I am comparing the first 5 trades in the 10 recorded trades instead of the last 5 trades. Here is the corrected code:

     

    1 user thanked author for this post.
    #153539

    My question is if trades could be simulated until it exceeds the drawdown.

    That is to say:

    Win

    Win

    Win

    Lose, and the drawdown begins

    Lose, sham operation

    Win, simulated trade, still not over drawdown

    Win, simulated trade, still not over drawdown

    Win, simulated trade, and beat the drawdown

    Start trading real money again.

     

    Its possible?… I need code!

    Thanks!!!

    #153983

    Thats possible Fran55?

    It is a very good idea.

    #154301

    Ale, merry christmas on the floor to all people and hippie new year!

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

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