Distribution of Index indicator bug fix
Forums › ProRealTime English forum › ProBuilder support › Distribution of Index indicator bug fix
- This topic has 8 replies, 4 voices, and was last updated 3 years ago by robertogozzi.
-
-
02/10/2021 at 1:38 PM #160934
When I developed the Distribution of Index indicator that can be found in the library I only had v11 end of day data and it has come to light that on live data it continuously updates the distribution chart tick by tick leading to an incorrect chart being displayed.
I have fixed the bug and suggest that anyone who uses v1.1 updates to v1.2.
ITF file attached.
Distribution of Index v1.2123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103//Distribution of Index v1.2//PRT v11 onwards//By Vonasi//Date: 20210210//p = 14 // Period used in indicator//k = 3 // K% setting for stochastic//d = 9 // Period used for signal line//RSIndex = 1 // Select RSI//Stoch = 0 // Select Stochastic//WilliamsR = 0 // Select Williams%R//ADXindex = 0 // Select ADX//SignalLine = 1 // Turn on/off display of signal line//StartDate = 19950101 // Date to start analysis from. Zero = all dataif date >= startdate thenif islastbarupdate then$lastopen[0]=openendifp = max(1,p)k = max(1,k)d = max(1,d)once signal = undefinedif RSIndex or (not Stoch and not WilliamsR and not ADXindex) thenindicator = rsi[p](close)endifif Stoch thenindicator = stochastic[p,k](close)endifif WilliamsR thenindicator = williams[p](close)+100endifif ADXindex thenindicator = ADX[p]endifif signalline thensignal = average[d](indicator)endifrindicator = round(indicator)if open<>$lastopen[0] thenfor a = 1 to 100if rindicator = a then$perc[a] = $perc[a]+1maxval = max(maxval,$perc[a])breakendifnextendifif islastbarupdate thenfor a = 1 to 100thisperc = round(($perc[a]/maxval)*100)if rindicator = a thendrawpoint(barindex+thisperc+5,a,3) coloured(0,0,255)drawtext("#thisperc#%",barindex+115,a,sansserif,bold,14) coloured(0,0,128)endifr = 255g = 0if thisperc >= 25 thenr = 128g = 0endifif thisperc >= 50 thenr = 0g = 255endifif thisperc >= 75 thenr = 0g = 128endifdrawrectangle(barindex+5,a,barindex+thisperc+5,a) coloured(r,g,128)nextfor a = 1 to 4if ADXindex thendrawtext("ADX #p# = #rindicator#",barindex+5,108,sansserif,bold,14) coloured(0,0,128)breakendifif WilliamsR thendrawtext("Williams%R #p# = #rindicator#",barindex+5,108,sansserif,bold,14) coloured(0,0,128)breakendifif Stoch thendrawtext("Stochastic #p##k##d# = #rindicator#",barindex+5,108,sansserif,bold,14) coloured(0,0,128)breakendifif RSIndex or (not Stoch and not WilliamsR and not ADXindex) thendrawtext("RSI #p# = #rindicator#",barindex+5,108,sansserif,bold,14) coloured(0,0,128)breakendifnextendifendifreturn 0 coloured(0,0,0,0) as "Line",108 coloured(0,0,0,0) as "Line",indicator as "Indicator",signal style(dottedline) as "Signal"1 user thanked author for this post.
04/02/2021 at 2:33 PM #16605204/02/2021 at 4:49 PM #166060I did start coding something that showed distribution of price movements for a candle shown on a price chart but it requires some auto-scaling improvements before it is finished. At the moment I am not coding due to other commitments (plus I destroyed my keyboard with a cup of tea and my temporary replacement is horrible to type on. Also the results of Brexit are making getting a UK layout replacement keyboard delivered to Greece rather more challenging than it should be!)
Have you seen these other indicators that I coded for distributions?
https://www.prorealcode.com/prorealtime-indicators/price-rating-and-distribution/
https://www.prorealcode.com/prorealtime-indicators/distribution-of-returns-prtv11/
04/03/2021 at 2:02 PM #166102https://www.prorealcode.com/prorealtime-indicators/distribution-of-returns-prtv11/
looks interesting, not really sure how to make use of it? do you have any suggestion on how to use it? or any place one can learn more about it?
did some searching and could not really get my head around how to interpret it to a strategy
04/03/2021 at 3:07 PM #166104I can’t tell you how to use it in a strategy. Distribution curves really just tell us how often an event has happened in the past and that can tell us the probability of it happening in the future. Also if we can see where we are on the curve at the moment then we can see how extreme recent price movements have been which can help us decide how likely a reversal is.
11/20/2021 at 1:16 PM #18193911/20/2021 at 3:54 PM #181952It won’t display on any chart, as its scale doesn’t not match prices. It must be installed BELOW the chart.
ON you chart you can spot it, but, say on DAX, it’s around level 50, while prices are at about 16100, so you need to use your mouse to reach 50 or shrink the chart about 300 times (making both bars and the indicator almost flat lines).
11/21/2021 at 8:46 AM #18197811/23/2021 at 4:06 PM #182121It’s because of the second FOR…NEXT iteration the one after if islastbarupdate then, if you set it to max 20 it’ll always work (still I couldn’t see any percentage, but there’s no error). With RSI that limit can be 50 and 40 with Williams’R, but ADX requires 20 max.
-
AuthorPosts
Find exclusive trading pro-tools on