- 11 Sep 2017, 20:45
#1719
I tried "something like ..." this:
void GetCandleDirection() {
for (int i=0;i<ArraySize(TradePairs);i++) {
double fastMa15= iMA(TradePairs,PERIOD_M15,MA1Period,0,MA1Method,PRICE_HIGH,0);
double slowMa15= iMA(TradePairs,PERIOD_M15,MA1Period,0,MA1Method,PRICE_LOW,0);
if(Close(TradePairs,PERIOD_M15,0)>fastMa15)signals.Signalm15=UP;
if(Close(TradePairs,PERIOD_M15,1)>fastMa15 && Close(TradePairs,PERIOD_M15,0)<fastMa15 && Close(TradePairs,PERIOD_M15,0)>slowMa15)signals.Signalm15=UP;
else
if(Close(TradePairs,PERIOD_M15,0) < slowMa15)signals.Signalm15=DOWN;
if(Close(TradePairs[i],PERIOD_M15,1) < slowMa15 && Close(TradePairs[i],PERIOD_M15,0)>slowMa15 && Close(TradePairs[i],PERIOD_M15,0) < fastMa15) signals[i].Signalm15=DOWN;
double fastMa60= iMA(TradePairs[i],PERIOD_H1,MA1Period,0,MA1Method,PRICE_HIGH,0);
double slowMa60= iMA(TradePairs[i],PERIOD_H1,MA1Period,0,MA1Method,PRICE_LOW,0);
if(Close(TradePairs[i],PERIOD_H1,0)>fastMa60)signals[i].Signalh1=UP;
if(iClose(TradePairs[i],PERIOD_H1,1)>fastMa60 && Close(TradePairs[i],PERIOD_H1,0)<fastMa60 && Close(TradePairs[i],PERIOD_H1,0) > slowMa60)signals[i].Signalh1=UP;
else
if(Close(TradePairs[i],PERIOD_H1,0)<slowMa60)signals[i].Signalh1=DOWN;
if(Close(TradePairs[i],PERIOD_H1,1)<slowMa60 && Close(TradePairs[i],PERIOD_H1,0)>slowMa60 && Close(TradePairs[i],PERIOD_H1,0) < fastMa60)signals[i].Signalh1=DOWN;
double fastMa240= iMA(TradePairs[i],PERIOD_H4,MA1Period,0,MA1Method,PRICE_HIGH,0);
double slowMa240= iMA(TradePairs[i],PERIOD_H4,MA1Period,0,MA1Method,PRICE_LOW,0);
if(Close(TradePairs[i],PERIOD_H4,0)>fastMa240)signals[i].Signalh4=UP;
if(Close(TradePairs[i],PERIOD_H4,1)>fastMa240 && Close(TradePairs[i],PERIOD_H4,0)<fastMa240 && Close(TradePairs[i],PERIOD_H4,0) > slowMa240)signals[i].Signalh4=UP;
else
if(Close(TradePairs[i],PERIOD_H4,0)<slowMa240)signals[i].Signalh4=DOWN;
if(Close(TradePairs[i],PERIOD_H4,1)<slowMa240 && Close(TradePairs[i],PERIOD_H4,0)>slowMa240 && Close(TradePairs[i],PERIOD_H4,0) < fastMa240)signals[i].Signalh4=DOWN;
double fastMaD1= iMA(TradePairs[i],PERIOD_D1,MA1Period,0,MA1Method,PRICE_HIGH,0);
double slowMaD1= iMA(TradePairs[i],PERIOD_D1,MA1Period,0,MA1Method,PRICE_LOW,0);
if(Close(TradePairs[i],PERIOD_D1,0)>fastMaD1)signals[i].Signald1=UP;
if(Close(TradePairs[i],PERIOD_D1,1)>fastMaD1 && Close(TradePairs[i],PERIOD_D1,0)<fastMaD1 && Close(TradePairs[i],PERIOD_D1,0) > slowMaD1)signals[i].Signald1=UP;
else
if(Close(TradePairs[i],PERIOD_D1,0)<slowMaD1)signals[i].Signald1=DOWN;
else if(Close(TradePairs[i],PERIOD_D1,1)<slowMaD1 && Close(TradePairs[i],PERIOD_D1,0)>slowMaD1 && Close(TradePairs[i],PERIOD_D1,0) < fastMaD1)signals[i].Signald1=DOWN;
signals[i].SignaldirupScalp=signals[i].Signalm15== UP;
signals[i].SignaldirdnScalp=signals[i].Signalm15==DOWN;
signals[i].SignaldirupSwing=signals[i].Signalh4== UP;
signals[i].SignaldirdnSwing=signals[i].Signalh4==DOWN;
}
}
void SetColors(int i) {
if(signals[i].Signalm15==1){Color1 =BullColor0;}
if(signals[i].Signalm15==-1){Color1=BearColor0;}
if(signals[i].Signalh1==1){Color2=BullColor0;}
if(signals[i].Signalh1==-1){Color2=BearColor0;}
if(signals[i].Signalh4==1){Color3=BullColor0;}
if(signals[i].Signalh4==-1){Color3=BearColor0;}
if(signals[i].Signald1==1){Color4=BullColor0;}
if(signals[i].Signald1==-1){Color4=BearColor0;}
}
void Ge................................................