Support Vector Machine not signaling trades (mq5)

1
Hello,

I have an indicator that uses indicator data to create a SVM using an ex5 library. When the indicator is attached to the chart it displays the data points used to train the SVM (the first picture). The indicator is then supposed to used the trained SVM to signal new trades. However, as the code currently stands no arrow is printed to signal a new trade while the chart is active (second picture). If I update the chart the SVM will retrain with newly added data points (third picture).
(initial data points when attaching indicator)
(the red vertical line is the point at which I attached the indicator)
(after manually updating chart)



I'm pretty sure the code below is the culprit but I just switched to MT5 and I am having trouble understanding the code.

Code: Select all

//+------------------------------------------------------------------+
//| This statement is called for the calculation of any new bar generated on the 
//| current chart timeframe. It uses the model created by the trained support vector
//| machine to signal buy/sell trades and indicates with arrows
//+------------------------------------------------------------------+
   if(rates_total!=prev_calculated && prev_calculated>0)
     {
      for(int i=(rates_total-prev_calculated-1);i>0;i--)
        {
         if(classify(handleB,i))    BuyBuffer[i]=open[rates_total-i-1];
         else                       BuyBuffer[i]=0;
         if(classify(handleS,i))    SellBuffer[i]=open[rates_total-i-1];
         else                       SellBuffer[i]=0;
        }
     }
Does anyone familiar with MT5 have any ideas? Thanks


Who is online

Users browsing this forum: No registered users and 3 guests