Download MetaTrader 5
To add comments, please log in or register
Share your knowledge. Become a well-known developer!
HenryMiller
16
HenryMiller 2014.10.01 12:40 

Hello,

I'm a really newbie and I would like not to chase you!

I'm able to draw lines using ObjectCreate command.

Here is an example to draw a line  on yesterday's high.

long chart_id=ChartID();

string daily_high="Daily_high";

ObjectCreate(chart_id,daily_high, OBJ_HLINE, 0, Time[0], iHigh(NULL, PERIOD_D1,1), 0, 0,0,0);  

 

I would like to know if it is possible to draw a line  referring to the "High value" between 00.00 and 07.00 am of the current day.

Cheers

Henry.

whroeder1
13653
whroeder1 2014.10.01 16:19  
HenryMiller:  I would like to know if it is possible to draw a line  referring to the "High value" between 00.00 and 07.00 am of the current day.
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Of course it's possible. Use a trend line.
    #define HR2400 (PERIOD_D1 * 60)  // 86400 = 24 * 3600
    int      TimeOfDay(datetime when=0){      if(when == 0)  when = TimeCurrent();
                                              return( when % HR2400 );            }
    datetime DateOfDay(datetime when=0){      if(when == 0)  when = TimeCurrent();
                                              return( when - TimeOfDay(when) );   }
    //datetime Tomorrow( datetime when=0){      if(when == 0)  when = TimeCurrent();
    //                                          return(DateOfDay(when) + HR2400);   }
    //datetime Yesterday(datetime when=0){      if(when == 0)  when = TimeCurrent();
    //   int iD1 = iBarShift(NULL, PERIOD_D1, DateOfDay(when) - 1);
    //                                       return( iTime(NULL, PERIOD_D1, iD1) ); }

       #define HR0700 25200 // 7 * 3600
       datetime bod = DateOfDay();
       datetime AM7 = bod + HR0700;
       double   HighD1 = iHigh(NULL, PERIOD_D1,1);
       ObjectCreate(chart_id,daily_high, OBJ_TLINE, 0, bod,     HighD1,            AM7, HighD1,0,0);
       ObjectSet(daily_high, OBJPROP_RAY, false);
    // ObjectCreate(chart_id,daily_high, OBJ_HLINE, 0, Time[0], iHigh(NULL, PERIOD_D1,1), 0, 0,0,0);
darksideofthemoon
57
darksideofthemoon 2014.10.01 17:58  
HenryMiller:

if it is possible to draw a line  referring to the "High value" between 00.00 and 07.00 am of the current day.

Look up iHighest().

Timeframe would be H1.

Type would be MODE_HIGH. 

Count would be 7.

Start would be hour of day minus 7.

Then iHigh() and iTime() for H1 and the value from iHighest().

HenryMiller
16
HenryMiller 2014.10.01 18:39  
WHRoeder:

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Of course it's possible. Use a trend line.
    #define HR2400 (PERIOD_D1 * 60)  // 86400 = 24 * 3600
    int      TimeOfDay(datetime when=0){      if(when == 0)  when = TimeCurrent();
                                              return( when % HR2400 );            }
    datetime DateOfDay(datetime when=0){      if(when == 0)  when = TimeCurrent();
                                              return( when - TimeOfDay(when) );   }
    //datetime Tomorrow( datetime when=0){      if(when == 0)  when = TimeCurrent();
    //                                          return(DateOfDay(when) + HR2400);   }
    //datetime Yesterday(datetime when=0){      if(when == 0)  when = TimeCurrent();
    //   int iD1 = iBarShift(NULL, PERIOD_D1, DateOfDay(when) - 1);
    //                                       return( iTime(NULL, PERIOD_D1, iD1) ); }

       #define HR0700 25200 // 7 * 3600
       datetime bod = DateOfDay();
       datetime AM7 = bod + HR0700;
       double   HighD1 = iHigh(NULL, PERIOD_D1,1);
       ObjectCreate(chart_id,daily_high, OBJ_TLINE, 0, bod,     HighD1,            AM7, HighD1,0,0);
       ObjectSet(daily_high, OBJPROP_RAY, false);
    // ObjectCreate(chart_id,daily_high, OBJ_HLINE, 0, Time[0], iHigh(NULL, PERIOD_D1,1), 0, 0,0,0);

Thank you very much. I will try it now.

HenryMiller
16
HenryMiller 2014.10.01 18:39  
2cent:

Look up iHighest().

Timeframe would be H1.

Type would be MODE_HIGH. 

Count would be 7.

Start would be hour of day minus 7.

Then iHigh() and iTime() for H1 and the value from iHighest().

 

 

Thank you very much. I will try it now.
/
To add comments, please log in or register