Since I get many positive returns about the ALMA VHF Hi/Lo Bands posted previously, I decided to add the “step” function to it. The version below adds a filtering made with ATR such as a SuperTrend-like indicator.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
//PRC_StepALMA-VHF Hi/Lo band | indicator //15.11.2018 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge // --- settings Window = 7 Sigma = 3 VHFp = 21 Sensitivity = 2 // Sensivity Factor StepSize = 14 // Step Size period // --- end of settings hh = CALL "PRC_ALMA VHF filter"[window, sigma, VHFp](high) ll = CALL "PRC_ALMA VHF filter"[window, sigma, VHFp](low) if hh<hh[1] and low<ll then trend=-1 elsif ll>ll[1] and high>hh then trend=1 endif if trend=1 then iline=ll else iline=hh endif //step function Sensitivity = max(Sensitivity,1*pointsize) ATRStepSize=averagetruerange[StepSize] Step = max(ATRStepSize,1*pointsize) size = sensitivity*Step phigh = highest[7](iline) plow = lowest[7](iline) stepMulti = 1.0 workStepsmax = phigh+2.0*size*stepMulti workStepsmin = plow-2.0*size*stepMulti workSteptrend = workSteptrend[1] pprice = customclose if (pprice>workStepsmax[1]) then workSteptrend = 1 endif if (pprice<workStepsmin[1]) then workSteptrend = -1 endif if (workSteptrend = 1) then if (workStepsmin < workStepsmin[1]) then workStepsmin=workStepsmin[1] endif result = workStepsmin+size*stepMulti r=0 g=255 b=0 endif if (workSteptrend = -1) then if (workStepsmax > workStepsmax[1]) then workStepsmax=workStepsmax[1] endif result = workStepsmax-size*stepMulti r=255 g=0 b=0 endif return result coloured(r,g,b) style(line,3) as "Step ALMA VHF Filter Hi/Lo band" |
This code is needed for the above one to work properly:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
//PRC_ALMA VHF filter | indicator //11.11.2018 //Nicolas @ www.prorealcode.com //Sharing ProRealTime knowledge // --- settings Window = 7 Sigma = 3 VHFp = 21 // --- end of settings Price = customClose //VHF Length=VHFp CloseDiff = 0 SumDiff = 0 Serie = Price For Counter = 0 to Length - 1 do CloseDiff = Abs(serie[Counter] - serie[Counter + 1]) SumDiff = SumDiff + CloseDiff next If SumDiff = 0 Then SumDiff = 1 endif VHF = (Highest[Length](serie) - Lowest[Length](serie)) / SumDiff // Offset = max(0.01,1- VHF) m = (Offset * (Window - 1)) s = Window/Sigma WtdSum = 0 CumWt = 0 for k = 0 to Window - 1 do Wtd = Exp(-((k-m)*(k-m))/(2*s*s)) WtdSum = WtdSum + Wtd * Price[Window - 1 - k] CumWt = CumWt + Wtd next ALAverage = WtdSum / CumWt RETURN ALAverage |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Congratulations Nicolas,
What should I do for the 2 files I have to add them both in the graph or just add “prc_stepalma-vhf-hilo-band.itf” and the other file “prc_alma-vhf-filter.itf” simply keep it in the Library?
Only the “//PRC_StepALMA-VHF Hi/Lo band” is required, it uses the second code automatically. Be sure to have them both in your platform indicators list.
Thank you Nicolas, great indicator, N. 1
Merci Nicolas! First Happy new Year 2020.
Very good indicator BUT (yes the french “oui, mais”) the prorealtime is dramatically slow when I add this indicator even if I display only 200 Units in PRT.
I suppose that the CALL of the “prc_alma-vhf-filter” indicator is slowing everything.
What can I do to avoid this problem?
Thank you.
Whats prorealtime version? Did you try in version prior to v11?
indicator’s call and loop can indeed have this effect, I think that a “defparam calculateonlastbars=1000” at the top of the code could limit the loading time.