通貨の強弱比較を RSI でやりたいのなら
ということで・・・
関連通貨などの変更はお好きなように
↓ AUD/JPY 15分足 サブ下段

AUD/JPY 日足

//+------------------------------------------------------------------+
//| RSI_3.mq4 |
//| Copyright ゥ 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ゥ 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property indicator_separate_window
//#property indicator_minimum 5
//#property indicator_maximum 95
#property indicator_buffers 4
#property indicator_color1 Yellow
#property indicator_color2 Lime
#property indicator_color3 Magenta
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_color4 White
#property indicator_width4 2
//---- input parameters
extern int RSIPeriod=10;
//---- buffers
double RSIBuffer1[];
double RSIBuffer2[];
double RSIBuffer3[];
double CLine[];
//----
string NameObj[3] = { "RSI_1", "RSI_2", "RSI_3"};
color Iro[3] = { Yellow, Lime, Magenta};
string Indicator_Name = "RSI_3";
string fpair0, fpair1, fpair2;
int window;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(4);
SetIndexBuffer(0,RSIBuffer1);
SetIndexBuffer(1,RSIBuffer2);
SetIndexBuffer(2,RSIBuffer3);
SetIndexBuffer(3,CLine);
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexStyle(2,DRAW_LINE);
SetIndexStyle(3,DRAW_LINE);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName(Indicator_Name);
//----
for(int j=0;j<=3;j++) SetIndexLabel(j,NULL);
SetIndexDrawBegin(0,RSIPeriod);
//----
SetLevelStyle(STYLE_DOT, 0, Gray);
SetLevelValue(0, 25);
SetLevelValue(1, 75);
SetLevelValue(2, 40);
SetLevelValue(3, 60);
//----
window = WindowFind(Indicator_Name);
fpair0 = StringSubstr(Symbol(),0,6);
fpair1="USDJPY"; fpair2="EURUSD";
if( fpair0=="EURJPY" ) { fpair1="USDJPY"; fpair2="EURUSD";}
if( fpair0=="EURUSD" ) { fpair1="USDJPY"; fpair2="EURJPY";}
if( fpair0=="USDJPY" ) { fpair1="EURJPY"; fpair2="EURUSD";}
if( fpair0=="AUDJPY" ) { fpair1="USDJPY"; fpair2="AUDUSD";}
if( fpair0=="AUDUSD" ) { fpair1="USDJPY"; fpair2="AUDJPY";}
if( fpair0=="GBPJPY" ) { fpair1="USDJPY"; fpair2="GBPUSD";}
if( fpair0=="GBPUSD" ) { fpair1="USDJPY"; fpair2="GBPJPY";}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit() {
for(int j=1;j<=2;j++) ObjectDelete(NameObj[j]);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Relative Strength Index |
//+------------------------------------------------------------------+
int start() {
int i,counted_bars=IndicatorCounted();
//----
if(Bars<=RSIPeriod) return(0);
//---- initial zero
if(counted_bars<1) {
for(i=1;i<=RSIPeriod;i++) {
RSIBuffer1[Bars-i]=0.0;
RSIBuffer2[Bars-i]=0.0;
RSIBuffer3[Bars-i]=0.0;
}
}
//----
i=Bars-RSIPeriod-1;
if(counted_bars>=RSIPeriod) i=Bars-counted_bars-1;
while(i>=0) {
RSIBuffer1[i]=iRSI(NULL, 0, RSIPeriod, 0, i);
RSIBuffer2[i]=iRSI(fpair1, 0, RSIPeriod, 0, i);
RSIBuffer3[i]=iRSI(fpair2, 0, RSIPeriod, 0, i);
CLine[i] = 50.0;
i--;
}
//----
double b[3];
b[0] = RSIBuffer1[0]; b[1] = RSIBuffer2[0]; b[2] = RSIBuffer3[0];
string pa[3];
pa[0] = fpair0; pa[1] = fpair1; pa[2] = fpair2;
string sf;
for(int j=1;j<=2;j++) {
sf = pa[j];
ObjectCreate(NameObj[j], OBJ_TEXT, window, 0, 0);
ObjectSet(NameObj[j], OBJPROP_TIME1, Time[0]);
ObjectSet(NameObj[j], OBJPROP_PRICE1, b[j]);
while (StringLen(sf) < 25 ) sf = " " + sf;
ObjectSetText(NameObj[j], sf, 8, "Arial", Iro[j]);
}
//----
return(0);
}
//+------------------------------------------------------------------+