In this EA, I am simply trying to add up the number of times a given distance occurs between median price and a simple MA. When the array prints in the de-int, it prints all 0's. I think there must be something wrong with the way I am adressing or assigning the arrays?
externintLookBack=26;
doublePrice,MA,Diff,HighDiff=0,OldDiff=0;
doubleAtRay[2][1000];
intstart(){Price =((Ask-Bid)/2)+Bid;
MA=iMA(NULL, PERIOD_M1, LookBack, 0, MODE_SMA, PRICE_MEDIAN, 0);
Diff=MathAbs(Price-MA);
//only if Diff HAS changed since last tick//and Diff >0if(Diff!=OldDiff && Diff >0){OldDiff=Diff;
//Determine biggest Diff for use in later for loopif(Diff>HighDiff){HighDiff=Diff;
}//need to convert pips to integer//tried to use Digits here but it returned 2, not 4Diff*=10000;
intintDiff=Diff;
//Print("intDiff:",intDiff);//assign data to arrayAtRay[0,intDiff]=Diff;
AtRay[1,intDiff]+=1;
}return(0);
}intdeinit(){//again must change double to int for loopHighDiff*=10000;
intPrintDiff=HighDiff;
//Print("PrintDiff:",PrintDiff," Digits:",Digits);for(inti=0;i<=PrintDiff;i++){Print(AtRay[0,i],"",AtRay[1,i]);
}return(0);
}
In this EA, I am simply trying to add up the number of times a given distance occurs between median price and a simple MA. When the array prints in the de-int, it prints all 0's. I think there must be something wrong with the way I am adressing or assigning the arrays?