if I set 0.20 as start lots it is validated: D what can this depend on? What should I change? 0.01 no 0.20 yes
Lorentzos Roussos:
yes I tried that too, done thousands of tests, with start lot 0.01 it does not pass with 0.20 yes, as if the initial volume is too low to open orders !!
Your volume check is okay .Lot digits ,margin checks ?
void OnTick(){ double BuyPriceMax = 0, BuyPriceMin = 0, BuyPriceMaxLot = 0, BuyPriceMinLot = 0, SelPriceMin = 0, SelPriceMax = 0, SelPriceMinLot = 0, SelPriceMaxLot = 0; ⋮ // No open orders (BuyPriceMax * BuyPriceMaxLot + BuyPriceMin * BuyPriceMinLot) / (BuyPriceMaxLot + BuyPriceMinLot) + iMinimalProfit * Point(), Digits());If you have no open orders, you divide by zero.
fxduep2020:
yes I tried that too, done thousands of tests, with start lot 0.01 it does not pass with 0.20 yes, as if the initial volume is too low to open orders !!
yes I tried that too, done thousands of tests, with start lot 0.01 it does not pass with 0.20 yes, as if the initial volume is too low to open orders !!
so with one lot digit it passes ,with 2 lot digits it does not pass ?
if you normalize the lot with the lot digits you find in code ?(meaning,dont assume 2 lot digits?)
William Roeder:
If you have no open orders, you divide by zero.
do i have to change something? if yes you can indicate me precisely I do not understand where to insert the code you posted
If you have no open orders, you divide by zero.
Lorentzos Roussos:
0.01 no, 0.15 no, 0.20 passed :D
so with one lot digit it passes ,with 2 lot digits it does not pass ?
if you normalize the lot with the lot digits you find in code ?(meaning,dont assume 2 lot digits?)
//wherever you send orders ,change the normalization in the order send to variable get_lot //get lot should be before order send like this double get_lot=lot_me(BuyLot);//or SellLot accordingly //then perform one more check for sending the order ,if get_lot>0 double lot_me(double lot) { double send=-1; int errors=0; ResetLastError(); double minlot=(double)MarketInfo(Symbol(),MODE_MINLOT);errors+=GetLastError(); if(errors==0) { int digits_lot=LotDigits(minlot); send=NormalizeDouble(lot,digits_lot); if(send<minlot){send=minlot;send=NormalizeDouble(send,digits_lot);} } return(send); } //Find Lot Digits int LotDigits(double lot) { int returnio=0; double digitos=0; double transfer=lot; while(transfer<1) { digitos++; transfer=transfer*10; } returnio=(int)digitos; //Print("Lot ("+lot+") Digits "+digitos+" Returnio "+returnio); return(returnio); }
try these
example :
double get_lot=lot_me(BuyLot); if(get_lot>0) { int ticket=OrderSend(Symbol(), OP_BUY, get_lot, NormalizeDouble(Ask, Digits()), iSlippage, 0, 0, "Test Buy", iMagicNumber, 0, clrGreen) }
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 can't validate this very simple ea in mt4, the error is in the attached .jpg file. Can anyone help me? the code