I keep getting error 138 in backtesting.

 

What am I doing wrong?


Here is the function:


extern int slipage = 1;
extern double lots = 1.0;
extern double takeProfit = 15.0;
extern double stopLoss = 30.0;
#define RMRHR2_MAGIC 80518
 
void DoLong() {
    RefreshRates();
    double stopValue;
    double takeValue;
    
    if(0 < stopLoss) {
        stopValue = NormalizeDouble((Bid - stopLoss*Point),Digits);
    } else {
        stopValue = 0;
    }
    
    if(0 < takeProfit) {
        takeValue = NormalizeDouble((Ask + takeProfit*Point),Digits);
    } else {
        takeValue = 0;
    }
 
    OrderSend(Symbol(),OP_BUY,lots,Bid,slipage,stopValue,takeValue,"RMRHR2Expert",RMRHR2_MAGIC,0,Blue); 
}
 

X

You need to BUY at the Ask price :)

And.. I put Slippage at 5, most people use at least 3

HTH

-BB-

 
BarrowBoy:

X

You need to BUY at the Ask price :)

And.. I put Slippage at 5, most people use at least 3

HTH

-BB-

You are right.



Sorry for that.

 

No problemo :)

We've all done that one - just keep on trying

-BB-