Is there any point devising strategies and backtesting?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #218469 quote
    nightjimbob
    Participant
    New

    Is there any point devising strategies and backtesting when the real world trades and results bear no resemblance whatsoever to them, I am using the below code, have run it for 10 days linked to IG. The orders it takes are losing ones, and have no correlation to what the backtesting said it would:

    //-------------------------------------------------------------------------
    // Main code : RapidReturn WTIv3
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Main code : RapidReturn WTIv3
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    // Main code : RapidReturn WTIv3
    //-------------------------------------------------------------------------
    //-------------------------------------------------------------------------
    //TDI OIL Brent Crude (5Min) Alpha Commodities
    //
    //-------------------------------------------------------------------------
     
    // code-Parameter
    DEFPARAM CumulateOrders = false
    
    //Default position size =1
    PositionSize  = 2.2
    
    
    
    timeframe(1 hour, updateonclose)
    myrsi = rsi[13]
    indicator4, ignored, ignored = CALL "MetaScore"[80, 0, 0](close)
    c3 = (indicator4 < 70)
    c4 = (indicator4 > 23)
    buycondition = myrsi > 15
    sellcondition = myrsi < 63
     
    //TDI indicator
    //parameters :
    //orders management on the 1 minute timeframe
    timeframe(5 minute, default)
    lengthrsi=13
    lengthrsipl=2
    lengthtradesl=7
     
    //overbought and oversold values of the TDI indicator
    upperzone = 55
    lowerzone = 2
    //upperzone = upz
    //lowerzone = loz
     
    //heiken ashi
    xClose = (Open+High+Low+Close)/4
    if(barindex>2) then
    xOpen = (xOpen[1] + xClose[1])/2
    xHigh = Max(xOpen, xClose)
    xLow = Min(xOpen, xClose)
    endif
     
    //indicators
    r = rsi[lengthrsi](close)
    mab = average[lengthrsipl](r)
    mbb = average[lengthtradesl](r)
    yellowMA = average[5](TypicalPrice)
    yellowMAshifted = yellowMA[2]
     
    //trade conditions
    longCondition = mab crosses over mbb AND mab<50 AND xHigh>yellowMAshifted AND buycondition AND c3
    shortCondition = mab crosses under  mbb AND mab>52 AND xLow<yellowMAshifted AND sellcondition AND c4
     
    Longsell=mab crosses under mbb AND mab<upperzone and mab>56 AND xlow>yellowMAshifted
    Shortexit= mab crosses over mbb AND mab>lowerzone and mab<56 AND xhigh>yellowMAshifted
    //Longsell=mab crosses under mbb AND mab<upperzone and mab>55 AND xlow>yellowMAshifted
    //Shortexit= mab crosses over mbb AND mab>lowerzone and mab<58 AND xhigh>yellowMAshifted
    //Longsell2=mab crosses under lowerzone
    //Shortexit2=mab crosses over upperzone
    //***************************
     
    // open position
    // long
    IF Not LONGONMARKET AND longcondition THEN
    BUY PositionSize CONTRACT AT MARKET
    ENDIF
     
    // short
    IF Not SHORTONMARKET AND shortCondition THEN
    SELLSHORT PositionSize CONTRACT AT MARKET
    ENDIF
     
    // close position
     
    IF LONGONMARKET and Longsell then//or longsell2 THEN
    SELL AT MARKET
    ENDIF
    IF SHORTONMARKET and Shortexit then//or shortexit2 THEN
    EXITSHORT  AT MARKET
    ENDIF
    
    MyATR = AverageTrueRange[14](close)
    //SET STOP LOSS MyATR * 2
    //Can use ATR loss for lower risk
    //SET STOP PLOSS 65
    // SET TARGET PROFIT "value"
    p = 165
    SET TARGET PPROFIT (p) //395
    //SET STOP ploss 230
     
    
    
    
    orders.png orders.png IGord.png IGord.png
    #218476 quote
    Nicolas
    Keymaster
    Master

    FYI

    Attached is a non-exhaustive list of the elements that can impact a live trading strategy and create differences with a demo account and/or backtests, I’ve highlighted in bold the truest similarities to this particular strategy.
    1. Spread
    2. Slippage
    3. Orders rejections due to one of the above reason, but also because of the allowed distance from current price to put pending orders (known as “minimal distance”)
    4. Different trading hours (ProOrder code launched in a different time zone / custom hours, by the user)
    5. Coding problem: division by zero error, null or negative periods for indicators, ..
    6. Lack of responsiveness of IG demo servers (if IG is the broker), although this has improved considerably since last year.
    7. Make backtests without tick-by-tick option
    8. “set stop trailing” instruction that give IG the total control of your stoploss, can be moved differently between accounts due to points above
    9. Limited risk accounts and their rules
    10. Guaranteed stoploss rules and fees
    11. Starting a strategy at a different time (1 hour or even 1 minute later): depending on the code of the strategy, the results of some calculations could be different.
    12. Margin required on the trading account (no demo or backtest tests are made on this subject)
    13. Overnight and overweekend fees
    14. Automatic adjustement of stop orders checked or not when launching the ProOrder
    15. Minimal distance used in backtests for pending orders, not the same as in real trading, due to broker requirement
    16. Different contract size between backtests and live
    Because backtests are only tested on history *with no connection to live market* , you may encounter differences with real live trading environment subject to spread enlargement, slippage, etc.
    #218709 quote
    nightjimbob
    Participant
    New

    Prior to setting my strategy live it had never had such a losing streak as this – something fishy is going on on IG’s side and it isn’t just slippage. How could so many strategies that show as winning in backtesting be bankrupting all users? The coding behind their side is very opaque and for all we know, they are profiteering massively on the backs on PRT users

    #218711 quote
    GraHal
    Participant
    Master

    I sympathise and smile at same time; your thoughts echo same as many of us have had at some stage.

    First off, are you 100% sure you had tick by tick enabled when you backtested?

    I’ll run your code on my Platform and see if I have moree to add later.

    #218716 quote
    GraHal
    Participant
    Master

    To run your code myself, I would need the Indicator MetaScore and, as I can’t see it in the Library, I take it you bought off MarketPlace?

    If Yes, does the Vendor have any comments to alleviate your frustration?

    #218719 quote
    GraHal
    Participant
    Master

    Yes, I found MetaScore Indicator on MP … sounds good, a confluence score of many Indicators!?

    #218822 quote
    Nicolas
    Keymaster
    Master

    Position size of orders in your IG statement is not the same as the one from your backtest, maybe that’s related:

    1. change position size with 1 for example
    2. make sure you have sufficient margin required
    3. check orders list rejection in the platform
    4. check in ProOrder that these IG statement orders were really launched by the code?
    #218843 quote
    nightjimbob
    Participant
    New

    Thank you both for your kind sympathy and input – I think this is more about whining than not winning. I do recommend Metascore, will keep trying and keep all of your advice in mind

    GraHal thanked this post
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Is there any point devising strategies and backtesting?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by nightjimbob
2 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/02/2023
Status: Active
Attachments: 2 files
Logo Logo
Loading...