One of the first things a new user wishes to do with EFS language, me included, is to draw alerted trendlines.
That's how I drew my own:
I° Step: with the function onLButtonDblClk get the coordinates of two points.
x1=barIndex1, y1=yValue1,
x2=barIndex2, y2=yValue2
II° Step: get the slope of the line
slope=(y2-y1)/(x2-x1)
III° Step: calculate y2=target price at bar 0
x1=barIndex1, y1=yValue1,
x2=0 , y2=y1+slope(0-x1)
IV° Step: draw line and check conditions
V° Step: when new bar comes change x1 coordinate to x1-1bar
and go to III° Step.
I attached a basic example
Regards.
Massimo Rizzi
That's how I drew my own:
I° Step: with the function onLButtonDblClk get the coordinates of two points.
x1=barIndex1, y1=yValue1,
x2=barIndex2, y2=yValue2
II° Step: get the slope of the line
slope=(y2-y1)/(x2-x1)
III° Step: calculate y2=target price at bar 0
x1=barIndex1, y1=yValue1,
x2=0 , y2=y1+slope(0-x1)
IV° Step: draw line and check conditions
V° Step: when new bar comes change x1 coordinate to x1-1bar
and go to III° Step.
I attached a basic example
Regards.
Massimo Rizzi
Comment