How are we supposed to know what whichError() does and why do you send the orderID to it?
string whatError = whichError(orderID); Print(whatError);
int orderID = OrderSend(NULL,OP_SELL,lotSize,entryPrice,10,stopLossPrice,takeProfitPrice,NULL,magicNumber);
Be careful with NULL.
- On MT4, you can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not, OrderSend does not.
- Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
- Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
- MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
- Cloud Protector Bug? - MQL4 programming forum (2020)

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
Hello Everyone,
I am coding an EA, this EA had a calculating lot size function, when trying to backtest my EA my order was rejected and got error 131 Invalid trade volume, when I checked what were the trading volumes that the EA used there was nothing strange 0.1 or 0.01 or so, nothing particular, as I used a NormalizeDouble() function to make sure the lot size is has no more than 2 decimals, I checked on my optimal lot size function and could not see an error, but just in case I made the optimal lot step a comment and added a fixed lot size tried it with 0.1 and 1.1, but kept getting the same error, I checked with my broker to see if they had any restrictions on EAs or backtesting for some reason(I knew this was unlikely) but still couldn't find a reason as to why I'm getting an invalid trade volume. I will attach part of my EA so that you have an idea on what I am doing and the Journal of the backtesting. If anyone has an idea of what this could be I would be truly grateful. Thank you in advance