saquibvirus:
In MQL5 it is fundamental to verify that the volume of the order contains the specifications of the symbol before it is sent.
For this, use the SymbolInfoDouble() function, which allows you to obtain properties such as the minimum volume (SYMBOL_VOLUME_MIN), the maximum volume (SYMBOL_VOLUME_MAX) and the volume step (SYMBOL_VOLUME_STEP).
Illustrative example:
double min_volume = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN); double max_volume = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX); double volume_step = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP); // Let's assume 'volume' is the lot size you calculated earlier if (volume < min_volume) volume = min_volume; else if (volume > max_volume) volume = max_volume; // Adjust volume to the nearest valid step volume = MathRound(volume / volume_step) * volume_step;
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 All,
I'm new to this forum. I have created 1 strategy using pine on tradingview which produces buy and sell signals, Integrated with PineConnector and MT5. The condition of the script is that it doesn't has SL/TP. It exits on opposite signal. I need to use specific lots eg. XAUUSD lot=0.02, but it gives me "Error 4756: Invalid Volume, Computed lot is less that minimum allowed". Chart Specification Minimal Volume is 0.01 and Volume step is 0.01. I can place normal trades using this 0.02 lots but not able to do it through PineConnector. I used risk=0.02 but I dont want to have a SL. Kindly suggest
Thank You!