Besoin de comprendre un code, backtest 100% gagnant
Forums › ProRealTime forum Français › Support ProOrder › Besoin de comprendre un code, backtest 100% gagnant
- This topic has 3 replies, 3 voices, and was last updated 1 year ago by
FXtonio.
Viewing 4 posts - 1 through 4 (of 4 total)
-
-
06/22/2023 at 10:35 AM #216613
Bonjour à tous,
je suis tomber sur le code ci dessous et je souhaiterais comprendre quelque chose, sur les backtest en m5 sur le dax, us tech et cac 40, l’aLgo affiche toujours 100% de trades gagnant,
peut importe le nombre de bougies backtester, est ce que j’aurais enfin trouver le graal ou est ce que c’est un bug du backtest ?
CI-dessous le code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172//-----------------------------------------------------------------------------------------------//TF a 12 h//dax min 1 Eur.//-----------------------------------------------------------------------------------------------//TAKE PROFIT NEAR ZERO IN ORDER TO NOT ACCUMULATE TOO MUCH//-----------------------------------------------------------------------------------------------//IF NOT ON MARKET TRY TO ENTER AGAIN AS SOON A CORRECTION APPEARS, TRYING TO FOLLOW//THE POTENTIAL CURRENT UPTREND//-----------------------------------------------------------------------------------------------//IF I BOUGHT THE PREVIOUS BAR DON'T BUY THE FOLLOWING BAR IN ORDER TO NOT ACCUMULATE TOO MUCH//-----------------------------------------------------------------------------------------------//MAIN PARAMETER IN ORDER TO CHANGE THE RISK LEVEL ARE://acc----> % of decrease of the instrument compared to the last buy price (THE LOWER IS AND MORE// RISK AND CASH RETURN WILL APEEAR)//-----------------------------------------------------------------------------------------------//tp-----> % beyond which the entire position is closed (THE HIGHER IS AND MORE// RISK AND CASH RETURN WILL APEEAR) - below zero is safer !//-----------------------------------------------------------------------------------------------//MONEY MANAGENT "ANTIMARTINGALA" STYLE - I SUPPOSE CLEARER RESULTS ON A LONGER PERIOD OF BACKTEST//-----------------------------------------------------------------------------------------------DEFPARAM cumulateorders = falseDEFPARAM Preloadbars = 20000TIMEWORK = 070000TIMESTOP = 210000acc = 5if justone = 0 thencapital = 10000 * pointvaluejustone = 1endifperccap = 0.5margin = 0.5 * close * pointvalue / 100period=5stdev=STD[period](close)//LOOK FOR A LOCAL VOLATILITY DECREASE//I WANT TO BUY AGAIN ONLY WHEN BEAR MARKET SHOWS A LOCAL PAUSEif (stdev[0]+stdev[1]+stdev[2]+stdev[3]+stdev[4]) < (stdev[1]+stdev[2]+stdev[3]+stdev[4]+stdev[5]) thenSWBUY=1elseSWBUY=0ENDIFIF TIME > TIMEWORK AND TIME < TIMESTOP THENif not onmarket thensizebuy = ROUND((capital *perccap /100)/ margin)tp = 0.25IF CLOSE < CLOSE[1] THENBUY sizebuy SHARES AT MARKETendifendifif LONGONMARKET thenperf = (close - POSITIONPRICE)/POSITIONPRICE * 100if perf > tp thenSELl AT MARKETperfc = (close - POSITIONPRICE) * POINTVALUE * COUNTOFPOSITIONcapital = capital + PERFCELSEIF LASTBARBUY = 0 THENif (((CLOSE-TRADEPRICE)/TRADEPRICE)*100) < -acc AND SWBUY=1 thensizebuy = ROUND((capital *perccap /100)/ margin)BUY sizebuy SHARES AT MARKETLASTBARBUY = 1ENDIFELSELASTBARBUY = 0ENDIFENDIFENDIFENDIF06/23/2023 at 5:00 AM #21663806/23/2023 at 10:04 AM #21664806/26/2023 at 6:47 AM #216747 -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
Find exclusive trading pro-tools on
Similar topics: