Hi, ForexWatchman,
this shouldn't be too hard. I actually wrote down this idea, assuming that value and time 1 are on the left and value and time 2 are the right coordinates of the trendline...
extern int ExtensionLeft; extern int ExtensionRight; int TrendlineModify(string Name) { int BarPeriod=Period double Value1=ObjectGet(Name, OBJPROP_PRICE1); double Value2=ObjectGet(Name, OBJPROP_PRICE2); datetime Time1=ObjectGet(Name, OBJPROP_TIME1); datetime Time2=ObjectGet(Name, OBJPROP_TIME2); double Delta=(Value2-Value1)/(((Time2-Time1)/60)/Barperiod); double NewValue1=Value1-Delta*ExtensionLeft; double NewValue2=Value2+Delta*ExtensionRight; datetime TimeNew1=Time1-(BarPeriod*60)*ExtensionLeft; datetime TimeNew2=Time2+(BarPeriod*60)*ExtensionRight; ObjectDelete(Name); ObjectCreate(Name,OBJ_TREND,0,TimeNew1,NewValue1,TimeNew2,NewValue2); }I do not guarantee that this works, but this might be an idea to build further ones on. Anyway I am not shure if the datetime values are really expressed in seconds from 1970...which in case I am wrong make calculations more complex...
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
OBJ_TREND draws a line between two points. Is there a way to extend it beyond its left and right points that define the trendline?
Please reply if you know how to do this.
Thanks
ForexWatchman