//+---------------------------------------------------------------------+ //| Copyright © 2008, Robert Hill | //+---------------------------------------------------------------------+ #property copyright "Copyright © 2008, Robert Hill" #property link "" #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Lime #property indicator_color2 Red #property indicator_color3 White extern string Buy_currency_pairs = "----- List of Buy currency pairs -----"; extern string mPair_1 = "GBPUSD"; extern string mPair_2 = "EURGBP"; extern string mPair_3 = "GBPJPY"; extern string mPair_4 = "USDCHF"; extern string mPair_5 = "NZDUSD"; extern string mPair_6 = "AUDJPY"; extern string mPair_7 = "EURJPY"; extern string Sell_currency_pairs = "----- List of Sell currency pairs -----"; extern string mPair_8 = "EURUSD"; extern string mPair_9 = "USDJPY"; extern string mPair_10 = "AUDUSD"; extern string mPair_11 = "NZDJPY"; extern string mPair_12 = "GBPCHF"; extern string mPair_13 = "CHFJPY"; extern string mPair_14 = "EURCHF"; extern int RSI_Period = 14; extern int BarsBack = 100; string Pair1, Pair2, Pair3, Pair4, Pair5, Pair6, Pair7; string Pair8, Pair9, Pair10, Pair11, Pair12, Pair13, Pair14; double AvgBuy_Buffer[]; double AvgSell_Buffer[]; double AvgAll_Buffer[]; int init() { GetCorrectPairs(); SetIndexStyle(0,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(0,AvgBuy_Buffer); SetIndexLabel(0,"Buy Avg"); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(1,AvgSell_Buffer); SetIndexLabel(1,"Sell Avg"); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID); SetIndexBuffer(2,AvgAll_Buffer); SetIndexLabel(2,"All Avg"); return(0); } int deinit() { return(0); } int start() { int i, limit; int counted_bars = IndicatorCounted(); double SumBuy, SumSell; int NumBuy, NumSell; double rsi; if(counted_bars < 0) return(-1); //---- last counted bar will be recounted if(counted_bars > 0) counted_bars--; limit=BarsBack; for(i=0; i<limit; i++) { SumBuy = 0; NumBuy = 0; if (StringLen(Pair1) > 0) { rsi = iRSI(Pair1, 0, RSI_Period, PRICE_CLOSE, i); SumBuy += rsi; NumBuy++; } if (StringLen(Pair2) > 0) { rsi = iRSI(Pair2, 0, RSI_Period, PRICE_CLOSE, i); SumBuy += rsi; NumBuy++; } if (StringLen(Pair3) > 0) { rsi = iRSI(Pair3, 0, RSI_Period, PRICE_CLOSE, i); SumBuy += rsi; NumBuy++; } if (StringLen(Pair4) > 0) { rsi = iRSI(Pair4, 0, RSI_Period, PRICE_CLOSE, i); SumBuy += rsi; NumBuy++; } if (StringLen(Pair5) > 0) { rsi = iRSI(Pair5, 0, RSI_Period, PRICE_CLOSE, i); SumBuy += rsi; NumBuy++; } if (StringLen(Pair6) > 0) { rsi = iRSI(Pair6, 0, RSI_Period, PRICE_CLOSE, i); SumBuy += rsi; NumBuy++; } if (StringLen(Pair7) > 0) { rsi = iRSI(Pair7, 0, RSI_Period, PRICE_CLOSE, i); SumBuy += rsi; NumBuy++; } AvgBuy_Buffer[i] = SumBuy / NumBuy; SumSell = 0; NumSell = 0; if (StringLen(Pair8) > 0) { rsi = iRSI(Pair8, 0, RSI_Period, PRICE_CLOSE, i); SumSell += rsi; NumSell++; } if (StringLen(Pair9) > 0) { rsi = iRSI(Pair9, 0, RSI_Period, PRICE_CLOSE, i); SumSell += rsi; NumSell++; } if (StringLen(Pair10) > 0) { rsi = iRSI(Pair10, 0, RSI_Period, PRICE_CLOSE, i); SumSell += rsi; NumSell++; } if (StringLen(Pair11) > 0) { rsi = iRSI(Pair11, 0, RSI_Period, PRICE_CLOSE, i); SumSell += rsi; NumSell++; } if (StringLen(Pair12) > 0) { rsi = iRSI(Pair12, 0, RSI_Period, PRICE_CLOSE, i); SumSell += rsi; NumSell++; } if (StringLen(Pair13) > 0) { rsi = iRSI(Pair13, 0, RSI_Period, PRICE_CLOSE, i); SumSell += rsi; NumSell++; } if (StringLen(Pair14) > 0) { rsi = iRSI(Pair14, 0, RSI_Period, PRICE_CLOSE, i); SumSell += rsi; NumSell++; } AvgSell_Buffer[i] = SumSell / NumSell; AvgAll_Buffer[i] = (SumBuy + SumSell) / (NumBuy + NumSell); } return(0); } void GetCorrectPairs() { Pair1 = GetCorrectSymbol(mPair_1); Pair2 = GetCorrectSymbol(mPair_2); Pair3 = GetCorrectSymbol(mPair_3); Pair4 = GetCorrectSymbol(mPair_4); Pair5 = GetCorrectSymbol(mPair_5); Pair6 = GetCorrectSymbol(mPair_6); Pair7 = GetCorrectSymbol(mPair_7); Pair8 = GetCorrectSymbol(mPair_8); Pair9 = GetCorrectSymbol(mPair_9); Pair10 = GetCorrectSymbol(mPair_10); Pair11 = GetCorrectSymbol(mPair_11); Pair12 = GetCorrectSymbol(mPair_12); Pair13 = GetCorrectSymbol(mPair_13); Pair14 = GetCorrectSymbol(mPair_14); } string GetCorrectSymbol(string pair) { string AddChar, myPair; myPair = pair; if (StringLen(pair) > 0) { if (StringLen(Symbol()) == 7) { AddChar = StringSubstr(Symbol(), 6, 1); myPair = pair + AddChar; } } return(myPair); }
Sample
Analysis
Market Information Used:
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Relative strength index
Custom Indicators Used:
Order Management characteristics:
Other Features: