Smoothed Bollinger% Strategy Daily_Topic
Forums › ProRealTime English forum › ProOrder support › Smoothed Bollinger% Strategy Daily_Topic
- This topic has 91 replies, 15 voices, and was last updated 3 years ago by robertogozzi.
-
-
01/28/2018 at 6:49 PM #6075201/29/2018 at 3:48 PM #60864
Hi and thanks for this strategy ALE. Nice and solid foundation to keep working from and adapt to more markets etc.
Just a though regarding the minstop, correct me if wrong. I guess the variable minstop is supposed to be set in pips, but there is no pointsize multiplier in the row “if MAXPRICE–tradeprice(1)>=MINSTOP then“. Makes no difference in the indexes since pipsize is 1, but if used on currency pairs this might distort the results. I see that in the posted eurusd version of the strategy this error has not been detected, so the if condition above is never true, which makes the trailing stop consistently being set to minimum according to row “PREZZOUSCITA = MAXPRICE – MINSTOP*pointsize“.
Above comment applies to short as well as long part of the trailing stop.
Best Regards, Tedvin
1 user thanked author for this post.
01/30/2018 at 12:56 PM #6096101/30/2018 at 1:12 PM #6096601/30/2018 at 10:39 PM #6102701/31/2018 at 6:39 PM #6113102/01/2018 at 9:18 PM #61236Hello
I´ve been testing this code on some different fx pairs and some other markets and have gotten some amazing results. Is this code really legit? I see that many of the trades are closed within the first bar (0 bar). But tested with t-b-t this shouldn´t be a problem.
Can´t see anything that looks non legit except for the result… What do you think?
You can see some of my backtest down below. I´ve optimized on the latest 5-10 years and the rest is OOS.
02/02/2018 at 12:28 AM #6124402/02/2018 at 9:50 AM #6125002/02/2018 at 10:43 AM #61254Sorry for dubbel posting but here´s the code for aud/Usd for example. Optimized from 2010-07-20 to 2018-02-01 (see the line in the picture). 1988-2010 is all oss.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105DEFPARAM CumulateOrders = FALSEONCE avgEnterEnabled = 2 //Moving Average Entry Filter - 0 OFF, 1 ONONCE trailingStopType = 1 // Trailing Stop - 0 OFF, 1 ONONCE takeprofit = 1.2 // Take Profit %ONCE stoploss = 0.9 // Stop Loss %ONCE trailingstoplong = 23 // Trailing Stop Atr Relative DistanceONCE trailingstopshort = 9 // Trailing Stop Atr Relative DistanceONCE barlong = 1 // Exit Time LongONCE barshort = 3 // Exit Time ShortONCE atrtrailingperiod = 380 // Atr parameter ValueONCE minstop = 3 // Minimum Trailing Stop Distance// MOVING AVERAGE - ParameterONCE avgLongPeriod = 200 // 100// Smoothed Bollinger %b indicator - ParametersONCE period = 3ONCE TeAv = 1ONCE SveEnterLongThreshold = 35ONCE SveEnterShortThreshold = 65// TRAILINGSTOP//----------------------------------------------atrtrail = AverageTrueRange[atrtrailingperiod]((close/10)*pipsize)trailingstartl = round(atrtrail*trailingstoplong)trailingstartS = round(atrtrail*trailingstopshort)if trailingStopType = 1 THENTGL =trailingstartlTGS=trailingstartsif not onmarket thenMAXPRICE = 0MINPRICE = closePREZZOUSCITA = 0ENDIFif longonmarket thenMAXPRICE = MAX(MAXPRICE,close)if MAXPRICE-tradeprice(1)>=TGL*pointsize thenif MAXPRICE-tradeprice(1)>=MINSTOP thenPREZZOUSCITA = MAXPRICE-TGL*pointsizeELSEPREZZOUSCITA = MAXPRICE - MINSTOP*pointsizeENDIFENDIFENDIFif shortonmarket thenMINPRICE = MIN(MINPRICE,close)if tradeprice(1)-MINPRICE>=TGS*pointsize thenif tradeprice(1)-MINPRICE>=MINSTOP thenPREZZOUSCITA = MINPRICE+TGS*pointsizeELSEPREZZOUSCITA = MINPRICE + MINSTOP*pointsizeENDIFENDIFENDIFif onmarket and PREZZOUSCITA>0 thenEXITSHORT AT PREZZOUSCITA STOPSELL AT PREZZOUSCITA STOPENDIFENDIF//--------------------------------------------------------------------------------------------------// FILTER SETTINGS//--------------------------------------------------------------------------------------------------//MOVING AVERAGElongAvg = Average[avgLongPeriod] (close)avgFilterEnterLong = (close>longAvg OR NOT avgEnterEnabled)avgFilterEnterShort = (close<longAvg OR NOT avgEnterEnabled)//Smoothed Bollinger %b indicatorhaOpen = ((Open[1]+High[1]+Low[1]+Close[1])/4 + (Open[2]+High[2]+Low[2]+Close[2]))/2haC = ((Open+High+Low+Close)/4 + haOpen + Max(high,haOpen) + Min(low,haOpen)) /4TMA1 = tema[TeAv](haC)TMA2 = tema[TeAv](TMA1)Diff = TMA1-TMA2ZlHA = TMA1+Diffpercb = (tema[TeAv](ZLHA)+2*STD[period](tema[TeAv](ZLHA))-weightedaverage[period](tema[TeAv](ZLHA))) / (4*STD[period](tema[TeAv](ZLHA)))*100SveFilterEnterLong = (percb < SveEnterLongThreshold )SveFilterEnterShort = (percb > SveEnterShortThreshold )// STRATEGY//--------------------------------------------------------------------------------------------------IF NOT LongOnMarket AND avgFilterEnterLong AND SvEFilterEnterLong THENBUY 1 CONTRACT AT MARKETENDIFIF NOT ShortOnMarket AND avgFilterEnterShort AND SveFilterEnterShort THENSELLSHORT 1 CONTRACT AT MARKETENDIFIF POSITIONPERF<0 THENIF LongOnMarket AND BARINDEX-TRADEINDEX(1)>= barLong THENSELL AT MARKETENDIFENDIFIF POSITIONPERF<0 THENIF shortOnMarket AND BARINDEX-TRADEINDEX(1)>= barshort THENEXITSHORT AT MARKETENDIFENDIFSET STOP %LOSS stoplossSET TARGET %PROFIT Takeprofit///GRAPH TGL02/02/2018 at 8:53 PM #6130402/02/2018 at 9:41 PM #6130602/03/2018 at 7:24 PM #61369Thanks Alberto and Nicolas.
The only problem I´ve noticed so far is that the code dosen´t seem to like to have a open position over the weekend. As you can see in the picture below the code is turning it self off.
Does anyone have an idea of what the problem could be?
Cheers
02/03/2018 at 9:14 PM #6137202/04/2018 at 10:44 AM #61401 -
AuthorPosts
Find exclusive trading pro-tools on