ernest02: . SetLevelStyle(0,1,clrBlack); but it seems to require a SetIndexBuffer which stipulates an array. | It does not stipulate an array. It stipulates a buffer and EA's don't have buffers. |
Thanks for that guidance. I have written a snippet of code and it draws the required horizontal line, but it want to draw the line with every pass. I wrote some code that I thought would stop it from happening - but to no avail.
How can I stop this attempts at redrawing? (Getting 4200 error codes all the time which means the object already exists)
Here is the code:
if (ObjectName (0) != "pricelevel"); { if (!ObjectCreate( "pricelevel", OBJ_HLINE, 0, 0, PriceLevel, 0, 0, 0, 0 )) { Print("Error: can't create line! code #",GetLastError()); return(0); } }
Thanks for that guidance. I have written a snippet of code and it draws the required horizontal line, but it want to draw the line with every pass. I wrote some code that I thought would stop it from happening - but to no avail.
How can I stop this attempts at redrawing? (Getting 4200 error codes all the time which means the object already exists)
Here is the code:
// if (ObjectName (0) != "pricelevel"); if (ObjectFind(0,"pricelevel") < 0) { if (!ObjectCreate( "pricelevel", OBJ_HLINE, 0, 0, PriceLevel, 0, 0, 0, 0 )) { Print("Error: can't create line! code #",GetLastError()); return(0); } }
Untested / uncompiled.
Untested / uncompiled.
- 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 am writing an EA and want the EA to draw a horizontal line at a specific price level that is entered through an external variable.
I have looked at using the function e.g. SetLevelStyle(0,1,clrBlack); but it seems to require a SetIndexBuffer which stipulates an array. In my case I want a line on just one specific level.
Will anyone be so kind and help me with a solution?