double Line=ObjectCreate("current_chart_id",OBJ_TREND,0,time1,Price1,time2,price2,0,0); : TrendLine[i]=Line;
- "having trouble " is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
- What does ObjectCreate() return?
- Why are you trying to create a trendline and have a line buffer?
- Once you create an object, you can't create it again; it's not going to move.
I do want the line to be static though is there a way of coding a trend line using the buffer method I use in the program allready?
A line - with one and (ray) or with two ends - has to have two points - neither only one point nor a buffer with thousands of points!
A point here is defined by a time and a price look at this example:
bool drawLine(string n, datetime t1, double p1, datetime t2, double p2, color clr=clrDimGray, string dscr="", bool ray=false, double stl=STYLE_SOLID, double wdt=1) { if(ObjectFind(n) >= 0) ObjectDelete(n); if (!ObjectCreate(n,OBJ_TREND,0,t1,p1, t2, p2) ) return(false); bool ok = ObjectSet(n,OBJPROP_COLOR,clr); ok = ok && ObjectSet(n,OBJPROP_STYLE,stl); ok = ok && ObjectSet(n, OBJPROP_RAY, ray); ok = ok && ObjectSet(n,OBJPROP_WIDTH,wdt); ok = ok && ObjectSetText(n,dscr,10); return(ok); }
A line - with one and (ray) or with two ends - has to have two points - neither only one point nor a buffer with thousands of points!
A point here is defined by a time and a price look at this example:
thanks gooly. May I ask you to clarify where I would place this in the code body (see attached top) and where would I declare the t2 and p2 inputs for these functions?
regards...........
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I hope you can help, I have an indicator that I am working on and want to draw a trendline however I am having trouble in where I should declare the anchor points.
Any suggestions would be appreciated.....