Download MetaTrader 5

dymatic trend line by angle dgree is always 90

To add comments, please log in or register
Join MQL5 Cloud Network. Improve your rating!
Suibo Wen
4518
Suibo Wen 2013.08.16 06:30 

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);
  }
Alain Verleyen
Moderator
30688
Alain Verleyen 2013.08.16 10:14  
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.
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2013.08.16 10:17  
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.
Alain Verleyen
Moderator
30688
Alain Verleyen 2013.08.16 11:34  
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.

Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2013.08.16 11:56  
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
Suibo Wen
4518
Suibo Wen 2013.08.16 14:03  
Thank you guys,  i submited a request to ServiceDesk.
Luiz Tim
2159
Luiz Tim 2015.09.17 22:56  
Does anyone found a solution for this ?
Alain Verleyen
Moderator
30688
Alain Verleyen 2015.09.17 23:09  
Luiz Tim:
Does anyone found a solution for this ?
Still not fixed ?
To add comments, please log in or register