there are no trading operations - page 3

To add comments, please log in or register
Rio Purwanggono
3079
Rio Purwanggono  

I have solved this problem.

Add this code before CheckVolumeValue :

double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
   if(lotlot<min_volume)
     {
      lotlot=min_volume;
     }

//--- maximal allowed volume of trade operations
   double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
   if(lotlot>max_volume)
     {
      lotlot=max_volume;
     }


Before :

extern double    Lots=0.01;

if(totalsell()==0  && IsNewOrderAllowed() && CheckVolumeValue(lotlot,lotcheck) && CheckMoneyForTrade(Symbol(),lotlot,OP_SELL))
     {
         int opensell=OrderSend(Symbol(),OP_SELL,lotlot,Bid,(int)Slippage,0,0,comment,MagicNumber,0,Green);
     }


After :

extern double    Lots=0.01;

double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
   if(lotlot<min_volume)
     {
      lotlot=min_volume;
     }

//--- maximal allowed volume of trade operations
   double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
   if(lotlot>max_volume)
     {
      lotlot=max_volume;
     }

if(totalsell()==0  && IsNewOrderAllowed() && CheckVolumeValue(lotlot,lotcheck) && CheckMoneyForTrade(Symbol(),lotlot,OP_SELL))
     {
         int opensell=OrderSend(Symbol(),OP_SELL,lotlot,Bid,(int)Slippage,0,0,comment,MagicNumber,0,Green);
     }


Regards

Rio Purwanggono

Eng Keat Ang
2014
Eng Keat Ang  
what is the value of "lotcheck" ?
Ubaidillah
2442
Ubaidillah  

The solution is simple, I just add the code:

iLots = NormalizeDouble(iLots,_Digits);

for the new lot orders

William Roeder
21911
William Roeder  
Ubaidillah: I just add the code: iLots = NormalizeDouble(iLots,_Digits);
You used NormalizeDouble, It's use is usually wrong, as it is in your case.
Ubaidillah
2442
Ubaidillah  
whroeder1:
You used NormalizeDouble, It's use is usually wrong, as it is in your case.

Oh I'm sorry, I mean this code:

if(Lots<SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN)){
Lots=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
Print("Lot value too small, and set to minimum symbol volume : ",Lots);

}
Maybe it's because I'm too happy to paste the wrong code...
Manuel Joos
152
Manuel Joos  

Test failed with fixed defined lots@ 0.01/0.1 which are external params to my EA.Testing succeeded when i set Lots to 1.0... 

maybe that helps some of you...  

Muhammad Asyraf Bin Mohamad
295
Muhammad Asyraf Bin Mohamad  
Manuel Joos:

Test failed with fixed defined lots@ 0.01/0.1 which are external params to my EA.Testing succeeded when i set Lots to 1.0... 

maybe that helps some of you...  

as far i observed, market validation use multiple setting/server type. Some broker or pair minimum lot order is 0.01 or 0.10 or 1.00. For example minimum lot for crude oil is 1.00 lot.

123
To add comments, please log in or register