Help with drawing lines with my EA..

 

I am trying to draw a trend line of the bid prices raised to the z power (where z is a variable). Just have a few questions about object draw.:

  1. What does time1, price1, time2, price2, and time3, price3 mean? The help file just says time part and point.
  2. If I choose current window to be 0, does that default to the current window?
  3. I plan to use OBJ_TREND when creating my object, but how does it know where to plot the trend line on the screen? (Where do I input the x and y coordinates?)

Does anyone have a simple enough code which draws the line? Possibly with comments that will help me understand how it works? (I learn faster this way)

Thanks in advanced! Happy trading!
 
heyarn:

I am trying to draw a trend line of the bid prices raised to the z power (where z is a variable). Just have a few questions about object draw.:

  1. What does time1, price1, time2, price2, and time3, price3 mean? The help file just says time part and point.
  2. If I choose current window to be 0, does that default to the current window?
  3. I plan to use OBJ_TREND when creating my object, but how does it know where to plot the trend line on the screen? (Where do I input the x and y coordinates?)

Does anyone have a simple enough code which draws the line? Possibly with comments that will help me understand how it works? (I learn faster this way)

Thanks in advanced! Happy trading!

time1, price1, time2, price2 are your x and y coordinates of the trend line.

 

void DrawLine(int fromIndex, int toIndex, int lineColor)
{
ObjectCreate("IndicatorName" + TimeToStr(Time[fromIndex]) + "Line",OBJ_TREND, 0, Time[fromIndex], Open[fromIndex], Time[toIndex], Open[toIndex]);
ObjectSet("IndicatorName" + TimeToStr(Time[fromIndex]) + "Line", OBJPROP_RAY, false);
ObjectSet("IndicatorName" + TimeToStr(Time[fromIndex]) + "Line", OBJPROP_COLOR, lineColor);
ObjectSet("IndicatorName" + TimeToStr(Time[fromIndex]) + "Line", OBJPROP_WIDTH, 2);
}

???

Reason: