Is there any point devising strategies and backtesting?
Forums › ProRealTime English forum › ProOrder support › Is there any point devising strategies and backtesting?
- This topic has 7 replies, 3 voices, and was last updated 1 year ago by nightjimbob.
-
-
08/02/2023 at 7:39 AM #218469
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:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899//-------------------------------------------------------------------------// Main code : RapidReturn WTIv3//-------------------------------------------------------------------------//-------------------------------------------------------------------------// Main code : RapidReturn WTIv3//-------------------------------------------------------------------------//-------------------------------------------------------------------------// Main code : RapidReturn WTIv3//-------------------------------------------------------------------------//-------------------------------------------------------------------------//TDI OIL Brent Crude (5Min) Alpha Commodities////-------------------------------------------------------------------------// code-ParameterDEFPARAM CumulateOrders = false//Default position size =1PositionSize = 2.2timeframe(1 hour, updateonclose)myrsi = rsi[13]indicator4, ignored, ignored = CALL "MetaScore"[80, 0, 0](close)c3 = (indicator4 < 70)c4 = (indicator4 > 23)buycondition = myrsi > 15sellcondition = myrsi < 63//TDI indicator//parameters ://orders management on the 1 minute timeframetimeframe(5 minute, default)lengthrsi=13lengthrsipl=2lengthtradesl=7//overbought and oversold values of the TDI indicatorupperzone = 55lowerzone = 2//upperzone = upz//lowerzone = loz//heiken ashixClose = (Open+High+Low+Close)/4if(barindex>2) thenxOpen = (xOpen[1] + xClose[1])/2xHigh = Max(xOpen, xClose)xLow = Min(xOpen, xClose)endif//indicatorsr = rsi[lengthrsi](close)mab = average[lengthrsipl](r)mbb = average[lengthtradesl](r)yellowMA = average[5](TypicalPrice)yellowMAshifted = yellowMA[2]//trade conditionslongCondition = mab crosses over mbb AND mab<50 AND xHigh>yellowMAshifted AND buycondition AND c3shortCondition = mab crosses under mbb AND mab>52 AND xLow<yellowMAshifted AND sellcondition AND c4Longsell=mab crosses under mbb AND mab<upperzone and mab>56 AND xlow>yellowMAshiftedShortexit= 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// longIF Not LONGONMARKET AND longcondition THENBUY PositionSize CONTRACT AT MARKETENDIF// shortIF Not SHORTONMARKET AND shortCondition THENSELLSHORT PositionSize CONTRACT AT MARKETENDIF// close positionIF LONGONMARKET and Longsell then//or longsell2 THENSELL AT MARKETENDIFIF SHORTONMARKET and Shortexit then//or shortexit2 THENEXITSHORT AT MARKETENDIFMyATR = AverageTrueRange[14](close)//SET STOP LOSS MyATR * 2//Can use ATR loss for lower risk//SET STOP PLOSS 65// SET TARGET PROFIT "value"p = 165SET TARGET PPROFIT (p) //395//SET STOP ploss 23008/02/2023 at 7:59 AM #218476FYI
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.- Spread
- Slippage
- 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”)
- Different trading hours (ProOrder code launched in a different time zone / custom hours, by the user)
- Coding problem: division by zero error, null or negative periods for indicators, ..
- Lack of responsiveness of IG demo servers (if IG is the broker), although this has improved considerably since last year.
- Make backtests without tick-by-tick option
- “set stop trailing” instruction that give IG the total control of your stoploss, can be moved differently between accounts due to points above
- Limited risk accounts and their rules
- Guaranteed stoploss rules and fees
- 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.
- Margin required on the trading account (no demo or backtest tests are made on this subject)
- Overnight and overweekend fees
- Automatic adjustement of stop orders checked or not when launching the ProOrder
- Minimal distance used in backtests for pending orders, not the same as in real trading, due to broker requirement
- 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.08/08/2023 at 8:42 AM #218709Prior 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
08/08/2023 at 9:04 AM #218711I 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.
08/08/2023 at 9:10 AM #21871608/08/2023 at 9:21 AM #21871908/09/2023 at 12:17 PM #218822Position size of orders in your IG statement is not the same as the one from your backtest, maybe that’s related:
- change position size with 1 for example
- make sure you have sufficient margin required
- check orders list rejection in the platform
- check in ProOrder that these IG statement orders were really launched by the code?
08/09/2023 at 5:11 PM #218843Thank 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
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on