Help With EA - Error 131

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);


Can you drop results for printing below info?

I would change the OrderSend

Not sure why would you use NULL instaed of symbol you want to open. For OP_SELL you need to use current Bid price - it may not be the exact Open[0] one. If you want to set pending order use LIMIT or STOP orders.

Hi there, thanks for the feedback. I input

into the ea but not sure where it provides results sorry, as stated I am a complete novice with this.

I had null as the instead of the symbol as ideally this would run on any chart, but trying to test first on EURUSD.

Use Print(); to show something in the journal

Print(MarketInfo(_Symbol,MODE_MINLOT)); etc. :slight_smile:

EA runs only on the current chart. To get current chart symbol use _Symbol or Symbol() instead of NULL.
The same goes for indicators.
You can execute trades on other pairs from other chart, but for education purposes you should stick for single pair EA until you grasp the basics :slight_smile: