extern bool SoundON=true; extern bool EmailON=false; //---- input parameters extern int KPeriod=5; extern int DPeriod=3; extern int Slowing=3; extern int MA_Method = 0; // SMA 0, EMA 1, SMMA 2, LWMA 3 extern int PriceField = 0; // Low/High 0, Close/Close 1 //ストキャスのlevel1 extern double level1=75; //ストキャスのlevel2 extern double level2=65; //ストキャスのlevel3 extern double level3=35; //ストキャスのlevel4 extern double level4=25;
double CrossUp[]; double CrossDown[]; int flagval1 = 0; //これがないとAlertが止まらない int flagval2 = 0; //これがないとAlertが止まらない //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0, DRAW_ARROW, EMPTY); SetIndexArrow(0, 233); SetIndexBuffer(0, CrossUp); SetIndexStyle(1, DRAW_ARROW, EMPTY); SetIndexArrow(1, 234); SetIndexBuffer(1, CrossDown); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //----
//---- return(0); }
//+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start()
{ int limit, i, counter; double tmp=0; double fastMAnow, slowMAnow, fastMAprevious, slowMAprevious; double Range, AvgRange; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(i = 1; i <= limit; i++) {
counter=i; Range=0; AvgRange=0; for (counter=i ;counter<=i+9;counter++) { AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]); } Range=AvgRange/10;