Hi, I’ve written the below EA to practice building advisors, but it is returning ordersend error 131. The error is to do with the volume however I’m not sure why, as it is with Pepperstone edge (max 200 lots, min 0.01 lots). Help with why this isn’t working would be greatly appreciated!
{
//—defining the RSI & Upper & Lower BB
double RSI = iRSI(NULL,0,14,PRICE_CLOSE,0);
double bbupper = iBands (NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,0);
double bblower = iBands (NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,0);
//--------------------------|
//conditions for trades |
//--------------------------|
if( (Open[0] > bbupper) && (RSI > 70) ) {
// sell if RSI is >70 & Price above upper BB
order = OrderSend(NULL,OP_SELL,0.1,Open[0],1,22,85,NULL,0,0,NULL);
}
else if ( (Open[0] < bblower) && (RSI < 30) ){
//buy if RSI is <30 & Price below lower BB
order = OrderSend (NULL,OP_BUY,0.1,Open[0],1,22,85,NULL,0,0,NULL);
}
}