You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
For example...
GBP$ on 15 min candles today. SAR setup with step=0.02 and max=0.2. You can see on the graph the SAR had the following values...
12:30pm GMT 1.9722 (spot above candle)
12:45pm GMT 1.9721 (spot above candle)
13:00pm GMT 1.9677 (spot below candle)
13:15pm GMT 1.9679 (spot below candle)
But my mql4 script calls the iSAR() function on the first tick of each new bar; and produces the following results...
12:30pm GMT 1.9722
12:45pm GMT 1.9721
13:00pm GMT 1.9719 (it is always the first spot of a reverse that is wrong and was above the candle instead of below it)
13:15pm GMT 1.9679
Here's where the i(SAR) function is called:
string thisPair = "";
int thisTimeframe = PERIOD_M15;
int numBars = 0;
bool firstCandle = true;
int init() {
thisPair = Symbol();
return(0);
}
int deinit() {
return(0);
}
int start() {
int i = iBars(thisPair, thisTimeframe);
if (i > numBars) {
numBars = i;
if (firstCandle == true) {
firstCandle = false;
} else {
double thisCandleClose = iClose(thisPair, thisTimeframe, 0);
double thisSAR = iSAR(thisPair, thisTimeframe, 0.02, 0.2, 0);
Print("thisSAR = ", thisSAR, "; thisCandleClose = ", thisCandleClose);
}
}
return(0);
}
Any help in solving this dilemma is much appreciated.