
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, If you open a pending short position by setting a m_base_price value, then the m_base_price gets set to 0.0 in CheckOpenLong (before CheckOpenShort gets called to use the value):
bool CExpertSignal::CheckOpenLong(double &price,double &sl,double &tp,datetime &expiration)
{
bool result =false;
//--- the "prohibition" signal
if(m_direction==EMPTY_VALUE)
return(false);
//--- check of exceeding the threshold value
if(m_direction>=m_threshold_open)
{
//--- there's a signal
result=true;
//--- try to get the levels of opening
if(!OpenLongParams(price,sl,tp,expiration))
result=false;
}
//--- zeroize the base price
m_base_price=0.0; Always sets m_base_price to 0.0
//--- return the result
return(result);
}
a fix for me at the moment (maybe it's not a complete fix) is to move the zeroize inside the if statement in my child class:
bool XXXXX::CheckOpenLong(double &price,double &sl,double &tp,datetime &expiration)
{
bool result =false;
//--- the "prohibition" signal
if(m_direction==EMPTY_VALUE)
return(false);
//--- check of exceeding the threshold value
if(m_direction>=m_threshold_open)
{
//--- there's a signal
result=true;
//--- try to get the levels of opening
if(!OpenLongParams(price,sl,tp,expiration))
result=false;
//--- zeroize the base price
m_base_price=0.0; Only zeroize if signal was for a long position
}
//--- return the result
return(result);
}
I've done the same for CheckOpenShort, CheckCloseLong, and CheckCloseShort.