//| 1. Take RSI(14) on close. //| 2. Take Momentum(9) of that RSI. //| 3. Take RSI(3) on close. //| 4. Take an SMA(3) of point 3. //| 5. Add together point 2 and point 4. //| 6. Take SMA(4) of point 5. //| 7. Take SMA(45) of point 5. //| 8. Print points 5, 6 & 7. //| myRSI = RSI[14](close) //| myMOM = Momentum[9](myRSI) //| shortRSI = RSI[3](close) //| mySMA = Average[3](shortRSI) //| indicator = myMOM+mySMA //| MA4 = Average[4](indicator) //| MA45 = Average[45](indicator) //| RETURN indicator as "IND", MA4 as "MA4", MA45 as "MA45" #property copyright "Copyright © 2010, Robert Hill" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color1 Red #property indicator_color2 Gold #property indicator_color3 Lime #property indicator_color4 Aqua #property indicator_color5 Yellow #property indicator_color6 Orange #property indicator_color7 Brown // // extern int RSI.Price = PRICE_CLOSE; extern int RSI.SlowLength = 14; extern int RSI.FastLength = 3; extern int Momentum.Length = 9; extern int SMA.Length1 = 3; extern int SMA.Length2 = 4; extern int SMA.Length3 = 45; // // // working buffers double RSI_14[]; double RSI_Momentum_9[]; double RSI_3[]; double RSI_3_SMA_3[]; // display buffers double Composite[]; double Composite_SMA4[]; double Composite_SMA45[]; //+----------------------------------------------------------------------------------+ //| | //+----------------------------------------------------------------------------------+ // // int init() { // IndicatorBuffers(7); SetIndexBuffer(0,Composite); SetIndexBuffer(1,Composite_SMA4); SetIndexBuffer(2,Composite_SMA45); SetIndexBuffer(3,RSI_14); SetIndexBuffer(4,RSI_Momentum_9); SetIndexBuffer(5,RSI_3); SetIndexBuffer(6,RSI_3_SMA_3); SetIndexLabel(0,"Composite"); SetIndexLabel(1,"Composite_SMA4"); SetIndexLabel(2,"Composite_SMA45"); SetIndexLabel(3,"RSI_14"); SetIndexLabel(4,"RSI_Momentum_9"); SetIndexLabel(5,"RSI_3"); SetIndexLabel(6,"RSI_3_SMA_3"); return(0); } int deinit() { return(0); } //+----------------------------------------------------------------------------------+ //| | //+----------------------------------------------------------------------------------+ // // //| myRSI = RSI[14](close) //| myMOM = Momentum[9](myRSI) //| shortRSI = RSI[3](close) //| mySMA = Average[3](shortRSI) //| indicator = myMOM+mySMA //| MA4 = Average[4](indicator) //| MA45 = Average[45](indicator) int start() { int counted_bars=IndicatorCounted(); int i,limit; if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit = Bars-counted_bars; // for(i=limit; i >= 0; i--) { //| 1. Take RSI(14) on close. RSI_14[i] = iRSI(NULL,0,RSI.SlowLength,RSI.Price,i); //| 3. Take RSI(3) on close. RSI_3[i] = iRSI(NULL,0,RSI.FastLength,RSI.Price,i); } //| 2. Take Momentum(9) of RSI_14. for(i=limit; i >= 0; i--) RSI_Momentum_9[i]=iMomentumOnArray(RSI_14,Bars,Momentum.Length,i); //| 4. Take an SMA(3) of point 3. for(i=limit; i >= 0; i--) RSI_3_SMA_3[i]=iMAOnArray(RSI_3,Bars,SMA.Length1,0,MODE_SMA,i); //|---------------- //| Display Time //| 8. Print points 5, 6 & 7. //|---------------- //| 5. Add together point 2 and point 4. for(i=limit; i >= 0; i--) Composite[i] = RSI_Momentum_9[i] + RSI_3_SMA_3[i]; //| 6. Take SMA(4) of point 5. for(i=limit; i >= 0; i--) Composite_SMA4[i]=iMAOnArray(Composite,Bars,SMA.Length2,0,MODE_SMA,i); //| 7. Take EMA(45) of point 5. for(i=limit; i >= 0; i--) Composite_SMA45[i]=iMAOnArray(Composite,Bars,SMA.Length3,0,MODE_SMA,i); return(0); } //+----------------------------------------------------------------------------------+