WARNING! IG Backtests are currently wrong!

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #21125 quote
    Derek
    Participant
    Veteran

    Hi all!

    Please look at the attached screenshot of a 20 day simple moving average trading system.

    DEFPARAM CumulateOrders = False 
    
    indicator1 = close
    indicator2 = Average[20](close)
    c1 = (indicator1 CROSSES OVER indicator2)
    
    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    indicator3 = close
    indicator4 = Average[20](close)
    c2 = (indicator3 CROSSES UNDER indicator4)
    
    IF c2 THEN
    SELL  AT MARKET
    ENDIF

     

    I wasted my complete sunny saturday morning trying to fix a coding error until I turned really exhausted, frustrated and angry.

    So, if you are reading this:

    Use your weekend to the fullest and don’t waste it like I did!

    Enjoy yourselves.

    #21133 quote
    Derek
    Participant
    Veteran

    I just want to add a similar screenshot from Prorealtime. It is not happening here.

    #21137 quote
    Nicolas
    Keymaster
    Master

    So this is a “long only” strategy?

    I’m currently reading the forum on my smartphone so I don’t understand clearly the screenshots you shared.

    #21138 quote
    Derek
    Participant
    Veteran

    Yes, it is. But it is a sample strategy to explain the problem more easily.

    Guess that did not work right either…

    The screenshot shows that trades are being entered and exited without a cross in the previous period.

    #21151 quote
    Nicolas
    Keymaster
    Master

    So the first screenshot is from a live account and the second one a backtest? I’m trying to understand, because I don’t notice any error in your code.

    #21156 quote
    Derek
    Participant
    Veteran

    Hello Nicolas,

    that is what I am saying: “Backtests are currently wrong”.

    Both screenshots are from backtests. And I am also 100% sure that the code is correct. Especially since the results from the Prorealtime PRT are the way they should be.

    My partner has issued a ticket to IG and I will post the reply here.

    #21159 quote
    Derek
    Participant
    Veteran

    @Nicolas: Maybe you can remove my inappropriate rant about cfd brokers from the opening post?

    #21163 quote
    Elsborgtrading
    Participant
    Veteran

    Seems like there is a problem with the “Cross over/under” function in backtest.

    After reading this post I explained a similar error here.

    Edit: Despite the rant- was it an actually explanation you were given- about the bug fix?

    Cheers Kasper

    #21188 quote
    mal
    Participant
    Average

    I Think it could be possible that it is right.

    At your first picture it open at 22 and close at 13, open at 19 an close at 24 …

    so this is right I think, but I didn´t understand why the system is open a position: Close = the line with green and red, Average = blue?!

    #21191 quote
    mal
    Participant
    Average

    by picture one, after the code

    #21195 quote
    Derek
    Participant
    Veteran

    @Kasper: There is no response from IG, yet. I think I was more angry at myself then anything else. This observation does big damage to my belief that the backtested results are correct and/or the indicators are represented correct on the chart. I have noticed things like this before but always chose to go the easy way. I mean I told myseld “It’s just a temporary bug that will be fixed very soon.”.

    #21196 quote
    Derek
    Participant
    Veteran

    @mal: I count six orders that should not have happened in the backtest. The other 3 are correct.

    #21197 quote
    Derek
    Participant
    Veteran

    @Nicolas: Thank you. Is there an edit button and I just don’t see it?

    #21198 quote
    Elsborgtrading
    Participant
    Veteran

    @Derek, I think this is a great opportunity to address the problem, not with IG, but have it escalated to Prorealtime. You have an obvious error that is so clear and simple that it cannot be denied.

    Cheers Kasper

    #21199 quote
    JC_Bywan
    Moderator
    Master

    Hi,

    Maybe the problem here is different from the one I encoutered last November, but just in case it could be the same, I’ll mention it anyway:

    I also found a problem with a buy order in a backtest I did back in November and in this case I narrowed it down to a stochastic value being different from expected. Just to be 100% sure it wasn’t my code I then made a simple test “outside” of my code, looking at that stochastic value in probuilder, and running a dummy probacktest only calculating and displaying the same stochastic via Graph. I found some differences between the probuilder stochastic and the probacktest stochastic, I talked about it with Nicolas (who guessed correctly what the problem was going to be) on the PRC french forum, and also sent my tests results to PRT sincerely thinking I found a bug.

    The answer from PRT surprised me: it was because my chosen settings was “not displaying weekend data”, but the backtests are always “using weekend data” (those few ticks sunday night on CFD’s…). So on one hand I was happy to see there was neither a problem with my code nor a PRT bug creating calculations errors strictly speaking, but on the other hand, I was not so pleased to discover that if I choose not to display weekend data, that choice works only for my indicators in probuilder but it is not applied to my backtests running on PRT server side…

    This means that depending on the chosen timeframe and indicators used in my code, anything needing to look back in the past earlier than first candle monday morning, could end up with a different value than expected for things like a stochastic (in case extremes affecting it are made on a sunday). And very likely will be different for things like ema’s and macd’s that would use sunday data instead of friday’s…

    Again, I am not saying the same thing happened with your MA20 I haven’t tested it, I’m just saying what I discovered, in case the same thing applies here (which can be tested if you choose to display weekend data in the PRT timezone options)

    Elsborgtrading, Derek and manel thanked this post
Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.

WARNING! IG Backtests are currently wrong!


ProRealTime platform support

New Reply
Author
author-avatar
Derek @derek Participant
Summary

This topic contains 18 replies,
has 5 voices, and was last updated by JC_Bywan
9 years ago.

Topic Details
Forum: ProRealTime platform support
Language: English
Started: 01/14/2017
Status: Active
Attachments: No files
Logo Logo
Loading...