Building a strategy for practice based on bollinger bands and stochastics. What should happen is that if the close of a 5 minute bar is above the upper band and the stochastic has gone above 80, a sell order should enter, and conversely lower band 20.
However when I run it to test in mt4, I notice that the trades are wildly off the entry mark. Rather than opening at the close of a bar, they are several pips too high or too low. What am I doing wrong?
This is my code:
extern int MagicNumber=1;
extern double Lots =1;
extern double StopLoss=5;
extern double TakeProfit=15;
extern int TrailingStop=0;
int ThisBarTrade = 0;
int start() {
Hello,
Building a strategy for practice based on bollinger bands and stochastics.
What should happen is that if the close of a 5 minute bar is above the upper band and the stochastic has gone above 80, a sell order should enter, and conversely lower band 20.
However when I run it to test in mt4, I notice that the trades are wildly off the entry mark. Rather than opening at the close of a bar, they are several pips too high or too low. What am I doing wrong?
This is my code: