How to properly set CExpertSignal::BasePrice

 

Hello, I've been trying to write a signal which places stop orders instead of executing on market price.

The problem I'm facing is, m_base_price is zeroed after each call to either

CExpertSignal::CheckOpenShort
CExpertSignal::CheckOpenLong

Here:

//--- zeroize the base price
   m_base_price=0.0;

My idea was to set the stop price inside the methods 

int MySignal::ShortCondition(void)
int MySignal::LongCondition(void)


But, when the expert is running, the Processing method is called, which in turns call CheckOpen, which calls:


bool CExpert::CheckOpen(void)
  {
   if(CheckOpenLong())
      return(true);
   if(CheckOpenShort())
      return(true);
//--- return without operations
   return(false);
  }

So, even if I set the BasePrice in my signal, in both `Shortcondition` or `LongCondition`, the `m_base_price` is reset after the call to `CheckOpenLong`, by the time it check `CheckOpenShort`, when the signal must create a stop order, it creates a market order, because `m_price_base` is now 0.


How do you normally set stops order when developing a signal?


Thank you very much in advance. 

 
I think I’ve found the solution, there is a method called General, which takes an index of the signal to use as general, I’ve change it to be the index of my filter and now the base price is correct being used. 
Reason: