Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
N line break for Amibroker (AFL)
After Steve Nison’s book: Beyond Candlesticks, Chapter 6: three line break charts
Option 1: turn time axis on/off, Option 2: N-line break instead of 3-line break
Screenshots
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 | procedure constructChart_proc(nBar) { global lBeginTime; global lEndTime; global lBeginNoTime; global lEndNoTime; global j; lBeginTime[ 0 ] = C [ 0 ]; lEndTime[ 0 ] = C [ 0 ]; lBeginNoTime[ 0 ] = C [ 0 ]; lEndNoTime[ 0 ] = C [ 0 ]; lastHigh = C [ 0 ]; lastLow = C [ 0 ]; numUp = 0; numDn = 0; j = 0; for ( i = 1; i < BarCount ; i++ ) { // 1) trend change up if ( C [ i ] > lastHigh AND numDn >= nBar AND numUp == 0) { numDn = 0; numUp = numUp + 1; j = j + 1; lBeginTime[ i ] = lBeginTime[ i - 1]; lEndTime[ i ] = C [ i ]; lBeginNoTime[ j ] = lBeginNoTime[ j - 1]; lEndNoTime[ j ] = C [ i ]; lastLow = lEndNoTime[ j - 1 ]; lastHigh = C [ i ]; } // 2) trend up continuation after downbar else if ( C [ i ] > lastHigh AND numDn > 0 AND numDn < nBar AND numUp == 0) { numDn = 0; numUp = numUp + 1; j = j + 1; lBeginTime[ i ] = lBeginTime[ i - 1]; lEndTime[ i ] = C [ i ]; lBeginNoTime[ j ] = lBeginNoTime[ j - 1]; lEndNoTime[ j ] = C [ i ]; lastLow = lEndNoTime[ j - 1 ]; lastHigh = C [ i ]; } // 3) trend up continuation else if ( C [ i ] > lastHigh AND numDn == 0 ) { numDn = 0; numUp = numUp + 1; j = j + 1; lBeginTime[ i ] = lEndTime[ i - 1]; lEndTime[ i ] = C [ i ]; lBeginNoTime[ j ] = lEndNoTime[ j - 1]; lEndNoTime[ j ] = C [ i ]; if (numUp >= nbar) { lastLow = lEndNoTime[ j - nBar ]; } else if (numUp < nBar) { lastLow = lastLow; } lastHigh = C [ i ]; } // 1) trend change down else if ( C [ i ] < lastLow AND numUp >= nBar AND numDn == 0) { numUp = 0; numDn = numDn + 1; j = j + 1; lBeginTime[ i ] = lBeginTime[ i - 1]; lEndTime[ i ] = C [ i ]; lBeginNoTime[ j ] = lBeginNoTime[ j - 1]; lEndNoTime[ j ] = C [ i ]; lastLow = C [ i ]; lastHigh = lEndNoTime[ j - 1 ]; } // 2) trend down continuation after upbar else if ( C [ i ] < lastLow AND numUp > 0 AND numUp < nBar AND numDn == 0) { numUp = 0; numDn = numDn + 1; j = j + 1; lBeginTime[ i ] = lBeginTime[ i - 1]; lEndTime[ i ] = C [ i ]; lBeginNoTime[ j ] = lBeginNoTime[ j - 1]; lEndNoTime[ j ] = C [ i ]; lastLow = C [ i ]; lastHigh = lEndNoTime[ j - 1 ]; } // 3) trend down continuation else if ( C [ i ] < lastLow AND numUp == 0 ) { numUp = 0; numDn = numDn + 1; j = j + 1; lBeginTime[ i ] = lEndTime[ i - 1]; lEndTime[ i ] = C [ i ]; lBeginNoTime[ j ] = lEndNoTime[ j - 1]; lEndNoTime[ j ] = C [ i ]; if (numDn >= nbar) { lastHigh = lEndNoTime[ j - nBar ]; } else if (numDn < nBar) { lastHigh = lastHigh; } lastLow = C [ i ]; } // no break else if ( C [ i ] >= lastLow AND C [ i ] <= lastHigh ) { lBeginTime[ i ] = lBeginTime[ i - 1]; lEndTime[ i ] = lEndTime[ i - 1 ]; } } } // code by E.M.Pottasch, 11/7/2010, N line Break Charts // After Steve Nison's book: Beyond Candlesticks, Chapter 6: three line break charts // Option 1: turn time axis on/off, Option 2: N-line break instead of 3-line break SetBarsRequired ( sbrAll , sbrAll ); nBar = Param ( "nBar" , 3, 2, 10, 1 ); constructChart_proc(nBar); Title = Name () + " | " + EncodeColor ( colorYellow ) + nbar + EncodeColor ( colorWhite ) + " Line Break" ; chartType = ParamToggle ( "Show Time Axis" , "show|hide" ,0); if (chartType) { GraphXSpace = 5; SetChartOptions ( 0, chartShowDates ); Plot ( C , "\nTLB" , colorWhite , styleBar ); C = lEndTime; O = lBeginTime; H = IIf ( C > O , C , O ); L = IIf ( C > O , O , C ); Plot ( C , "" , colorWhite , styleCandle ); } else { delta = BarCount - 1 - j; lBeginNoTime = Ref (lBeginNoTime,-delta); lEndNoTime = Ref (lEndNoTime,-delta); C = lEndNoTime; O = lBeginNoTime; H = IIf ( C > O , C , O ); L = IIf ( C > O , O , C ); Plot ( C , "\nTLB" , colorWhite , styleCandle ); } |
1 comments
Leave Comment
Please login here to leave a comment.
Back
hi Empottasch sir, this afl looks very interesting, it would be helpful to all if you explain in detail about this afl.
thanks in advance,
Murali krishna