Strange Problem

 

The signal below can only place long trades and not short trades. This is despite the fact that short trades should be placed as indicated by printf in the signal.

However printf in ExpertSignal consistently shows the ShortCondition() as 0 even though 100 should is returned by that function.

//+------------------------------------------------------------------+
//|                                                SignalSimpleK.mqh |
//|                                                2011, krokodilizm |
//+------------------------------------------------------------------+
#property copyright "2011 krokodilizm"
//+------------------------------------------------------------------+
//| include files                                                    |
//+------------------------------------------------------------------+
#include <Expert\ExpertSignal.mqh>
// wizard description start
//+------------------------------------------------------------------------------+
//| Description of the class                                                     |
//| Title=Signal based on krokodilizm's simple entry.                            |
//| Type=SignalAdvanced                                                          |
//| Name=SimpleK                                                                 |
//| Class=CSignalSimpleK                                                         |
//| Page=SignalSimpleK                                                           |
//| Parameter=SignalPips,int,50,Pips to indicate price movement                  |
//+------------------------------------------------------------------------------+
// wizard description end
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| CSignalSimpleK class                                             |
//| Purpose: A class of a module of trade signals,                   |
//| on, ssn's simple entry algorithm                                 |
//+------------------------------------------------------------------+
class CSignalSimpleK : public CExpertSignal
  {
protected:
   //--- adjusted parameters
   int               m_signalpips;
   
public:
   virtual const int       ShortCondition();      //checks conditions for sell
   virtual const int       LongCondition();       //checks conditions for buy
   
   //--- method of verification of settings
   virtual bool      ValidationSettings();
   
   //--- method of creating the indicator and timeseries
                     CSignalSimpleK();
                     ~CSignalSimpleK();
                     
   //--- methods of setting adjustable parameters
   void              SignalPips(int value)    { m_signalpips=value; }
   
//protected:

  };
   static double            basis_price;
//+------------------------------------------------------------------+
//| Constructor CSignalSimpleK.                                      |
//| INPUT:  no.                                                      |
//| OUTPUT: no.                                                      |
//| REMARK: no.                                                      |
//+------------------------------------------------------------------+
void CSignalSimpleK::CSignalSimpleK()
  {
   m_used_series=USE_SERIES_OPEN+USE_SERIES_HIGH+USE_SERIES_LOW+USE_SERIES_CLOSE;
//--- setting default values for the oscillator parameters
   m_signalpips  =50;
   basis_price = 0.0;
  }
//+------------------------------------------------------------------+
//| Destructor CSignalSimpleK.                                       |
//| INPUT:  no.                                                      |
//| OUTPUT: no.                                                      |
//| REMARK: no.                                                      |
//+------------------------------------------------------------------+
void CSignalSimpleK::~CSignalSimpleK()
  {
  }
//+------------------------------------------------------------------+
//| Validation settings protected data.                              |
//| INPUT:  no.                                                      |
//| OUTPUT: true-if settings are correct, false otherwise.           |
//| REMARK: no.                                                      |
//+------------------------------------------------------------------+
bool CSignalSimpleK::ValidationSettings()
  {
//--- validation settings of additional filters
   if(!CExpertSignal::ValidationSettings()) return(false);
//--- ok
   return(true);
  }
//+------------------------------------------------------------------+
//| Checks conditions for buy                                        |
//| INPUT:  None                                                     |
//| OUTPUT: Vote weight from 0 to 100                                |
//| REMARK: None.                                                    |
//+------------------------------------------------------------------+
int CSignalSimpleK::LongCondition()
  {
  if(basis_price==0.0)
    {
      basis_price=m_symbol.Bid();
      //printf(__FUNCTION__+" initialized basis is : "+string(basis_price));
      return(0);
    }
  //---
  if(m_symbol.Bid()-basis_price>=m_signalpips*PriceLevelUnit())
    {
      return(0);
    }
      
//--- condition is satisfied
      basis_price=m_symbol.Bid();
      //printf(__FUNCTION__+" refreshed basis is : "+string(basis_price));
      return(100);
  }
//+------------------------------------------------------------------+
//| Checks conditions for sell                                       |
//| INPUT:  None                                                     |
//| OUTPUT: Vote weight from 0 to 100                                |
//| REMARK: None.                                                    |
//+------------------------------------------------------------------+
int CSignalSimpleK::ShortCondition()
  {
  if(basis_price==0.0)
    {
      basis_price=m_symbol.Bid();
      //printf(__FUNCTION__+" initialized basis is : "+string(basis_price));
      return(0);
    }
  //---
  if(basis_price-m_symbol.Bid()<m_signalpips*PriceLevelUnit())
    {
      return(0);
    }
      
      
//--- condition is satisfied
      basis_price=m_symbol.Bid();
      printf(__FUNCTION__+" should open a short!!! ");
      return(100);
  }
//+------------------------------------------------------------------+
 
I,m also disturbed by similar issue .
Reason: