how to use OBJ_TREND

 

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); 

 
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. 


 
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

 

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);
 
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() 

 
.
.
.
// 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);  
   
 

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?
Reason: