Download MetaTrader 5
To add comments, please log in or register
Publish your article. We will translate it into other languages!
Rajai Zeyad
184
Rajai Zeyad 2013.05.26 03:51 

dear all

How to use OBJ_TREND to draw trend line from the High of day snd the High of previous day

 

I make this code , but not workable , what is the correct code

 

 

  double Hi0=iHigh(Symbol(),PERIOD_D1,0);    

 double Hi1=iHigh(Symbol(),PERIOD_D1,1);

 

ObjectCreate("mytest",OBJ_TREND,0,Time[0],Hi1,Hi0);

         ObjectSet("mytest",OBJPROP_RAY,True);

         ObjectSet("mytest",OBJPROP_BACK,True)  ;                

         ObjectSet("mytest",OBJPROP_STYLE,STYLE_DOT);

         ObjectSet("mytest",OBJPROP_WIDTH,1);

         ObjectSet("mytest",OBJPROP_COLOR,Lime); 

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2013.05.26 08:20  
fareshanab:

dear all

How to use OBJ_TREND to draw trend line from the High of day snd the High of previous day

 

I make this code , but not workable , what is the correct code

<CODE DELETED>

Please read some other posts before posting . . .

Please edit your post . . .    please use the   SRC   button to post code: How to use the   SRC   button. 


Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2013.05.26 08:23  
fareshanab:

dear all

How to use OBJ_TREND to draw trend line from the High of day snd the High of previous day

I make this code , but not workable , what is the correct code

A Trend Line needs 2 sets of time, price coordinates,  a start point and an end point . . .  please look at the documentation for ObjectCreate()   You have this:

ObjectCreate("mytest", OBJ_TREND, 0,  Time[0], Hi1, Hi0 );

 you have,  datetime, price, price  instead of  datetime time1, double price1, datetime time2, double price2

Rajai Zeyad
184
Rajai Zeyad 2013.05.26 09:04  

Thank you

I make this code as follow , but not workable

double Hi0=iHigh(Symbol(),PERIOD_D1,0);    

 double Hi1=iHigh(Symbol(),PERIOD_D1,1);

 

ObjectCreate("mytest",OBJ_TREND,0,Time[0],Hi1,Time[0],Hi0,Time[0]);

         ObjectSet("mytest",OBJPROP_RAY,True);

         ObjectSet("mytest",OBJPROP_BACK,True)  ;                

         ObjectSet("mytest",OBJPROP_STYLE,STYLE_DOT);

         ObjectSet("mytest",OBJPROP_WIDTH,1);

         ObjectSet("mytest",OBJPROP_COLOR,Lime);
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2013.05.26 09:15  
fareshanab:

Thank you

I make this code as follow , but not workable

Why do you have 3 datetime parameters   ?  

ObjectCreate("mytest",OBJ_TREND,0 Time[0],  Hi1,  Time[0],  Hi0,  Time[0] );

 

please,  read the documentation   ObjectCreate() 

buju
151
buju 2016.08.23 20:52  
.
.
.
// trigger to start time , price start

tStart = Time[0];
priceStart = Close[0];
            
    
   string trend = "trend"; 
   ObjectDelete(trend);
     // ObjectDelete(trend);
      ObjectCreate( trend, OBJ_TREND,0, tStart, priceStart, Time[0], Ask );
    // ObjectSet(trend, OBJPROP_STYLE, 1);
    // ObjectSet(trend, OBJPROP_WIDTH, 1);
    //  ObjectSet(trend, OBJPROP_COLOR, LightBlue);  
   
Keith Watford
Moderator
7990
Keith Watford 2016.08.23 22:32  

buju:


tStart = Time[0];

ObjectCreate( trend, OBJ_TREND,0, tStart, priceStart, Time[0], Ask );
Your 2 time coordinates are the same, is that your intention?
/
To add comments, please log in or register