I guess OBJ_TREND has more then one coordinate
https://docs.mql4.com/constants/objects
or you have to use horisontal line.
I guess OBJ_TREND has more then one coordinate
https://docs.mql4.com/constants/objects
or you have to use horisontal line.
What about the length though?
Can I use a script to draw these lines or does it have to be an inidicator?
If an indicator, can I use the script to start the indicator?
int start() { int counted_bars=IndicatorCounted(); //---- //testing variable inputlevel = 1.5898; int i; double level1=inputlevel+(20*Point*10); //+20pips double level2=inputlevel+(30*Point*10); //+30pips double level3=inputlevel+(40*Point*10); //+40pips double level4=inputlevel+(80*Point*10); //+80pips for(i=0;i<Bars;i++) { datetime dtStart = iTime(NULL,PERIOD_M15,i-4); datetime dtEnd = iTime(NULL,PERIOD_M15,i); } ObjectCreate("Line1",OBJ_TREND,0,dtStart,level1, dtEnd, level1); ObjectSet("Line1",OBJPROP_COLOR,Red); ObjectSet("Line1",OBJPROP_STYLE,STYLE_SOLID); ObjectSet("Line1", OBJPROP_RAY, false); ObjectSet("Line1",OBJPROP_WIDTH,1); ObjectCreate("Line2",OBJ_TREND,0,dtStart,level2, dtEnd, level2); ObjectSet("Line2",OBJPROP_COLOR,Red); ObjectSet("Line2",OBJPROP_STYLE,STYLE_SOLID); ObjectSet("Line2", OBJPROP_RAY, false); ObjectSet("Line2",OBJPROP_WIDTH,1); ObjectCreate("Line3",OBJ_TREND,0,dtStart,level3, dtEnd, level3); ObjectSet("Line3",OBJPROP_COLOR,Red); ObjectSet("Line3",OBJPROP_STYLE,STYLE_SOLID); ObjectSet("Line3", OBJPROP_RAY, false); ObjectSet("Line3",OBJPROP_WIDTH,1); ObjectCreate("Line4",OBJ_TREND,0,dtStart,level4, dtEnd, level4); ObjectSet("Line4",OBJPROP_COLOR,Red); ObjectSet("Line4",OBJPROP_STYLE,STYLE_SOLID); ObjectSet("Line4", OBJPROP_RAY, false); ObjectSet("Line4",OBJPROP_WIDTH,1); //---- return(0); }
Can I use a script to draw these lines or does it have to be an inidicator? -- either one
If an indicator, can I use the script to start the indicator? -- no
The code above doesn't draw anything. Any ideas what's wrong?
? :)
? :)
Any ideas why it doesn't draw anything?
No errors either...
Any ideas why it doesn't draw anything?
It does draw the lines somewhere in the Universe. :) You just can't see them.
Find the objects in the object list and check their coordinates.
No errors either...
Unlikely. Iterative call to ObjectCreate() with the same object name does return an error.
I'm curious what's the purpose of the 'for' loop? A time delay in the indicator?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I would like to draw 4 short trendlines of about 4 candles width backwards from the current candle at 4 levels. Any ideas?
I also want it to leave other lines on the chart untouched.
Can I do this with a script because I only want it to draw the lines once depending on what I enter for the inputevel...not every tick.
The I would run the script again maybe every 2 days or so.