Simple Momentum Strategy
Forums › ProRealTime English forum › ProOrder support › Simple Momentum Strategy
- This topic has 4 replies, 2 voices, and was last updated 4 years ago by
JS.
-
-
09/29/2021 at 10:59 AM #178699
Go With The Momentum
Hi,
Here’s a nice simply strategy which uses price action as the entry criteria, and two filters to keep it out of major downturns as it is currently a long only strategy. Short side to be worked on next.
Works well on both 5 and 15 mins on the NASDAQ. My preference is higher timeframes, so will look to develop that side further.
Feedback and any suggested enhancements around the trailing stop most welcome. The Sunday trading is something I am investigating further to see why it is negative. Anyway, work in progress, I hope you enjoy.
Thanks,
S
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132//==========================================================================================================// Code: TEST Go with the Momentum// Version 1// Index: NASDAQ// TF: 5 min// TZ: EU// Spread: 3// Notes: v1.1 Core strategy, Long only// v1.2 Tested Trailing stops// v1.3 Added $ Loss limit// v1.4 Tested a 4th Close High criteria - poor performance// v1.5 Added Momentum (optimised) Long Entry Filter// v1.6 Added Moving Averages (optimised) Long Entry Filter// v1.7 Day of week code to reduce drawdown//// Testing on both 5 mins and 15 mins for NADSDAQ//==========================================================================================================PxMomentum = Momentum>21PositionSize = 1slp = 140// * PositionSize//=== Entry Filter ===//Filter 1Timeframe (60 minutes)indicator11=average[100,8]indicator21=average[110,8]F1 = indicator11>indicator21Timeframe (Default)UpTrend = Close > Close[1] AND Close[1] > Close[2] AND Close[2] > Close[3]// Conditions to enter positionsIF NOT LongOnMarket AND UpTrend AND PxMomentum AND opendayofweek <> 2 AND F1 THENBUY PositionSize CONTRACTS AT MARKETENDIF//graph UpTrend//===== Exit Methodology =====myrsiM5=rsi[14](close)//if myrsiM5<30 and barindex-tradeindex>1 and longonmarket and close>positionprice thensell at marketendifif myrsiM5>70 and barindex-tradeindex>1 and shortonmarket and close<positionprice thenexitshort at marketendif//===================================DSD = 0if DSD thenonce openStrongLong = 0once openStrongShort = 0if (time <= 080000 or time >= 210000) thenopenStrongLong = 0openStrongShort = 0endif//detect strong direction for market openonce rangeOK = 30once tradeMin = 2500IF (time >= 080500) AND (time <= 080500 + tradeMin) AND ABS(close - open) > rangeOK THENIF close > open and close > open[1] THENopenStrongLong = 1openStrongShort = 0ENDIFIF close < open and close < open[1] THENopenStrongLong = 0openStrongShort = 1ENDIFENDIFonce bollperiod = 20once bollMAType = 1once s = 2bollMA = average[bollperiod, bollMAType](close)STDDEV = STD[bollperiod]bollUP = bollMA + s * STDDEVbollDOWN = bollMA - s * STDDEVIF bollUP = bollDOWN THENbollPercent = 50ELSEbollPercent = 100 * (close - bollDOWN) / (bollUP - bollDOWN)ENDIFonce trendPeriod = 80once trendPeriodResume = 10once trendGap = 4once trendResumeGap = 4if not onmarket thenfullySupported = 0fullyResisteded = 0endif//Market supported in the wrong directionIF shortonmarket AND fullySupported = 0 AND summation[trendPeriod](bollPercent > 50) >= trendPeriod - trendGap THENfullySupported = 1ENDIF//Market pull back but continue to be supportedIF shortonmarket AND fullySupported = 1 AND bollPercent[trendPeriodResume + 1] < 0 AND summation[trendPeriodResume](bollPercent > 50) >= trendPeriodResume - trendResumeGap THENexitshort at marketENDIF//Market resisted in wrong directionIF longonmarket AND fullyResisteded = 0 AND summation[trendPeriod](bollPercent < 50) >= trendPeriod - trendGap THENfullyResisteded = 1ENDIF//Market pull back but continue to be resistedIF longonmarket AND fullyResisteded = 1 AND bollPercent[trendPeriodResume + 1] > 100 AND summation[trendPeriodResume](bollPercent < 50) >= trendPeriodResume - trendResumeGap THENsell at marketENDIF//Started real wrong directiononce strongTrend = 60once strongPeriod = 4once strongTrendGap = 2IF shortonmarket and openStrongLong and barindex - tradeindex < 12 and summation[strongPeriod](bollPercent > strongTrend) = strongPeriod - strongTrendGap thenexitshort at marketENDIFIF longonmarket and openStrongShort and barindex - tradeindex < 12 and summation[strongPeriod](bollPercent < 100 - strongTrend) = strongPeriod - strongTrendGap thensell at marketENDIFendif//==== Stop Loss ====Set Stop $Loss slp5 users thanked author for this post.
09/29/2021 at 1:03 PM #178710With Dashboard
1 user thanked author for this post.
09/29/2021 at 1:13 PM #178712Quick updated to line 33 in the code;
1UpTrend = Close > Close[1] AND Close[1] > Close[2] AND Close[2] > Close[3] AND Close [4] > Close [5]09/29/2021 at 1:14 PM #178713With file
09/29/2021 at 10:27 PM #178751 -
AuthorPosts
Find exclusive trading pro-tools on