NAS 3 x HULL MA trading system
Forums › ProRealTime English forum › ProOrder support › NAS 3 x HULL MA trading system
- This topic has 18 replies, 7 voices, and was last updated 3 years ago by boonet.
-
-
09/22/2020 at 12:33 AM #144929
Being always ON MARKET the MM part will never run as it is now, but you can replace IF NOT ON MARKET THEN with:
1IF StrategyProfit <> StrategyProfit[1] THENbecause each time a trade is closed (no matter whether a new one is started at the same time), STRATEGYPROFIT is updated, so it will be different than it was the previous candle.
Another solution would be replacing IF NOT ONMARKET THEN with:
1IF (LongOnmarket AND ShortOnMarket[1]) OR (LongOnmarket[1] AND ShortOnMarket)which checks whenever a different positions has been entered (and the previous one closed).
I prefer the first solution.
This way you will be able to execute the MM part to manage the position size.
3 users thanked author for this post.
09/22/2020 at 12:48 AM #144932Anyone can run this on 200k?
DJI-1m
Could be too curve fitted, but interesting to see how it goes. Thanks in advance.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174Defparam CumulateOrders = falseTIMEFRAME(5 minutes, updateonclose)mac = MACD[8,6,4]bull5 = mac > 0bear5 = mac < 0TIMEFRAME(2 minutes, updateonclose)bull2 = Average[5] > Average[13]bear2 = Average[5] < Average[13]TIMEFRAME(default)Period= 7inner = 2*weightedaverage[round( Period/2)](typicalprice)-weightedaverage[Period](typicalprice)HULLa = weightedaverage[round(sqrt(Period))](inner)Periodb= 42innerb = 2*weightedaverage[round( Periodb/2)](typicalprice)-weightedaverage[Periodb](typicalprice)HULLb = weightedaverage[round(sqrt(Periodb))](innerb)Periodc= 17innerc = 2*weightedaverage[round( Periodc/2)](typicalprice)-weightedaverage[Periodc](typicalprice)HULLc = weightedaverage[round(sqrt(Periodc))](innerc)c1 = HULLb > HULLac2 = HULLb < HULLac3 = HULLb > HULLb[1]and HULLb[1]<HULLb[2]c4 = HULLb < HULLb[1]and HULLb[1]>HULLb[2]c5 = HULLc > HULLc[1]c6 = HULLc < HULLc[1]bull = c1 and c3 and c5 and bull5 and bull2bear = c2 and c4 and c6 and bear5 and bear2//Timeframe(default)//Once BB = 20//Once p = 54//MaxbbUP = highest[p](BollingerUp[BB](close)) and bull//MinbbDN = lowest[p](BollingerDown[BB](close)) and bear//MyAdx = (summation[p](Adx[14] < 25) = p)//If MyAdx then//Buy 1 contract at MaxbbUP Stop//Sellshort 1 contract at MinbbDN Stop//Endif//// Conditions to enter long positionsIF NOT LongOnMarket AND bull THENBUY 1 CONTRACTS AT MARKETENDIF////// Conditions to exit long positions//If LongOnMarket AND YourConditions THEN//SELL AT MARKET//ENDIF////// Conditions to enter short positionsIF NOT ShortOnMarket AND bear THENSELLSHORT 1 CONTRACTS AT MARKETENDIF////// Conditions to exit short positions//IF ShortOnMarket AND YourConditions THEN//EXITSHORT AT MARKET//ENDIF// Stops and targets : Enter your protection stops and profit targets here//SET STOP %LOSS 1SET STOP pLoss 300//SET TARGET pProfit 100// trailing atr stoponce trailingstoptype = 1 // trailing stop - 0 off, 1 ononce tsincrements = .03//.05 // set to 0 to ignore tsincrementsonce tsminatrdist = 1//3once tsatrperiod = 14 // ts atr parameteronce tsminstop = 12 // ts minimum stop distanceonce tssensitivity = 1 // [0]close;[1]high/lowif trailingstoptype thenif barindex=tradeindex thentrailingstoplong = 2 // ts atr distancetrailingstopshort = 2 // ts atr distanceelseif longonmarket thenif tsnewsl>0 thenif trailingstoplong>tsminatrdist thenif tsnewsl>tsnewsl[1] thentrailingstoplong=trailingstoplongelsetrailingstoplong=trailingstoplong-tsincrementsendifelsetrailingstoplong=tsminatrdistendifendifendifif shortonmarket thenif tsnewsl>0 thenif trailingstopshort>tsminatrdist thenif tsnewsl<tsnewsl[1] thentrailingstopshort=trailingstopshortelsetrailingstopshort=trailingstopshort-tsincrementsendifelsetrailingstopshort=tsminatrdistendifendifendifendiftsatr=averagetruerange[tsatrperiod]((close/10)*pipsize)/1000//tsatr=averagetruerange[tsatrperiod]((close/1)*pipsize) // (forex)tgl=round(tsatr*trailingstoplong)tgs=round(tsatr*trailingstopshort)if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thentsmaxprice=0tsminprice=closetsnewsl=0endifif tssensitivity thentssensitivitylong=hightssensitivityshort=lowelsetssensitivitylong=closetssensitivityshort=closeendifif longonmarket thentsmaxprice=max(tsmaxprice,tssensitivitylong)if tsmaxprice-tradeprice(1)>=tgl*pointsize thenif tsmaxprice-tradeprice(1)>=tsminstop thentsnewsl=tsmaxprice-tgl*pointsizeelsetsnewsl=tsmaxprice-tsminstop*pointsizeendifendifendifif shortonmarket thentsminprice=min(tsminprice,tssensitivityshort)if tradeprice(1)-tsminprice>=tgs*pointsize thenif tradeprice(1)-tsminprice>=tsminstop thentsnewsl=tsminprice+tgs*pointsizeelsetsnewsl=tsminprice+tsminstop*pointsizeendifendifendifif longonmarket thenif tsnewsl>0 thensell at tsnewsl stopendifif tsnewsl>0 thenif low crosses under tsnewsl thensell at market // when stop is rejectedendifendifendifif shortonmarket thenif tsnewsl>0 thenexitshort at tsnewsl stopendifif tsnewsl>0 thenif high crosses over tsnewsl thenexitshort at market // when stop is rejectedendifendifendifendif1 user thanked author for this post.
09/22/2020 at 8:42 AM #14494509/22/2020 at 8:54 AM #144953Thanks @Nicolas.
I thought so 🙂
Anyone have any inputs how it can be improved further?
Prolly optimization expert @nonetheless ? -
AuthorPosts
Find exclusive trading pro-tools on