Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Gaan+Gap+Ema+Bull Harami for Amibroker (AFL)
Copy & Paste Friendly
Back
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 | _SECTION_BEGIN ( "Price" ); SetChartOptions (0, chartShowArrows | chartShowDates ); _N (Title = StrFormat ( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}" , O , H , L , C , SelectedValue ( ROC ( C , 1 ) ) )); Plot ( C , "Close" , ParamColor ( "Color" , colorBlack ), styleNoTitle | ParamStyle ( "Style" ) | GetPriceStyle () ); _SECTION_END (); _SECTION_BEGIN ( "Graphics" ); GrpPrm= Param ( "Graphic Space" ,4,-50,50); GraphXSpace =GrpPrm; _SECTION_END (); //====================================================================================== _SECTION_END (); Buy =Scolor= ParamColor ( "Sup Color" , colorBrown ); /////////////////////////////////////////////////////////////////////////////// // Gap Finder // AFL that plots that unfilled Gaps encountered within the last N bars. // Author : Adheer Pai (adheer@gmail.com) /////////////////////////////////////////////////////////////////////////////// // Input : The number of bars ago from where to start looking for gaps. // Default is 250 : So, by default we search for Gaps found in last 250 trading days ( 1 year ) period = Param ( "Lookback Period" , 250, 15, 500); // If we do not have enough bars, adjust the period accordingly. if ( BarCount - period - 1 < 0 ) period = BarCount - 2; bIsGapUp = ( L > Ref ( H , -1) ); // Identify GapUp bars bIsGapDn = ( H < Ref ( L , -1) ); // Identify GapDown bars // We are not interested in Gap Ups and Gap Downs before the Period e.g. before the last 250 bars. // So we clear the values for bars before the ones we are interested in. for ( i = 0 ; i < ( BarCount - 1 - period) ; i++ ) { bIsGapUp[i] = False ; bIsGapDn[i] = False ; } // Now plot GapUp bars with a Up-Triangle below its low. PlotShapes ( IIf (bIsGapUp, shapeSmallUpTriangle , shapeNone ), colorBlue , 0, L , -12 ); // Now plot GapDown bars with a Down-Triangle below its high. PlotShapes ( IIf (bIsGapDn, shapeSmallDownTriangle , shapeNone ), colorRed , 0, H ); // Now walk from the first bar (e.g 250 bars ago, to the current bar) for ( i = ( BarCount - period - 1) ; i <= ( BarCount - 1) ; i++ ) { dUpper = 0.0; dLower = 0.0; bFilled = True ; // Is the current bar a Gap-Up bar ? if ( bIsGapUp[i] == True ) { // If yes, the store the Gap (Upper value) and Lower values. dUpper = L [i]; dLower = H [i-1]; bFilled = False ; // Now walk till the current bar and see if the Gap values have been filled from Above. // I.e prices are falling and the gap is being falled. for ( j = i+1; j <= ( BarCount - 1) ; j++ ) { // Check whether the current low is lesser than the Gap high. If yes, the Gap // has been penetrated. if ( L [j] < dUpper ) { dUpper = L [j]; // Determine whether the Gap has been fully penetrated - if yes, then the // Gap has been filled. if ( dUpper <= dLower ) bFilled = True ; } if ( bFilled == True ) break ; } } else if ( bIsGapDn[i] == True ) { // Same logic as GapUp - except we check whether the Gap has been pierced from Below. // i.e Prices are rising and the Gap has been filled. dUpper = L [i-1]; dLower = H [i]; bFilled = False ; for ( j = i+1; j <= ( BarCount - 1) ; j++ ) { if ( H [j] > dLower ) { dLower = H [j]; if ( dLower >= dUpper ) bFilled = True ; } if ( bFilled == True ) break ; // Gap was filled, so move on to find the next gap. } } if ( bFilled == False ) // Gap Not filled - so plot horizontal line at the Gap Level. { pLine = LineArray (i-1, dLower, BarCount -1,dLower, 1); Plot (pLine, "" , colorRed , styleDashed ); pLine = LineArray (i-1, dUpper, BarCount -1, dUpper, 1); Plot (pLine, "" , colorBlue , styleDashed ); } } /*Gann HiLo*/ Hld = IIf ( C > Ref ( MA ( H , 3), -1), 1, IIf ( C < Ref ( MA ( L , 3), -1), -1, 0)); Hlv = ValueWhen (Hld != 0, Hld, 1); Hilo = IIf (Hlv == -1, MA ( H , 3), MA ( L , 3)); Trigger = IIf ( C >Hilo, colorGreen , colorRed ); Plot (Hilo, "HiLo" ,Trigger, styleStaircase ); tf = Param ( "TF" , 0, 0, 0, 0 ) ; tfs = tf * in1Minute ; TimeFrameSet ( tfs ) ; GraphXSpace =5; SetChartOptions (0, chartShowArrows | chartShowDates ); _N (Title = StrFormat ( "{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " + WriteVal ( V , 1.0 ) + " {{VALUES}}" , O , H , L , C , SelectedValue ( ROC ( C , 1 )) )); Plot ( C , "Close" , colorBlack , styleNoTitle | ParamStyle ( "Style" ) | GetPriceStyle () ); O1= Ref ( O ,-1);H1= Ref ( H ,-1);L1= Ref ( L ,-1);C1= Ref ( C ,-1); O2= Ref ( O ,-2);H2= Ref ( H ,-2);L2= Ref ( L ,-2);C2= Ref ( C ,-2); O3= Ref ( O ,-3);H3= Ref ( H ,-3);L3= Ref ( L ,-3);C3= Ref ( C ,-3); BT=H2<H3 AND L2<L3 AND H1<H2 AND L1<L2; ST=H2>H3 AND L2>L3 AND H1>H2 AND L1>L2; LDB=C1>O1; LDS=C1<O1; BULLHarami= O >C1 AND O <O1 AND C <O1 AND C >C1; //AND BT AND LDS; BEARHarami= O <C1 AND O >O1 AND C >O1 AND C <C1; //AND ST AND LDB ; Buy =BULLHARAMI; Sell =BEARHARAMI; //Short=Sell=bear; //Cover=0; //Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy); //Short=ExRem(Short,Cover);Cover=ExRem(Cover,Short); PlotShapes ( IIf ( Buy , shapeUpArrow , shapeNone ), colorGreen ,0, L ,Offset=-10); PlotShapes ( IIf ( Sell , shapeDownArrow , shapeNone ), colorRed ,0, H ,Offset=-10); //PlotShapes(IIf(Short, shapeHollowDownArrow , shapeNone), colorRed); //PlotShapes(IIf(Cover, shapeHollowUpArrow , shapeNone), colorGreen); TimeFrameRestore (); _SECTION_BEGIN ( "EMA" ); P = ParamField ( "Price field" ,-1); Periods = Param ( "Periods" , 15, 2, 300, 1, 10 ); Plot ( EMA ( P, Periods ), _DEFAULT_NAME (), ParamColor ( "Color" , colorCycle ), ParamStyle ( "Style" ) ); _SECTION_END (); |