Значение Slope Direction Line

 

Добрый день, знатоки.

Такой, для Вас наверное простенький,  вопрос :

Как в comment  вывести текущее значение Slope Direction Line,

которое я вижу при наведении стрелки мыши на этот индикатор

как Value1, если идём вверх, или Value2, если вниз.


Спасибо.

 

Нет так уж и просто.

#property strict
#property indicator_chart_window

#import "user32.dll"
   int GetCursorPos(int & xy[]);
   int GetWindowRect(int hWnd,int & c[]);
#import


int OnInit(){
   EventSetMillisecondTimer(100);
   return(INIT_SUCCEEDED);
}
  
void OnDeinit(const int reason){
   EventKillTimer();   
}  

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]){


   return(rates_total);
}

void OnTimer(){

   int xy[2],c[4];
   GetCursorPos(xy);
   GetWindowRect(WindowHandle(Symbol(),Period()),c);
   int x=xy[0]-c[0];
   int y=xy[1]-c[1];

   int           sub_window;
   datetime      time;
   double        price;

   ChartXYToTimePrice(0,x,y,sub_window,time,price);
      
      if(time!=0){
         int b=iBarShift(NULL,0,time,false);
         double ma1=iMA(NULL,0,14,0,0,0,b);
         double ma2=iMA(NULL,0,14,0,0,0,b+1);
         Comment("MA(14)="+DoubleToString(ma1,Digits+1));
      }
      else{
         Comment("");
      }         
      
   WindowRedraw();   
}

Вызов iMA заменить на свой индикатор. 

 
Integer:

Нет так уж и просто.

Вызов iMA заменить на свой индикатор. 

 

Действительно не просто.

Огромное спасибо.

Причина обращения: