Free profitable strategies
Forums › ProRealTime English forum › ProOrder support › Free profitable strategies
- This topic has 53 replies, 19 voices, and was last updated 1 year ago by TimH.
-
-
08/20/2021 at 12:29 PM #175778
Hi,
This is the combination of the 5 different strategies for the DAX which vschmitt Artificall has previously openly shared. I have simply combined them into one strategy, with some additional code kindly provided by robertogozzi
The majority of the performance comes from the Momentum strategy however, the others smooth out the equity curve through their smaller contributions to the overall performance.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311//================================================// Code: _PRD DAX Combi// Source: https://artificall.com// Author: Vivien Schmitt// Version 2// Index: DAX// TF: 10 min// Notes: v1.1 Momentum only// Notes: v2 Portfolio of multi strategies// robertogozzi provided position mgt logic// v2.1 Added Trend Following// v2.2 Added Double Bottom// v2.3 Added Green Hammer// v2.4 Added Counter Trend// v2.5 Tested Day of Week - ignore// v2.5 Optimised position size logic//================================================DEFPARAM CUMULATEORDERS = TRUE // only one trade in the same timeDEFPARAM FLATBEFORE = 090000 // avoide entry opening before this hourDEFPARAM FLATAFTER = 213000 // close entry at this hourIF NOT OnMarket THEN //Make sure you reset these variables to ZERO when not tradingP1 = 0P2 = 0P3 = 0P4 = 0P5 = 0ENDIF//RISK MANAGEMENTPositionSize=1//===================================== MOMENTUM STRATEGY ================================================//MOMENTUM STRATEGY// MARKET TREND USING LINEAR REGRESSION// Set of technical indicators to testIF P1 < 1 THENm10 = momentum[10](close)m20 = momentum[20](close)m50 = momentum[50](close)m100 = momentum[100](close)m300 = momentum[300](close)m800 = momentum[800](close)cM1 = (m10[0]-m10[1]) > 0cM2 = (m20[0]-m20[1]) > 0cM3 = (m50[0]-m50[1]) > 0cM4 = (m100[0]-m100[1]) > 0cM5 = (m300[0]-m300[1]) > 0cM6 = (m800[0]-m800[1]) > 0//--------------------------------------------------------------------------// ENTRY POINT//#13conditionMomentumM = cM1 AND cM2 AND cM3 AND NOT cM4 AND cM5 AND NOT cM6//--------------------------------------------------------------------------// MARKET VOLATILITY USING STANDARD DEVIATIONvolatility100MaxM = 50volatility100MinM = 1volatility100M = STD[100] (close)conditionMarketVolatilityM = volatility100M < volatility100MaxM AND volatility100M > volatility100MinM//conditionMarketVolatility=1//--------------------------------------------------------------------------// OPEN A LONG ENTRYIF conditionMomentumM AND conditionMarketVolatilityM THENPSTOPLOSSMO = 100PTARGETMO = PSTOPLOSSMO * 2SET STOP pLOSS PSTOPLOSSMOSET TARGET pPROFIT PTARGETMOBUY PositionSize CONTRACT AT MARKETP1 = 1ENDIF//SHORT ENTRY CONDITIONSs1 = (m10[0]-m10[1]) < 0s2 = (m20[0]-m20[1]) < 0s3 = (m50[0]-m50[1]) < 0s4 = (m100[0]-m100[1]) < 0s5 = (m300[0]-m300[1]) < 0s6 = (m800[0]-m800[1]) < 0conditionSellMomentum = s1 AND s2 AND s3 AND NOT s4 AND s5 AND NOT s6// OPEN A SHORT ENTRYIF conditionSellMomentum AND conditionMarketVolatilityM THENPSTOPLOSS = 100PTARGET = PSTOPLOSS * 2SET STOP pLOSS PSTOPLOSSSET TARGET pPROFIT PTARGETSELLSHORT PositionSize CONTRACT AT MARKETP1 = 1ENDIFENDIF//===================================== TREND FOLLOWING ================================================//TREND FOLLOWING// MARKET TREND USING LINEAR REGRESSIONIF P2 < 1 THENDRL100 = average[10](LinearRegression[100])slope100 = DRL100[0] - DRL100[1]DRL300 = average[10](LinearRegression[300])slope300 = DRL300[0] - DRL300[1]DRL600 = average[10](LinearRegression[600])slope600 = DRL600[0] - DRL600[1]conditionMarketTrend = slope100 > 0 OR slope300 > 0 OR slope600 > 0//--------------------------------------------------------------------------// MARKET VOLATILITY USING STANDARD DEVIATIONvolatility100Max = 11volatility100Min = 1volatility100 = STD[100] (close)conditionMarketVolatility = volatility100 < volatility100Max AND volatility100 > volatility100Min//--------------------------------------------------------------------------// ENTRY POINTrsi14 = RSI[14] > 30macd12 = MACD [12,26,9] > 0stocha10 = Stochastic[10,3](close) > 0conditionEntryPoint = rsi14 AND macd12 AND stocha10//--------------------------------------------------------------------------// OPEN A LONG ENTRY//IF NOT LongOnMarket AND conditionMarketTrend AND conditionMarketVolatility AND conditionEntryPoint THENIF conditionMarketTrend AND conditionMarketVolatility AND conditionEntryPoint THENPSTOPLOSSMT = 100PTARGETMT = PSTOPLOSSMT * 2SET STOP pLOSS PSTOPLOSSMTSET TARGET pPROFIT PTARGETMTBUY PositionSize CONTRACT AT MARKETP2 = 1ENDIFENDIF//===================================== DOUBLE BOTTOM RECOGNITION ================================================// DOUBLE BOTTOM RECOGNITIONIF P3 < 1 THENONCE period = 10ONCE correlation = 0.8R = 0x1 = 10x2 = 9x3 = 8x4 = 9x5 = 10x6 = 10x7 = 9x8 = 8x9 = 9x10 = 10xBar=(x1+x2+x3+x4+x5+x6+x7+x8+x9+x10)/periodvarianceX=(SQUARE(x1-xBar)+SQUARE(x2-xBar)+SQUARE(x3-xBar)+SQUARE(x4-xBar)+SQUARE(x5-xBar)+SQUARE(x6-xBar)+SQUARE(x7-xBar)+SQUARE(x8-xBar)+SQUARE(x9-xBar)+SQUARE(x10-xBar))/(period-1)ecarTypeX=SQRT(varianceX)y1 = MAX(Open[9], Close[9])y2 = MAX(Open[8], Close[8])y3 = MAX(Open[7], Close[7])y4 = MAX(Open[6], Close[6])y5 = MAX(Open[5], Close[5])y6 = MAX(Open[4], Close[4])y7 = MAX(Open[3], Close[3])y8 = MAX(Open[2], Close[2])y9 = MAX(Open[1], Close[1])y10 = MAX(Open[0], Close[0])yBar=Average[period](Close)ecarTypeY=STD[period](Close)covarianceXY=((x1-xBar)*(y1-yBar)+(x2-xBar)*(y2-yBar)+(x3-xBar)*(y3-yBar)+(x4-xBar)*(y4-yBar)+(x5-xBar)*(y5-yBar)+(x6-xBar)*(y6-yBar)+(x7-xBar)*(y7-yBar)+(x8-xBar)*(y8-yBar)+(x9-xBar)*(y9-yBar)+(x10-xBar)*(y10-yBar))/(period-1)R=covarianceXY/(ecarTypeX*ecarTypeY)IF R < correlation THENR = 0ENDIF//RETURN R AS "R"closeY1 = Close[9]highY5 = high[5]closeY10 = Close[0]neckLine = closeY10 => closeY1 AND closeY10 => highY5conditionDoubleBottom = R AND neckLine//--------------------------------------------------------------------------// OPEN A LONG ENTRY//IF NOT LongOnMarket AND conditionDoubleBottom THENIF conditionDoubleBottom THENPSTOPLOSSDB = 100PTARGETDB = PSTOPLOSSDB * 2SET STOP pLOSS PSTOPLOSSDBSET TARGET pPROFIT PTARGETDBBUY PositionSize CONTRACT AT MARKETP3 = 1ENDIFENDIF//===================================== GREEN HAMMER ================================================//GREEN HAMMER// MARKET VOLATILITY USING STANDARD DEVIATIONIF P4 < 1 THENvolatility100MaxGH = 20volatility100MinGH = 1volatility100GH = STD[100] (close)conditionMarketVolatilityGH = volatility100GH < volatility100MaxGH AND volatility100GH > volatility100MinGH//conditionMarketVolatility=1//--------------------------------------------------------------------------// ENTRY POINT// Strategy of the Doji HammerhammerBody = high = close AND open < closehammerTail = low < open AND (open - low) > ((high - open) * 1.5)dojiHammer = hammerBody AND hammerTail//--------------------------------------------------------------------------// OPEN A LONG ENTRY//IF NOT LongOnMarket AND conditionMarketVolatility AND dojiHammer THENIF conditionMarketVolatilityGH AND dojiHammer THENPSTOPLOSSGH = 80PTARGETGH = PSTOPLOSSGH * 2SET STOP pLOSS PSTOPLOSSGHSET TARGET pPROFIT PTARGETGHBUY PositionSize CONTRACT AT MARKETP4 = 1ENDIFENDIF//===================================== COUNTERTREND ================================================//COUNTERTREND// MARKET TREND USING LINEAR REGRESSION// Set of technical indicators to testIF P5 < 1 THENc1 = LinearRegressionSlope[10](close) > 0c2 = LinearRegressionSlope[20](close) > 0c3 = LinearRegressionSlope[50](close) > 0c4 = LinearRegressionSlope[100](close) > 0c5 = LinearRegressionSlope[300](close) > 0c6 = LinearRegressionSlope[800](close) > 0//--------------------------------------------------------------------------// ENTRY POINT//#13conditionCounterTrend1 = NOT c1 AND NOT c2 AND c3 AND c4 AND NOT c5 AND NOT c6conditionCounterTrend = conditionCounterTrend1//--------------------------------------------------------------------------// MARKET VOLATILITY USING STANDARD DEVIATIONvolatility100MaxCT = 50volatility100MinCT = 1volatility100CT = STD[100] (close)conditionMarketVolatilityCT = volatility100CT < volatility100MaxCT AND volatility100CT > volatility100MinCT//conditionMarketVolatility=1//--------------------------------------------------------------------------// OPEN A LONG ENTRY//IF NOT LongOnMarket AND conditionCounterTrend AND conditionMarketVolatility THENIF conditionCounterTrend AND conditionMarketVolatilityCT THENPSTOPLOSS = 100PTARGET = PSTOPLOSS * 2SET STOP pLOSS PSTOPLOSSSET TARGET pPROFIT PTARGETBUY PositionSize CONTRACT AT MARKETP5 = 1ENDIFENDIFONCE P1 = 0ONCE P2 = 0ONCE P3 = 0ONCE P4 = 0ONCE P5 = 05 users thanked author for this post.
08/20/2021 at 1:59 PM #175797Thanks for ur contribution. Where is the original thread?
1 user thanked author for this post.
08/22/2021 at 12:55 AM #175885I have been using this in a modified form since 08/20. But even the original system still works flawlessly today.
https://www.prorealcode.com/prorealtime-trading-strategies/long-only-strategy-with-the-tma-channel/
08/22/2021 at 7:13 AM #17588908/22/2021 at 8:54 AM #17589308/22/2021 at 8:54 AM #175894Sorry, here is a new link. The link points to the original version, which works fine. I’ll keep my version to myself for now. 😉
https://www.prorealcode.com/prorealtime-trading-strategies/long-only-strategy-with-the-tma-channel/
08/22/2021 at 8:56 AM #17589508/22/2021 at 9:03 AM #175896Ok, it’s a known website bug on a very small number of old links apparently, but a tough one to understand why as previous investigations didn’t solve it. Sorry.
As a workaround please click on the faulty link anyway, and in the address box at top of the page, add with keyboard the word “only” in the middle of … long- -strategy … to make it the normal text: … long-only-strategy …
08/22/2021 at 9:09 AM #17590008/22/2021 at 9:10 AM #17590108/22/2021 at 9:14 AM #175902tough one to understand
Links to Topics that don’t work may be due to the Title / Subject of the Topic having been changed after the original link was created (i.e. before the Topic title was changed).
1 user thanked author for this post.
08/22/2021 at 9:38 AM #175903In this particular case it’s a library topic and title wasn’t changed, but I don’t know much more about the subject, it’s in Nicolas’ hands. Also, yes your copy-paste of the “texted” link in the address bar rather than clicking on it would work too.
1 user thanked author for this post.
08/22/2021 at 12:14 PM #175908@samsanpop – regarding _PRD DAX Combi strategy:
Removing or commenting out the sellshort function, essentially making it a long only strategy, creates slightly better results. Thanks for sharing!
Remove this://SHORT ENTRY CONDITIONSs1 = (m10[0]–m10[1]) < 0s2 = (m20[0]–m20[1]) < 0s3 = (m50[0]–m50[1]) < 0s4 = (m100[0]–m100[1]) < 0s5 = (m300[0]–m300[1]) < 0s6 = (m800[0]–m800[1]) < 0conditionSellMomentum = s1 AND s2 AND s3 AND NOT s4 AND s5 AND NOT s6// OPEN A SHORT ENTRYIF conditionSellMomentum AND conditionMarketVolatilityM THENPSTOPLOSS = 100PTARGET = PSTOPLOSS * 2SET STOP pLOSS PSTOPLOSSSET TARGET pPROFIT PTARGETSELLSHORT PositionSize CONTRACT AT MARKETP1 = 1ENDIF1 user thanked author for this post.
08/23/2021 at 9:50 AM #17597608/31/2021 at 2:54 PM #176541Hi, Anyone can convert “GBPJPY MINI M15” code itf file in Metatrader 4 file Expert Advisor?
GBPJPY MINI M15123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107Defparam cumulateorders = false// TAILLE DES POSITIONSn = 1// PARAMETRES// high ratio = few positions// AUD/JPY : ratio = 0.5 / SL = 0.8 / TP = 1.2 / Period = 12// EUR/JPY : ratio = 0.6 / SL = 1 / TP = 0.8 / Period = 8// GBP/JPY : ratio = 0.5 / SL = 0.6 / TP = 1 / Period = 8// USD/JPY : ratio = 0.5 / SL = 1 / TP = 0.8 / Period = 12ratio = 0.6period = 8// HORAIRESstartTime = 210000endTime = 231500exitLongTime = 210000exitShortTime = 80000// BOUGIE REFERENCE à StartTimeif time = startTime THENamplitude = highest[Period](high) - lowest[Period](low)ouverture = closeendif// LONGS & SHORTS : every day except Fridays// entre StartTime et EndTimeif time >= startTime and time <= endTime and dayOfWeek <> 5 thenbuy n shares at ouverture - amplitude*ratio limitsellshort n shares at ouverture + amplitude*ratio limitendif// Stop Loss & Take Profit// Stop e targetSET STOP PLOSS 25SET TARGET PPROFIT 13 //395////trailing stop function//************************************************************************// trailing stop functiontrailingstart = 19 //10 trailing will start @trailinstart points profittrailingstep = 24 //5 trailing step to move the "stoploss"////reset the stoploss valueIF NOT ONMARKET THENnewSL=0ENDIF//manage long positionsIF LONGONMARKET THEN//first move (breakeven)IF newSL=0 AND HIGH-tradeprice(1)>=trailingstart*pipsize THEN //close --> HIGHnewSL = tradeprice(1)+trailingstep*pipsize// new codingIF newSL > close THEN //if current closing price is < new SL then exit IMMEDIATELY!SELL AT newSL LIMITENDIF// end new codingENDIF//next movesIF newSL>0 AND close-newSL>=trailingstep*pipsize THENnewSL = newSL+trailingstep*pipsize// new codingIF newSL > close THEN //if current closing price is < new SL then exit IMMEDIATELY!SELL AT newSL LIMITENDIF// end new codingENDIFENDIF//manage short positionsIF SHORTONMARKET THEN//first move (breakeven)IF newSL=0 AND tradeprice(1)-LOW>=trailingstart*pipsize THEN //close --> LOWnewSL = tradeprice(1)-trailingstep*pipsize// new codingIF newSL < close THEN //if current closing price is > new SL then exit IMMEDIATELY!EXITSHORT AT newSL LIMITENDIF// end new codingENDIF//next movesIF newSL>0 AND newSL-close>=trailingstep*pipsize THENnewSL = newSL-trailingstep*pipsize// new codingIF newSL < close THEN //if current closing price is > new SL then exit IMMEDIATELYEXITSHORT AT MARKETENDIF// end new codingENDIFENDIF//stop order to exit the positionsIF newSL>0 THENSELL AT newSL STOPEXITSHORT AT MARKETENDIF// Exit Timeif time = exitLongTime thensell at marketendifif time = exitShortTime thenexitshort at marketendif -
AuthorPosts
Find exclusive trading pro-tools on