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 ....
RSI Modified more user friendly 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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | SetBacktestMode (backtestregularrawmulti); Title = Name () + ", " + Interval (2) + ", " + Date () + " " + C ; _SECTION_BEGIN ( "RSI Divergence" ); //------------------------------------------------------------------------------ // // Formula Name: RSI divergence // Author: Rajandran R // Url: www.marketcalls.in // Formula URL: // Details URL: // //------------------------------------------------------------------------------ // // + scanner // //------------------------------------------------------------------------------ /*--------------------------------------------------- OBV Divergence --------------------------------------------------------*/ //OldAlert = ParamToggle("Old alert active", "No|Yes"); AudioAlert = ParamToggle ( "Human Voice Alert" , "No|Yes" ); EmailAlert = ParamToggle ( "E-mail Alert" , "No|Yes" ); OrderType = ParamList ( "Short Name of Security for alerts" , "Gold|Dollar|Bank Nifty|RSI|Nifty|CNXIT" ); NDays= Param ( "Number of RSI Days" ,28,1,50,1); // new addition by sph NzigDays= Param ( "Zig Number" ,9,5,50,1); // new addition by sph GraphXSpace =7; //n=Param("% Reverse ",12,0,100,1); n= Optimize ( "ZIG" ,NzigDays,5,50,1); //default is 9 per= Optimize ( "rsi" ,NDays,5,50,1); //default is 28 Buy = Sell =0; Var = Zig ( RSI (per), n); t= Trough ( RSI (per), n, 1); p= Peak ( RSI (per), n, 1); x[0] =Var[0]; price[0] = C [0]; j=0; // bearish divergence for ( i=0; i< BarCount ; i++) { if (Var[i] == p[i]) { j++; x[j] =Var[i]; price[j] = C [i]; if (x[j] <x[j-1] && price[j-1]< price[j]) Sell [i] =1; } } // bullish divergence for ( i=0; i< BarCount ; i++) { if (Var[i] == t[i]) { j++; x[j] =Var[i]; price[j] = C [i]; if (x[j] >x[j-1] && price[j]<price[j-1]) Buy [i] =1; } } Short = Sell ; Cover = Buy ; Plot (Var, "" , 39); PlotShapes ( IIf ( Sell , shapeCircle , shapeNone ), colorRed , 0 , Var,0); PlotShapes ( IIf ( Buy , shapeCircle , shapeNone ), colorBrightGreen , 0, Var,0); Title = "RSI Divergence" ; _SECTION_END (); _SECTION_BEGIN ( "TEMA" ); P = ParamField ( "Price field" ,-1); Periods = Param ( "Periods" , 15, 2, 200, 1, 10 ); Plot ( TEMA ( P, Periods ), _DEFAULT_NAME (), ParamColor ( "Color" , colorCycle ), ParamStyle ( "Style" ) ); _SECTION_END (); //if (OldAlert==True) //{ if (AudioAlert== True ) { AlertIf ( Buy , "SOUND C:\\Windows\\Media\\Afternoon\\Windows Error.wav" , "Buy alert A7" , 2,2,5 ); AlertIf ( Sell , "SOUND C:\\Windows\\Media\\Afternoon\\Windows Error.wav" , "Sell alert A7" , 2,2,5 ); } if (EmailAlert== True ) { //barcomplete = BarIndex() < LastValue(BarIndex()); //AlertIf( barcomplete AND Buy, "EMAIL", "RSI Buy" + BarIndex() +FullName()+" "+ C, 1, 1+2+4+8, 5 ); //AlertIf( barcomplete AND Sell, "EMAIL", "RSI Sell"+ BarIndex() +FullName()+" "+ C, 2,1+2+4+8,5 ); AlertIf ( Sell , "EMAIL" , "RSI Sell" + BarIndex () + FullName ()+ " " + C , 2,10,5 ); AlertIf ( Buy , "EMAIL" , "RSI Buy" + BarIndex () + FullName ()+ " " + C , 1, 10, 5 ); } //} //if (AudioAlert==True) //{ //AlertCondition = LastValue( Sum( Buy, 5) ); //if (alertCondition) //{ //LastAlert = StaticVarGet("AlertsTrack"); //if ( LastValue(Buy) AND LastAlert != 1 ) //{ // AlertIf( Buy, "SOUND C:\\Windows\\Media\\Notify.WAV", "Buy", 1, 1 +2 ); // AlertIf( Buy, "EMAIL", "Buy EMAIL", 1, 1 + 2 ); // StaticVarSet( "AlertsTrack", 1 ); //} //if ( LastValue(Sell) AND LastAlert != -1 ) //{ // AlertIf( Sell, "SOUND C:\\Windows\\Media\\Notify.WAV", "Sell", 2,1+2 ); // AlertIf( Sell, "EMAIL", "Sell EMAIL", 1, 1 + 2 ); // StaticVarSet( "AlertsTrack", -1 ); //} //if( ParamTrigger("RESET ALERTS", "RESET ALERTS") ) //StaticVarSet( "AlertsTrack", 0 ); //} //} GfxSelectFont ( "Tahoma" , 35, 100 ); GfxSetBkMode ( 1 ); GfxSetTextColor ( colorBlack ); pxChartTop = Status ( "pxcharttop" ) ; pxChartRight = Status ( "pxchartright" ) ; x=pxChartRight; y = pxChartTop; //GfxTextOut //( "P " + C,X-210,y+20); GfxSelectFont ( "Tahoma" , 18, 100 ); GfxTextOut ( "V " + Volume ,X-300,y+80); //barcompletex = LastValue(BarIndex()); barcompletex = BarIndex (); GfxTextOut ( "Bar " + " " + barcompletex, X-300,y+110); GfxTextOut ( Date (),X-300,y+140); SellPrice = ValueWhen ( Short , C ,1); BuyPrice = ValueWhen ( Buy , C ,1); Long= Flip ( Buy , Sell ); Shrt= Flip ( Short , Cover ); GfxSelectFont ( "Tahoma" , 35, 100 ); GfxSetTextColor ( colorGreen ); GfxTextOut ( ( "" + WriteIf (Long AND NOT Buy , "P " + C + " (" +( C - BuyPrice )+ ")" , "" )), x-410, y+20); //( "P " + C,X-310,y+20); GfxSetTextColor ( colorRed ); GfxTextOut ( ( "" + WriteIf (shrt AND NOT Short , "P " + C + " (" +( SellPrice - C )+ ")" , "" )), x-410, y+20); //( "P " + C,X-210,y+20); GfxSetTextColor ( colorBlue ); GfxTextOut ( ( "" + WriteIf ( Buy , "P " + C , "" )), x-310, y+20); GfxSetTextColor ( colorOrange ); GfxTextOut ( ( "" + WriteIf ( Sell , "P " + C , "" )), x-310, y+20); |