I have modified the version of Nicolas present in the library, added the colors and updated to version no. 2
This Is Version 2 Of This Indicator that now Finds Market Tops and Bottoms
Created by ChrisMoody on 11/03/2014.
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
// CM_Laguerre PPO PctRank Tops-Bottoms // modificato CM_Laguerre PPO PercentileRank ora = tradingview // parameters : Short = 0.4 Long = 0.8 lkb = 200 //(Look back period) pctile = 90 //(Extreme threshold lines) midpctile = 70 //(Warning threshold lines) if(barindex>lkb) then hl2 = (high+low)/2 //laguerre short Ls0 = (1 - Short)*hl2+Short*(Ls0[1]) Ls1 = -Short*Ls0+(Ls0[1])+Short*(Ls1[1]) Ls2 = -Short*Ls1+(Ls1[1])+Short*(Ls2[1]) Ls3 = -Short*Ls2+(Ls2[1])+Short*(Ls3[1]) lmas = (Ls0 + 2*Ls1 + 2*Ls2 + Ls3)/6 //laguerre long Ll0 = (1 - Long)*hl2+Long*(Ll0[1]) Ll1 = -Long*Ll0+(Ll0[1])+Long*(Ll1[1]) Ll2 = -Long*Ll1+(Ll1[1])+Long*(Ll2[1]) Ll3 = -Long*Ll2+(Ll2[1])+Long*(Ll3[1]) lmal = (Ll0 + 2*Ll1 + 2*Ll2 + Ll3)/6 pctileB = pctile * -1 midpctileB = midpctile * -1 //PPO Plot ppoT = (lmas-lmal)/lmal*100 ppoB = (lmal-lmas)/lmal*100 //PercentRank of PPO // percent rank = nb of value less than our value / (nb of values less than our value + nb of values greater than our value) topvalueMinus = 0 topvaluePlus = 0 bottomvalueMinus = 0 bottomvaluePlus = 0 for i = 0 to lkb do if ppoT[i]<ppoT then topvalueMinus = topvalueMinus+1 else topvaluePlus = topvaluePlus+1 endif if ppoB[i]<ppoB then bottomvalueMinus = bottomvalueMinus+1 else bottomvaluePlus = bottomvaluePlus+1 endif next pctRankT = topvalueMinus / (topvalueMinus+topvaluePlus) pctRankB = (bottomvalueMinus / (bottomvalueMinus+bottomvaluePlus)) *-1 //coloring histogram TOP ROSSO if pctRankT>=pctile/100 then TopColor = 1 else TopColor = -1 endif //coloring histogram MID TOP ARANCIONE if pctRankT>=midpctile/100 and pctRankT < pctile/100 then TopColor = 2 endif if TopColor=1 then r=255 g=0 b=0 elsif TopColor<0 then r=128 g=128 b=128 Endif if TopColor=2 then r=255 g=140 b=0 elsif TopColor<0 then r=128 g=128 b=128 Endif //coloring histogram BOTTOM VERDE CHIARO if pctRankB <= pctileB/100 then BottomColor = 1 else BottomColor = -1 endif //coloring histogram MID BOTTOM VERDE SCURO if pctRankB <= midpctileB/100 and pctRankB > pctileB/100 then BottomColor = 3 endif if BottomColor = 1 then rr=255 gg=0 bb=255 elsif BottomColor < 0 then rr=211 gg=211 bb=211 Endif if BottomColor=3 then rr=0 gg=128 bb=0 elsif BottomColor>0 then rr=0 gg=255 bb=0 Endif endif RETURN pctRankT coloured(r,g,b) as "Top", pctRankB coloured(rr,gg,bb) as "Bottom", 0 coloured (105,105,105) as "zero line", pctile/100 coloured (255,0,0) as "Top Percentile Threshold", pctileB/100 coloured (0,128,0) as "Bottom Percentile Threshold", midpctile/100 coloured (255,140,0) as "Warning Top Percentile Threshold", (midpctile*-1)/100 coloured (0,255,0) as "Warning Bottom Percentile Threshold" |
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