dymatic trend line by angle dgree is always 90

 

Hi,  Below code draw a dymatic trend line by angle,  but mt5 always draw a vertica line as trend line and the angle value return is always 90.  

     When i remove the code with underline below,  mt5 draw trend line correctly.   Is it a mt5 bug(build 842)?     

#property version   "1.00"
#property indicator_chart_window
#property indicator_plots   0


int OnInit()
  {
   return(INIT_SUCCEEDED);
  }

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[])
  {
//---
    ArraySetAsSeries(time,true);
    ArraySetAsSeries(high,true);
    ArraySetAsSeries(low,true);
  
   if(ObjectFind(0,"trendline2")<0)
   { 
      if( ObjectCreate(0,"trendline2",OBJ_TRENDBYANGLE,0,time[1],high[1],time[10],low[10])==true)
        {
           ObjectSetInteger(0,"trendline2",OBJPROP_SELECTABLE,true);    
           //when i remove this line, trendline is correct.       
           double trendline1_angle=ObjectGetDouble(0,"trendline2",OBJPROP_ANGLE,0);  printf("trendline1_angle " + trendline1_angle);
        }
        
    }    

   return(rates_total);
  }
 
wsuib:

Hi,  Below code draw a dymatic trend line by angle,  but mt5 always draw a vertica line as trend line and the angle value return is always 90.  

     When i remove the code with underline below,  mt5 draw trend line correctly.   Is it a mt5 bug(build 842)?     

This seems effectively a mql5 bug, you have to write to ServiceDesk.
Get in touch with developers using Service Desk!
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
 
wsuib:

Hi,  Below code draw a dymatic trend line by angle,  but mt5 always draw a vertica line as trend line and the angle value return is always 90.  

     When i remove the code with underline below,  mt5 draw trend line correctly.   Is it a mt5 bug(build 842)?     

You are drawing the Trendline by Angle incorrectly.  For a standard trendline you give 2 price and time coordinates,  for a trendline by angle you give one set of price and time coordinates and one angle.
 
RaptorUK:
You are drawing the Trendline by Angle incorrectly.  For a standard trendline you give 2 price and time coordinates,  for a trendline by angle you give one set of price and time coordinates and one angle.

Nope. See documentation and example in your link.

Both angle and the second anchor point's coordinates can be used to set the slope of the line.

 
angevoyageur:

Nope. See documentation and example in your link.

Ah OK,  I looked at the code and missed this  "Both angle and the second anchor point's coordinates can be used to set the slope of the line."  sorry for my error.
Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Methods of Object Binding
Documentation on MQL5: Standard Constants, Enumerations and Structures / Objects Constants / Methods of Object Binding
  • www.mql5.com
Standard Constants, Enumerations and Structures / Objects Constants / Methods of Object Binding - Documentation on MQL5
 
Thank you guys,  i submited a request to ServiceDesk.
 
Does anyone found a solution for this ?
 
Luiz Tim:
Does anyone found a solution for this ?
Still not fixed ?