My problem is that following lot calculation check code:
Code: Select all
// lot calc for buy:
onelotprice=Ask*(MarketInfo("EURUSD",MODE_LOTSIZE)/leverage);
double volume, moneytospend;
moneytospend=AccountFreeMargin()*lot_mult;
volume=MathFloor( (moneytospend/onelotprice) *100)*0.01;
Print(mk+mk+"CustomMarginCheck (Single order):", DoubleToStr(AccountFreeMargin()-volume*onelotprice,22));
Print(mk+mk+"MODE_MARGINREQUIRED (Single order):", DoubleToStr(AccountFreeMargin()-volume*MarketInfo(Symbol(),MODE_MARGINREQUIRED),22));
Print(mk+mk+"AccountFreeMarginCheck(OP_BUY): ", DoubleToStr(AccountFreeMarginCheck(Symbol(),OP_BUY,volume),22));
from tester on REAL account:
Code: Select all
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- NO open orders!
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- Lot calculations:
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- AccountLeverage: 500.00000000
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- AccountBalance: 100.00000000
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- AccountEquity: 100.00000000
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- AccountFreeMargin: 100.00000000
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- AccountMargin: 0.00000000
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- CustomMarginCheck (Single order):32.2450000000000188
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- MODE_MARGINREQUIRED (Single order):32.2480000000000047
0 16:42:58 2015.01.29 09:14 jumper_72.6 EURUSD,M1: --- --- AccountFreeMarginCheck(OP_BUY): 32.2486000000000104
Code: Select all
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- NO open orders!
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- Lot calculations:
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- AccountLeverage: 500.00000000
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- AccountBalance: 100.00000000
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- AccountEquity: 100.00000000
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- AccountFreeMargin: 100.00000000
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- AccountMargin: 0.00000000
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- CustomMarginCheck (Single order):32.0762000000000001
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- MODE_MARGINREQUIRED (Single order):42.0000000000000071
0 16:47:13 2015.01.15 13:31 jumper_72.6 EURUSD,M1: --- --- AccountFreeMarginCheck(OP_BUY): 42.0000000000000000
Tickstory is set up with 99.9 quality, all broker data imported with provided script.
What am i doin wrong?