Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Gann level Plotter for Amibroker (AFL)
//You can do any of the following:
//Suppress candle or bar plotting
//Choose to plot candle or bar
//Show the Gann angle projections from Highs, Lows or Peaks and Troughs
//(the latter can be delayed in appearance because of the Amibroker fn limitation)
//Extend the Gann angle range by changing the Gann Range
// Current settings will work for scrips that are in the range of the Nifty
//Show the Angle number from 0 – 6. Useful for you to decide your trading rules.
Similar Indicators / Formulas
Indicator / Formula
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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | //Gann level Plotter //Abnash Singh 5-11-2011 //abnash1978@yahoo.co.uk //You can do any of the following: //Suppress candle or bar plotting //Choose to plot candle or bar //Show the Gann angle projections from Highs, Lows or Peaks and Troughs //(the latter can be delayed in appearance because of the Amibroker fn limitation) //Extend the Gann angle range by changing the Gann Range // Current settings will work for scrips that are in the range of the Nifty //Show the Angle number from 0 - 6. Useful for you to decide your trading rules. //Gann logic begin SetBarsRequired ( 5000, 0 ); showcandlechart= ParamList ( "Show Candle chart" , "YES|NO" ); stylecndl= ParamList ( "Bar/Candle chart" , "BAR|CANDLE" ); SHowGann= ParamList ( "Show Gann Angles" , "No|Yes" ,1); SHowGannlev= ParamList ( "Show Gann Angles Level" , "No|Yes" ); MArkpktr= ParamList ( "Mark the Highs/Lows" , "No|Yes" ); Gann= ParamList ( "GannAngles" , "High|Low|Peak|Trough" ); gannrange= Param ( "Gann Range" ,25,1,200,1); pkno= Param ( "Peak Number" ,1,1,100,1); perchange= Param ( "Zig change %" ,0.2,0.1,1,0.01); BarColor = IIf ( Close > Open , colorGreen , colorRed ); SetBarFillColor (BarColor); if (stylecndl== "BAR" )stylec= styleBar ; else stylec= styleCandle ; if (showcandlechart== "YES" ) { Plot ( C , "Close" , colorWhite , styleNoTitle | stylec); } avp=( O + C )/2; tn= TimeNum (); Datex= DateNum (); Dayhigh=Daylow=Dayopen=Dayclose=0; Minlow=Minhigh=mint=intvl=0; gline0=gline1=gline2=gline3=gline4=gline5=gline6=gline7=gline8=0; pk= Peak ( H ,perchange,1); pkbars= PeakBars ( H ,perchange,1); Tr= Trough ( L ,perchange,1); trbars= TroughBars ( L ,perchange,1); intvl= Interval ()/60; Clevel=0; Hv= HHV ( H ,pkno); Lv= LLV ( L ,pkno); Hvbars= BarsSince (Hv== H ); Lvbars= BarsSince (Lv== L ); pi=3.1415926; Mint= DayOfYear ()*10000+ Hour ()*60+ Minute (); entryprice=0; for (i=1;i< BarCount ;i++) { //day high low if (Datex[i]!=Datex[i-1]) { Dayhigh[i]= H [i]; Daylow[i]= L [i]; Minlow[i]=Mint[i]; Minhigh[i]=Mint[i]; } else { Dayhigh[i]=Dayhigh[i-1]; Daylow[i]=Daylow[i-1]; Minlow[i]=Minlow[i-1]; Minhigh[i]=Minhigh[i-1]; if ( H [i]>Dayhigh[i]) { Dayhigh[i]= H [i]; Minhigh[i]=Mint[i]; } if ( L [i]<Daylow[i]) { Daylow[i]= L [i]; Minlow[i]=Mint[i]; } } //Gan Fan analysis if (pkbars[i]==0 AND gann!= "Low" AND Gann!= "High" )gann= "Peak" ; if (trbars[i]==0 AND gann!= "Low" AND gann!= "High" )gann= "Trough" ; Minsincehi= int (Mint[i]/intvl)*intvl-Minhigh[i]; Minsincelo= int (Mint[i]/intvl)*intvl-Minlow[i]; dh=Dayhigh[i]; dl=daylow[i]; if (gann== "Peak" ) { dh=pk[i]; Minsincehi=intvl*pkbars[i]; } else if (gann== "Trough" ) { dl=tr[i]; Minsincelo=intvl*trbars[i]; } if (MArkpktr== "Yes" ) { if (dh== H [i] AND (gann== "High" OR gann== "Peak" )) PlotText ( "P" ,i, H [i]+5, colorOrange ); if (dl== L [i] AND (gann== "Low" OR gann== "Trough" )) PlotText ( "T" ,i, L [i]-5, colorOrange ); } if ((gann== "High" OR gann== "Peak" ) AND Minsincehi>0) { gline0[i]=dh-((minsincehi)* tan (0*90*pi/180)); gline1[i]=dh-((minsincehi)* tan (0.125*90*pi/180)); gline2[i]=dh-((minsincehi)* tan (0.25*90*pi/180)); gline3[i]=dh-((minsincehi)* tan (0.382*90*pi/180)); gline4[i]=dh-((minsincehi)* tan (0.5*90*pi/180)); gline5[i]=dh-((minsincehi)* tan (0.618*90*pi/180)); gline6[i]=dh-((minsincehi)* tan (0.75*90*pi/180)); gline7[i]=dh-((minsincehi)* tan (0.875*90*pi/180)); gline8[i]=dh-((minsincehi)* tan (1*90*pi/180)); if (gline1[i]<dh-gannrange)gline1[i]= Null ; if (gline2[i]<dh-gannrange)gline2[i]= Null ; if (gline3[i]<dh-gannrange)gline3[i]= Null ; if (gline4[i]<dh-gannrange)gline4[i]= Null ; if (gline5[i]<dh-gannrange)gline5[i]= Null ; if (gline6[i]<dh-gannrange)gline6[i]= Null ; if (gline7[i]<dh-gannrange)gline7[i]= Null ; if (gline8[i]<dh-gannrange)gline8[i]= Null ; } else if ((gann== "Low" OR gann== "Trough" ) AND Minsincelo>0) { gline0[i]=dl+((minsincelo)* tan (0*90*pi/180)); gline1[i]=dl+((minsincelo)* tan (0.125*90*pi/180)); gline2[i]=dl+((minsincelo)* tan (0.25*90*pi/180)); gline3[i]=dl+((minsincelo)* tan (0.382*90*pi/180)); gline4[i]=dl+((minsincelo)* tan (0.5*90*pi/180)); gline5[i]=dl+((minsincelo)* tan (0.618*90*pi/180)); gline6[i]=dl+((minsincelo)* tan (0.75*90*pi/180)); gline7[i]=dl+((minsincelo)* tan (0.875*90*pi/180)); gline8[i]=dl+((minsincelo)* tan (1*90*pi/180)); if (gline1[i]>dl+gannrange)gline1[i]= Null ; if (gline2[i]>dl+gannrange)gline2[i]= Null ; if (gline3[i]>dl+gannrange)gline3[i]= Null ; if (gline4[i]>dl+gannrange)gline4[i]= Null ; if (gline5[i]>dl+gannrange)gline5[i]= Null ; if (gline6[i]>dl+gannrange)gline6[i]= Null ; if (gline7[i]>dl+gannrange)gline7[i]= Null ; if (gline8[i]>dl+gannrange)gline8[i]= Null ; } else { gline0[i]=gline1[i]=gline2[i]=gline3[i]=gline4[i]=gline5[i]=gline6[i]=gline7[i]=gline8[i]= Null ; } x=0; if (gline0[i]>gline2[i]) if ( C [i]<gline0[i]) if ( C [i]<gline1[i]) if ( C [i]<gline2[i]) if ( C [i]<gline3[i]) if ( C [i]<gline4[i]) if ( C [i]<gline5[i]) if ( C [i]<gline6[i]) if (gline0[i]>0)x=6; else x=1; else if (gline0[i]>0)x=5; else x=1; else if (gline0[i]>0)x=4; else x=1; else if (gline0[i]>0)x=3; else x=1; else if (gline0[i]>0)x=2; else x=1; else if (gline0[i]>0)x=1; if (gline2[i]>gline0[i]) if ( C [i]>gline0[i]) if ( C [i]>gline1[i]) if ( C [i]>gline2[i]) if ( C [i]>gline3[i]) if ( C [i]>gline4[i]) if ( C [i]>gline5[i]) if ( C [i]>gline6[i]) if (gline0[i]>0)x=6; else x=1; else if (gline0[i]>0)x=5; else x=1; else if (gline0[i]>0)x=4; else x=1; else if (gline0[i]>0)x=3; else x=1; else if (gline0[i]>0)x=2; else x=1; else if (gline0[i]>0)x=1; if (x==1) { entryprice[i]=gline1[i]; Clevel[i]=1+( abs (gline1[i]- C [i]))/( abs (gline1[i]-gline2[i])); } if (x==2) { entryprice[i]=gline2[i]; Clevel[i]=2+( abs (gline2[i]- C [i]))/( abs (gline2[i]-gline3[i])); } if (x==3) { entryprice[i]=gline3[i]; Clevel[i]=3+( abs (gline3[i]- C [i]))/( abs (gline3[i]-gline4[i])); } if (x==4) { entryprice[i]=gline4[i]; Clevel[i]=4+( abs (gline4[i]- C [i]))/( abs (gline4[i]-gline5[i])); } if (x==5) { entryprice[i]=gline5[i]; Clevel[i]=5+( abs (gline5[i]- C [i]))/( abs (gline5[i]-gline6[i])); } if (x==6) { entryprice[i]=gline6[i]; Clevel[i]=6+( abs (gline6[i]- C [i]))/( abs (gline6[i]-gline7[i])); } if (showgannlev== "Yes" ) { if (x==0 AND (((gann== "High" OR gann== "peak" ) AND C [i]<gline0[i]) OR ((gann== "Low" OR gann== "Trough" ) AND C [i]>gline0[i])) ) PlotText ( "0" ,i, H [i]+25, colorWhite ); if (x==1) PlotText ( "1" ,i, H [i]+25, colorWhite ); if (x==2) PlotText ( "2" ,i, H [i]+25, colorWhite ); if (x==3) PlotText ( "3" ,i, H [i]+25, colorWhite ); if (x==4) PlotText ( "4" ,i, H [i]+25, colorWhite ); if (x==5) PlotText ( "5" ,i, H [i]+25, colorWhite ); if (x==6) PlotText ( "6" ,i, H [i]+25, colorWhite ); } } //Gan fan analysis end Colorpnk= ColorRGB (150,75,75); Colorblu= ColorRGB (25,100,150); Colorylo= ColorRGB (150,150,50); if (showgann== "Yes" ) { Plot (gline0, "0 deg" ,Colorpnk, styleLine | styleNoLabel ); Plot (gline1, "12.5 deg" ,Colorblu, styleLine | styleNoLabel ); Plot (gline2, "25 deg" ,Colorylo, styleLine | styleNoLabel ); Plot (gline3, "38.2 deg" ,Colorblu, styleLine | styleNoLabel ); Plot (gline4, "45 deg" ,Colorpnk, styleLine | styleNoLabel ); Plot (gline5, "61.8 deg" ,Colorblu, styleLine | styleNoLabel ); Plot (gline6, "75 deg" ,Colorylo, styleLine | styleNoLabel ); Plot (gline7, "87.5 deg" ,Colorblu, styleLine | styleNoLabel ); } |
4 comments
Leave Comment
Please login here to leave a comment.
Back
Sirji request you to kindly let us know as to how do we interprate this gann levels am not sure how to read the results and we see no levels on daily basis and above
anand ji,
would u please give more interpretation abt this AFL..
Thanx you
Superb!
I had a question: this code is made to fit more or less Nifty prices, as you well indicated in the code. When you use it on daily charts or for other symbols, it doesn’t plot.
Could you please indicate where in the code some constant needs to be changed? Thank you.