pips*=10;
I get an invalid lot size error if I enter say 1.63 lot however if I enter 1.6 lot then I do not get an error message.
Please note that I am spread betting on fx is there a fix for my Pip sizing above or might the problem lie somewhere else in my EA?
Hope someone can suggest a fix thanks??
What does your code have to do with lot size?
Maybe the symbol's lot step is 0.1, so anything smaller will be rejected.
As GumRai has pointed out, the volume or lots has nothing to do with pips or points (unless it is part of some unknown formula that you have not shown).
What is important, also pointed out by GumRai, is that your volume abide by the Broker's conditions of Minimum, Maximum and Step Size:
dblMarketLotMin = MarketInfo( _Symbol, MODE_MINLOT ); // Minimum Lots allowed by Broker dblMarketLotMax = MarketInfo( _Symbol, MODE_MAXLOT ); // Maximum Lots allowed by Broker dblMarketLotStep = MarketInfo( _Symbol, MODE_LOTSTEP ); // Lots Step Size allowed by Broker // dblLotsCalculated = calculated volume based on risk, margin or other formula // dblLotsNormalised = normalised volume based on broker's minimum, maximum and step size dblLotsNormalised = fmin( fmax( round( dblLotsCalculated / dblMarketLotStep ) * dblMarketLotStep, dblMarketLotMin ), dblMarketLotMax );
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
Last line of my standard post - Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
pips*=10;
I get an invalid lot size error if I enter say 1.63 lot however if I enter 1.6 lot then I do not get an error message.
Please note that I am spread betting on fx is there a fix for my Pip sizing above or might the problem lie somewhere else in my EA?
Hope someone can suggest a fix thanks??