"No Trading Operations" Problem - Who can solve this issue forever?! - page 3

 
Ali Raza #:
i think nobody want to share proper solution when he get solution. i hope anybody help us to share a dummy code to solve this issue.
/////////////////////////////////////////////////////////////////////////////////////////////
   // THERE ARE NO TRADING OPERATIONS --- SOLUTION >>>>>>>>>>  TRADING VOLUME CHECK FOR VALIDATION
   /////////////////////////////////////////////////////////////////////////////////////////////
   
        double maxVolume  = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX);
        double minVolume  = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
        double volumeStep = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
        
        if (lots < minVolume) Print("   Volume less than volume_min, returning now"); return 0;
        if (lots > maxVolume) Print("   Volume bigger than volume_max, returning now"); return 0;
        
   /////////////////////////////////////////////////////////////////////////////////////////////

This should work. The 'lots' is a double value that is on another part of the code, however, the rest of the necessary code is as displayed. 

 
Neiljun Sampan Cataag #:

You need to check the lot size first before doing an order. Just use this code to return the correct lot size. I hope it will help your problem.

Thanks,

 
Allan Munene Mutiiria #:

This should work. The 'lots' is a double value that is on another part of the code, however, the rest of the necessary code is as displayed. 

Thanks.

 

1) Put this code at the end of your EA codes. As you see it checks both MAXLOT and MINLOT:

//+------------------------------------------------------------------+

bool isLotValid(int orderType,double lots)

  {

   if(lots>MarketInfo(_Symbol,MODE_MAXLOT) || lots<MarketInfo(_Symbol,MODE_MINLOT))

     {

      Print("Lots "+lots+": is not valid.(greater than Max or less than min)");

      return false;

     }

   double remainMargin=AccountFreeMarginCheck(_Symbol,orderType,lots);

   if(remainMargin<0)

     {

      Print("Lots "+lots+": is not valid.(not enough margin)");

      return false;

     }

 

   return true;

  }

//+------------------------------------------------------------------+

2) Then, put this code before the open order code for by or sell:

if(isLotValid(OP_BUY,positionLots))

if(isLotValid(OP_SELL,positionLots))
 
Pezhman Zamani #:

1) Put this code at the end of your EA codes. As you see it checks both MAXLOT and MINLOT:

2) Then, put this code before the open order code for by or sell:

Dear All,

This is the last changes that I made and solved my problem. So, I really don't know any other solutions at this moment.

So, I hope you find the answer as helpful as I expected.

 
I tried everything here, I still have the issue
 
Desmond Jabulane Hlongwane #: I tried everything here, I still have the issue

You haven't tried everything. You know what symbol/TF doesn't work. Run it there and debug it.

 
Pezhman Zamani #:
 Thanks to all, I solved it.

i am having same problem can you tell how you solved it?

Reason: