NASDAQ Mean Reversion
Forums › ProRealTime English forum › ProOrder support › NASDAQ Mean Reversion
- This topic has 37 replies, 14 voices, and was last updated 2 years ago by MauroPro.
-
-
04/08/2022 at 8:19 PM #191461
At the bottom of my code, I added this line
123if longonmarket and close>positionprice and RSI[14](close)crosses under 70 and barindex-tradeindex>30 and opentime<130000 and close[1]-open[1]>20 thensell at marketENDIF4 users thanked author for this post.
04/08/2022 at 10:45 PM #19146404/10/2022 at 8:11 PM #191539I modified the code for long entry and the difference between the two versions is high-high[1]>5
1234567MM=average[30]//and high-high[1]>5cndLong= OPEN>MM and dopen(0)<close and high-close>1 and high-close<20 and low[1]<close// Conditions to enter long positionsIf close > lowest[Pbars](low) and c1 and opendayofweek <> 5 and F1 and cndLong thenBuy PositionSize CONTRACTS AT MARKETENDIF1 user thanked author for this post.
04/10/2022 at 8:30 PM #191542or this version
1234567MM=average[30]//cndLong= OPEN>MM and dopen(0)<close and high-close>1 and high-close<20 and low[1]<close and high-high[1]>5 and not(open<low[1])// Conditions to enter long positionsIf close > lowest[Pbars](low) and c1 and opendayofweek <> 5 and F1 and cndLong thenBuy PositionSize CONTRACTS AT MARKETENDIF3 users thanked author for this post.
04/21/2022 at 7:06 PM #192039Hi
What is the smallest pos size to run https://www.prorealcode.com/wp-content/uploads/2021/08/TEST-KD_MeanReverting-v1.3.itf?
04/22/2022 at 7:01 AM #192050Hi Robert841 – Depending on the index, and whether it’s CFD or Spreadbet, it’s 0.2 or 0.5. Once you’ve run it in demo for a bit and are happy then you can try it on a small size.
04/29/2022 at 7:43 AM #192386Hi, this is one of my revised and simplified versions (v5) with the addition of Fifi improvement.
KD v5123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596//TS KD Mean Reverting v5 - Nasdaq 15 min// spread 2 pointsDEFPARAM CUMULATEORDERS = FALSEpositionSize = 1//--------------------------------------------------------avgHull = average[150,7]nBarsVolume = 15average30 = average[30](close)//--------------------------------------------------------c1L = close > avgHullc2L = volume < volume[nBarsVolume]c3L = open > average30 and dOpen(0)< close and high - close > 1 and high - close < 20 and low[1] < close // [Fifi improvement "cndLong": rif. 191539]//--------------------------------------------------------If c1L and c2L and c3L and nLoss < nLossMax and openDayOfWeek <> 5 thenbuy positionSize contracts at marketendif//-------------------------------------------------------------------------------------set target pProfit 220set stop pLoss 100//-------------------------------------------------------------------------------once nLoss = 0nLossMax = 2 //max N daily lossesif intradayBarIndex = 0 thennLoss=0endifif strategyProfit < strategyProfit[1] thennLoss=nLoss +1endif//------------------------------------------------------------------------EZT = 1 //EZT (exit zombie trades - Nonetheless)if EZT thenif longOnMarket and (barIndex-tradeIndex(1)>= 1600 and positionPerf<0) thensell at marketendifendif//-----------------------------------------------------EWT = 1 //(exit winning trades - MauroPro)nCandles = 8percentTP = 1.8endTime = 080000if EWT thenif longOnMarket and (barIndex-tradeIndex(1)>nCandles and positionPerf*100 > percentTP) and (time>000000 and time<endTime) thensell at marketendifendif//------------------------------------------------------------------myRsi = rsi[14](close) //RSI exitif myRsi < 30 and longOnMarket and close > positionPrice thensell at marketendif//----if longOnMarket and close>positionPrice and RSI[14](close)>70 and close-open>100 then //added by Fifisell at marketENDIF//-------------------------------------------------------------------------------------------pointToReachLong = 38*pointSize // 30pointToKeepLong = 12*pointSizeIf not onMarket thennewSL = 0endifIf longOnMarket thenIf newSL = 0 and high-tradePrice(1)>pointToReachLong thennewSL = tradePrice(1)+ pointToKeepLongendifIf newSL > 0 and close-newSL>pointToReachLong thennewSL = newSL+pointToKeepLongendifendifIf newSL > 0 thensell at newSL STOPendif//-----------------------------------------------------------------------------------------------------once bollPeriod = 20 // bollPercent Exitonce multiplier = 2avgBoll = average[bollperiod,1](close)stDevBoll = std[bollperiod]bollUp = avgBoll + multiplier * stDevBollbollDown = avgBoll - multiplier * stDevBollbollPercent = 100 * (close - bollDown) / (bollUp - bollDown)//-----------------------------------------------------------------------------once rangeOk = 40once timeOk = 0if time <= 090000 or time >= 210000 and (high - low) > rangeOk thentimeOk = 0endifIF time >= 080000 and time <= 200000 and (high - low) > rangeOk thentimeOk = 1endifperiod = 4 // exit with 2 of the last 4 bars below the threshold of 40 bollPerCentlevelPercent = 40candleNum = 2if timeOk = 1 and (barIndex - tradeIndex) < 12 and summation[period](bollPercent < levelPercent) = candleNum thensell at marketendif//------------------------------------------------------------------------------------------------------------2 users thanked author for this post.
04/29/2022 at 7:44 AM #1923873 users thanked author for this post.
-
AuthorPosts