mlv stategy
Forums › ProRealTime English forum › ProOrder support › mlv stategy
- This topic has 3 replies, 1 voice, and was last updated 4 years ago by
Paul.
Viewing 4 posts - 1 through 4 (of 4 total)
-
-
04/16/2020 at 4:43 PM #126427
I have this running on us100 nasdaq 5 min tf. Was a few times about to close it, but let it run. Had the feeling live (demo) did a bit better then what I saw in the (bad) backtest.
So there’s a good 2 months of data. (ignore that it mentions dax).
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252//-------------------------------------------------------------------------// Hoofd code : MLV DAX v3p 24h hull #2//-------------------------------------------------------------------------defparam cumulateorders = falsedefparam preloadbars = 10000TIMEFRAME (default)once enablesl = 1 // stoplossonce enablept = 1 // profit targetonce enablets = 1 // trailing stop atronce displaysl = 0 // stop lossonce displaypt = 0 // profit targetonce displayts = 0 // trailing stop atronce positionweekend = 1 // weekend position then ignore timeonce fridayclosetime = 225500once tds=4// settingsonce positionsize = 1once sl = 0.5once pt = 2.0// generalunderlaying=100// strategyTIMEFRAME (15 minutes,updateonclose)// MID-LEVEL 1ml1 = (High[i] + Low[i]) / 2// MID-LEVEL 2Newhigh = 0For i = 1 to 13 doIF high[i] > Newhigh THENNewhigh = high[i]ENDIFNEXTNewlow = 1000000000000For i = 1 to 13 doIF low[i] < Newlow THENNewlow= low[i]ENDIFNEXTml2 = (Newhigh + Newlow) /2// MID-LEVEL 3Newhigh = 0For i = 1 to 4 doIF high[i] > Newhigh THENNewhigh = high[i]ENDIFNEXTNewlow = 1000000000000For i = 1 to 4 doIF low[i] < Newlow THENNewlow= low[i]ENDIFNEXTTIMEFRAME (default)// trend detection systemif tds=0 thentrendup=1trenddown=1elseif tds=1 then // 1 hourtrendup=(average[7](totalprice)>average[7](totalprice)[1])trenddown=(average[1](totalprice)<average[1](totalprice)[1])elseif tds=2 thentrendup=(Average[20](close)>Average[20](close)[1])trenddown=(Average[35](close)<Average[35](close)[1])elseif tds=3 thenperiod= 14inner = 2*weightedaverage[round( period/2)](typicalprice)-weightedaverage[period](typicalprice)hull = weightedaverage[round(sqrt(period))](inner)trendup = hull > hull[1]trenddown = hull < hull[1]elseif tds=4 thenperiod= 14inner = 2*weightedaverage[round( period/2)](totalprice)-weightedaverage[period](totalprice)hull = weightedaverage[round(sqrt(period))](inner)trendup = hull > hull[1]trenddown = hull < hull[1]endifendifendifendifendif//condbuy = ml1 crosses over ml2condbuy = condbuy and close<close[1] and open<open[1]condbuy = condbuy and trendupcondsell= ml1 crosses under ml2condsell= condsell and close>close[1] and open>open[1]condsell= condsell and trenddown//if condbuy thenbuy positionsize contract at marketendifif condsell thensellshort positionsize contract at marketendif// close position on fridayif positionweekend=0 thenif onmarket thenif currentdayofweek=5 and time>=fridayclosetime thensell at marketexitshort at marketendifendifendif//if enablets then//once steps=0.05 // set to 0 to ignore stepsonce minatrdist=3once atrtrailingperiod = 14 // atr parameteronce minstop = 10 // minimum trailing stop distanceif barindex=tradeindex thentrailingstoplong = 4 // trailing stop atr distancetrailingstopshort = 4 // trailing stop atr distanceelseif longonmarket thenif newsl>0 thenif trailingstoplong>minatrdist thenif newsl>newsl[1] thentrailingstoplong=trailingstoplongelsetrailingstoplong=trailingstoplong-stepsendifelsetrailingstoplong=minatrdistendifendifendifif shortonmarket thenif newsl>0 thenif trailingstopshort>minatrdist thenif newsl<newsl[1] thentrailingstopshort=trailingstopshortelsetrailingstopshort=trailingstopshort-stepsendifelsetrailingstopshort=minatrdistendifendifendifendif//atrtrail=averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000trailingstartl=round(atrtrail*trailingstoplong)trailingstarts=round(atrtrail*trailingstopshort)tgl=trailingstartltgs=trailingstartsif not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) thenmaxprice=0minprice=closenewsl=0endif//if longonmarket thenmaxprice=max(maxprice,close)if maxprice-tradeprice(1)>=tgl*pointsize thenif maxprice-tradeprice(1)>=minstop thennewsl=maxprice-tgl*pointsizeelsenewsl=maxprice-minstop*pointsizeendifendifendif//if shortonmarket thenminprice=min(minprice,close)if tradeprice(1)-minprice>=tgs*pointsize thenif tradeprice(1)-minprice>=minstop thennewsl=minprice+tgs*pointsizeelsenewsl=minprice+minstop*pointsizeendifendifendif//if longonmarket thenif newsl>0 thensell at newsl stopendifendifif shortonmarket thenif newsl>0 thenexitshort at newsl stopendifendif//if displayts then//graphonprice newsl coloured(0,0,255,255) as "trailingstop atr"endifendif// display profittargetif enablept thenif not onmarket thenptarget=0elsif longonmarket thenptarget=tradeprice(1) +((tradeprice(1) *pt)/underlaying)*pointsizeelsif shortonmarket thenptarget=tradeprice(1) -((tradeprice(1) *pt)/underlaying)*pointsizeendifset target %profit ptif displaypt then//graphonprice ptarget coloured(121,141,35,255) as "profittarget"ptarget=ptargetendifendif// set stoplossif enablesl thenif not onmarket thensloss=0elsif longonmarket thensloss=tradeprice(1) -((tradeprice(1) *sl)/underlaying)*pointsizeelsif shortonmarket thensloss=tradeprice(1) +((tradeprice(1) *sl)/underlaying)*pointsizeendifset stop %loss slif displaysl then//graphonprice sloss coloured(255,0,0,255) as "stoploss"sloss=slossendifendif04/16/2020 at 5:07 PM #12643201/17/2021 at 4:49 AM #158101quick look at this old one, on the dow 1m.
Added part of nonetheless setup and changed entry criteria.
Optimised roughly on 200k from july ’20 & compared to 1m and of-course data before 200k is poor with exception the months april-mei-june ’20
results atm are with no trailingstop or breakeven, no overnight/weekend, a relatively small stoploss & a slightly bigger profittarget.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109defparam cumulateorders = falsedefparam preloadbars = 2000defparam flatbefore = 080000once tradetype = 1 // [1]ls [2]l [3]sonce positionsize=1once sll = 0.6 // stoploss longonce sls = 0.6 // stoploss shortonce ptl = sll*1.4 // profittarget longonce pts = sls*1.4 // profittarget short// timectime=openhour<21TIMEFRAME (15 minutes)indicator1 = SuperTrend[2,10]indicator1a = SAR[0.015,0.015,0.02]cnd1 = (close > indicator1) or (close > indicator1a)cnd2 = (close < indicator1) or (close < indicator1a)// MID-LEVEL 1ml1 = (High[i] + Low[i]) / 2// MID-LEVEL 2Newhigh = 0For i = 1 to 2 doIF high[i] > Newhigh THENNewhigh = high[i]ENDIFNEXTNewlow = 1000000000000For i = 1 to 2 doIF low[i] < Newlow THENNewlow= low[i]ENDIFNEXTml2 = (Newhigh + Newlow) /2// MID-LEVEL 3Newhigh = 0For i = 1 to 7 doIF high[i] > Newhigh THENNewhigh = high[i]ENDIFNEXTNewlow = 1000000000000For i = 1 to 5 doIF low[i] < Newlow THENNewlow= low[i]ENDIFNEXTml3 = (Newhigh + Newlow) /2TIMEFRAME (default)max1=max(ml1,ml2)max2=max(max1,ml3)min1=min(ml1,ml2)min2=min(min1,ml3)// conditionscondbuy = ml1 > ml3 and ml1 crosses under ml2condbuy = condbuy or (ml1 > ml2 and ml1 crosses under ml3) and cnd1condbuy = condbuy and (max2-min2)>8condsell= ml1 < ml3 and ml1 crosses over ml2condsell= condsell or (ml1 < ml2 and ml1 crosses over ml3) and cnd2condsell = condsell and (max2-min2)>2// entry criteriaif ctime thenif tradetype=1 thenif not longonmarket and condbuy thenbuy positionsize contract at marketset stop %loss sllset target %profit ptlendifif not shortonmarket and condsell thensellshort positionsize contract at marketset stop %loss slsset target %profit ptsendifelsif tradetype=2 thenif not longonmarket and condbuy thenbuy positionsize contract at marketset stop %loss sllset target %profit ptlendifelsif tradetype=3 thenif not shortonmarket and condsell thensellshort positionsize contract at marketset stop %loss slsset target %profit ptsendifendifendifif dayofweek=5 and time>=215500 thensell at marketexitshort at marketendif1 user thanked author for this post.
03/21/2021 at 3:24 PM #164807 -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
Find exclusive trading pro-tools on
Similar topics: