When checking the log, I continue to get a calculation of 0 lots, so this error perpetuates
When checking the log, I continue to get a calculation of 0 lots, so this error perpetuates:
2013.07.17 17:47:59 2012.01.11 22:19 Coin Toss EA EURUSD,M5: OrderSend error 4051
2013.07.17 17:47:59 2012.01.11 22:19 Coin Toss EA EURUSD,M5: invalid lots amount for OrderSend function
Your code:
double Lots = 0; int Risk = 1; Lots=MathFloor((AccountFreeMargin()*AccountLeverage()*Risk*Point*100)/(Ask*MarketInfo(Symbol(),MODE_LOTSIZE)*MarketInfo(Symbol(),MODE_MINLOT)))*MarketInfo(Symbol(),MODE_MINLOT); Print(Lots);
produces this in the log:
So, the code (as you have posted it) seems to give a non-zero value. Did you define the variable Lots as an int or double?
So, basically instead of using MathFloor() I want to use NormalizeLots() ?
I'm trying to calculate lot size (ie: Lots) using risk management. The variable "Risk" is an int that represents the percentage of the account that you are willing to risk in a given trade. All other relevant data within the calculation are built in mql4 functions or constants that should produce an appropriate lot size given Risk value.
I missed that post.
Risk = account balance * percent = (OrderOpenPrice - SL) * OrderLots * DeltaPerLot.
I missed that post.
Risk = account balance * percent = (OrderOpenPrice - SL) * OrderLots * DeltaPerLot.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When checking the log, I continue to get a calculation of 0 lots, so this error perpetuates:
2013.07.17 17:47:59 2012.01.11 22:19 Coin Toss EA EURUSD,M5: OrderSend error 4051
2013.07.17 17:47:59 2012.01.11 22:19 Coin Toss EA EURUSD,M5: invalid lots amount for OrderSend function