Code:
//
#property copyright ""
#property link ""
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_minimum -20
#property indicator_maximum 20
extern int barsToProcess=100;
double TrendUp[], TrendDn[],SignalUp[];
string indicatorFileName;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0,SignalUp);SetIndexStyle(0,DRAW_LINE,EMPTY,0,clrBlack);
SetIndexBuffer(1,TrendUp);SetIndexStyle(1,DRAW_LINE,EMPTY,0,clrRed);
SetIndexBuffer(2,TrendDn);SetIndexStyle(2,DRAW_LINE,EMPTY,0,clrGreen);
indicatorFileName = WindowExpertName();
IndicatorShortName("Score 2020 " + "Signalwert:");
MathSrand(TimeLocal());
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectsDeleteAll();
// Löschen wir alle Objekte
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted(),
limit;
if(counted_bars>0)
counted_bars--;
limit=Bars-counted_bars;
if(limit>barsToProcess)
limit=barsToProcess;
for(int i=0;i<limit;i++)
{
double Scoreindex = 0;
double cci = iCCI(NULL,0,14,PRICE_TYPICAL,i);
if (cci < -100) Scoreindex -=5;
if (cci > 100) Scoreindex +=5;
double rsi = iRSI(NULL,0,14,PRICE_CLOSE,i);
if (rsi < 30) Scoreindex -=5;
if (rsi > 70) Scoreindex +=5;
double stoFastK = iStochastic(NULL,0,14,3,1,MODE_EMA,0,MODE_MAIN ,i);
double stoFastD = iStochastic(NULL,0,14,3,1,MODE_EMA,0,MODE_SIGNAL,i);
if (stoFastK < 20) Scoreindex -=5;
if (stoFastK > 80) Scoreindex +=5;
if (stoFastD < 20) Scoreindex -=5;
if (stoFastD > 80) Scoreindex +=5;
/*
if( insyncScore>=20)
{
TrendUp[i]=DoubleToStr(insyncScore,2);//iCCI(Symbol(),0,14,PRICE_CLOSE,i);
}
if( insyncScore>=-20)SetIndexStyle(3,DRAW_LINE,EMPTY,EMPTY,clrGreen);
{
SignalUp[i]=DoubleToStr(insyncScore,2);//iCCI(Symbol(),0,14,PRICE_CLOSE,i);
}
*/
if(Scoreindex>+0)TrendUp[i]=DoubleToStr(Scoreindex,2);
if(Scoreindex<-0)TrendDn[i]=DoubleToStr(Scoreindex,2);
//if(Scoreindex=0)SignalUp[i]=DoubleToStr(Scoreindex,2);
SignalUp[i]=DoubleToStr(Scoreindex,2);
}
return(0);
}
/*
*/