Cant Draw a simple line between time on the same chart

To add comments, please log in or register
NI_ks
11
NI_ks  


Think i've hit a brick wall


I'm just trying to draw a trend line between 1200 & 1700 showing the previous high and low for those two times but get a screen that looks like lasers have gone wild after 1200


Can anyone help simply the code to just draw on line not a million


int start()

{

Starter = StrToTime("12:00");

End = StrToTime("17:00");

ObjectCreate(topname, OBJ_TREND,0,Starter, High[1],End,Low[1]);

}

Naguisa Unada
524
Naguisa Unada  
        string obj_name = "TrendLine";
        
        datetime time1 = D'2018.11.22 12:00';
        datetime time2 = D'2018.11.22 17:00';
        
        int x = iBarShift(NULL, PERIOD_CURRENT, time1);
        int y = iBarShift(NULL, PERIOD_CURRENT, time2);
        
        if (ObjectFind(obj_name) < 0)
        {
                ObjectCreate(obj_name, OBJ_TREND, 0, time1, High[x], time2, Low[y]);
                ObjectSet(obj_name, OBJPROP_WIDTH, 1);
                ObjectSet(obj_name, OBJPROP_COLOR, clrYellow);
        }
NI_ks
11
NI_ks  

Much appreciated but still getting a similar result, is there a way of drawing a diagonal line across the chart instead of a horizontal line

Naguisa Unada
524
Naguisa Unada  

I do not really understand what you are doing.
My program does not draw horizontal lines.

Trend Line

To add comments, please log in or register