there are no trading operations - page 3

To add comments, please log in or register
Rio Purwanggono
1195
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
1803
Eng Keat Ang  
what is the value of "lotcheck" ?
Ubaidillah
2212
Ubaidillah  

The solution is simple, I just add the code:

iLots = NormalizeDouble(iLots,_Digits);

for the new lot orders

William Roeder
18344
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
2212
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...
123
To add comments, please log in or register