Optimising the Period on a Standard Deviation Indicator
Forums › ProRealTime English forum › ProOrder support › Optimising the Period on a Standard Deviation Indicator
- This topic has 3 replies, 2 voices, and was last updated 6 years ago by
Bard.
-
-
03/23/2019 at 4:13 PM #94500
I have an Average Filter Regression indicator (using #43 “Reference Fast Trend Line” from the list of 66 filters) that is part of the rules for entry of an auto system I’m testing. The price must cross over the 30 period filter for a buy/sell signal.
https://www.prorealcode.com/prorealtime-indicators/average-filter-regression/
When I optimised the period (30) and changed it to “a” and added it as a variable I get the same results? (Pls see screenshot).
This reminds me of the initial problems optimising the Kase Dev Stop but for the life of me I can’t figure out what the reason is in this case.
For example if I optimise the period for the std deviation indicator (also a condition of entry, in that the std dev must be > the 30 period exponential mov average applied to the std dev indicator), there is no problem and lots of different profits produced.1indicator1 = CALL "Average Filter Regression"[43, a](close)Any ideas what I’m doing wrong? (I always assume “user error” with PRT because it’s far more versatile than I am!)
03/24/2019 at 8:31 AM #9452803/24/2019 at 10:03 AM #94542You shared the code in a screen shot, if you post the .itf file also then I would run it on my Platform to see if I replicate your Issue and maybe spot a reason / fix?
And / or post the code on the screen (to enable copy, paste, run ) then others may spot the Issue by checking the code (easier than a screen shot of the code)?
1 user thanked author for this post.
03/25/2019 at 4:41 PM #94679Cheers @GraHal, Here it is:
Ave Filt Reg-43 Fast Trend OPT12345678910111213141516171819202122232425262728293031323334353637383940// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsindicator1 = CALL "Average Filter Regression"[43, a](close)c1 = (close CROSSES OVER indicator1)indicator2 = 25*BollingerBandWidth[21](close)indicator3 = CALL "Average Filter Regression"[9, 30](25*BollingerBandWidth[21](close))c2 = (indicator2 > indicator3)IF c1 AND c2 THENBUY 10 PERPOINT AT MARKETENDIF// Conditions to exit long positionsignored, indicator4, ignored, ignored, ignored, ignored = CALL "Kase Dev Stop Lisse+SAR+4.5/6"c3 = (close CROSSES UNDER indicator4)IF c3 THENSELL AT MARKETENDIF// Conditions to enter short positionsindicator5 = CALL "Average Filter Regression"[43, a](close)c4 = (close CROSSES UNDER indicator5)indicator6 = 25*BollingerBandWidth[21](close)indicator7 = CALL "Average Filter Regression"[9, 30](25*BollingerBandWidth[21](close))c5 = (indicator6 > indicator7)IF c4 AND c5 THENSELLSHORT 10 PERPOINT AT MARKETENDIF// Conditions to exit short positionsignored, indicator8, ignored, ignored, ignored, ignored = CALL "Kase Dev Stop Lisse+SAR+4.5/6"c6 = (close CROSSES OVER indicator8)IF c6 THENEXITSHORT AT MARKETENDIFKase Dev Stop123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113//Voici le code en version SAR : plus WITH DEV STOP 4.5 + 6.0//Settingsn=30p1=1.0p2=2.2p3=3.6p4=4.5p5=6.0difference=0Hg=highest[2](high)Lw=lowest[2](low)DTR=max(max(Hg-Lw,abs(Hg-close[2])),abs(Lw-close[2]))aDTR=average[n](DTR)for i=0 to n-1 dodifference=difference+square(DTR[i]-aDTR)nextdifference=difference/nsdev=sqrt(difference)dev0=close-aDTRdev1=close-aDTR-p1*sdevdev2=close-aDTR-p2*sdevdev3=close-aDTR-p3*sdevdev4=close-aDTR-p4*sdevdev5=close-aDTR-p5*sdevif dev0<dev0[1] and close>dev5[1] thendev0=dev0[1]endifif dev1<dev1[1] and close>dev5[1] thendev1=dev1[1]endifif dev2<dev2[1] and close>dev5[1] thendev2=dev2[1]endifif dev3<dev3[1] and close>dev5[1] thendev3=dev3[1]endifif dev4<dev4[1] and close>dev5[1] thendev4=dev4[1]endifif dev5<dev5[1] and close>dev5[1] thendev5=dev5[1]endifdev6=close+aDTRdev7=close+aDTR+p1*sdevdev8=close+aDTR+p2*sdevdev9=close+aDTR+p3*sdevdev10=close+aDTR+p4*sdevdev11=close+aDTR+p5*sdevif dev6>dev6[1] and close<dev11[1] thendev6=dev6[1]endifif dev7>dev7[1] and close<dev11[1] thendev7=dev7[1]endifif dev8>dev8[1] and close<dev11[1] thendev8=dev8[1]endifif dev9>dev9[1] and close<dev11[1] thendev9=dev9[1]endifif dev10>dev10[1] and close<dev11[1] thendev10=dev10[1]endifif dev11>dev11[1] and close<dev11[1] thendev11=dev11[1]endifif close>dev11[1] thenflag=-1elseif close<dev5[1] thenflag=1endifendifif flag=-1 thenind0=dev0ind1=dev1ind2=dev2ind3=dev3ind4=dev4ind5=dev5//k=1 Bluer=0g=191b=255elseind0=dev6ind1=dev7ind2=dev8ind3=dev9ind4=dev10ind5=dev11//k=-1 Oranger=255g=128b=0endif//ORIG return ind0 COLOURED BY k,ind1 coloured by k,ind2 coloured by k,ind3 coloured by k////ORANGE AND LIGHT BLUEreturn ind0 coloured(r,g,b) style(dottedline,2) as "Warning Line", ind1 coloured(r,g,b) style(dottedline,2) as "Dev Stop 1.0", ind2 coloured(r,g,b) style(dottedline,2) as "Dev Stop 2.2", ind3 coloured(r,g,b) style(line,2) as "Dev Stop 3.6", ind4 coloured(r,g,b) style(dottedline,2) as "Dev Stop 4.5", ind5 coloured(r,g,b) style(line,2) as "Dev Stop 6.0"//NO CHANGE OF COLOUR FOR TREND CHANGE return ind0 coloured(2, 118, 253) style(dottedline,2) as "Warning Line" ,ind1 coloured(2, 118, 253) style(dottedline,2) as "Dev Stop 1.0", ind2 coloured(2, 118, 253) style(dottedline,2) as "Dev Stop 2.2", ind3 coloured(2, 118, 253) style(line,2) as "Dev Stop 3.6", ind4 coloured(2, 118, 253) style(dottedline,2) as "Dev Stop 4.5", ind5 coloured(2, 118, 253) style(line,2) as "Dev Stop 6.0"I was using filter #43 from here: https://www.prorealcode.com/prorealtime-indicators/average-filter-regression/
for first part of the Buy signal rules. The other part is the std deviation condition:
Indicator 2 is a 21 period Std Dev indicator. Buy signal if the std dev is > than a 30 period average (#9 from the list of 66 filters) to avoid flat markets.Ps/ You should check out how the Kase Dev Stop rides some of those trends without stopping you out (regardless of entry type). 👌
-
AuthorPosts
Find exclusive trading pro-tools on