If you know the name of the object, then it is simple. Then it goes like this :
double TrendLineRedValue = ObjectGetValueByShift(TrendLineRedName,shift);
And now ladies and gentlemen...it even works in an EA!
Many many thanks Mladen for that coding lesson.
Have a good WE.
New metatrader 4 compatible indicators
Good morning to all
Please can you fix errors and warnings in this indicator. .
Thank you very much in advance.
A big hug.
try it now
Another "old" but good one too found on TSD Forum. by "FerruFx"
Supposing I want to insert TrendLines on a separate window buffer, how should I wrote this line?
"ObjectCreate("TrendLine1_Red", OBJ_TREND, 1, Time, Bid-100*Point , Time+3600, Bid-100*Point );" ?
Let's say Indic BlahBlah = ((iCustom(NULL, 0, "BlahBlah", 0, i));
How should I insert / write "buffer 0,i " in place of "Bid-100*Point , Time+3600,Bid-100*Point " ?
Thanks very much Mladen.
First you have to make sure that your separate window has a unique name
Then use the WindowFind(UniqueName) in order to get the window number (something like int window = WindowFind(UniqueName);
And then, as a last step use that number in place of 1 in that code line (this line :
"ObjectCreate("TrendLine1_Red", OBJ_TREND, window, Time, Bid-100*Point , Time+3600, Bid-100*Point );"
All that needs to be done from the start procedure (using WindowFind() from init sometimes gives completely unexpected results)
Hi Mladen ,
Thanks for your reply.
And to select buffer_2 , not buffer_1 on that subwindow ? // or witch ever buffer?
"int window = WindowFind(UniqueName);" How do you write that?
Thanks a lot.
To select buffers and its values, the only function you can use for normal work is iCustom(......,bufferNO,index);
You can not select values of an indicator that is attached to a chart. Metatrader always opens a new instance of indicator when you wish to read it's buffer values
Oh I see,
So it is definitely much better to straightly trade from the chart with TrendLines better than via SW_Buffer's.
I sincerely thank you for your enlightenment. I will work on that in the near futur.
I am wondering how I will be able to thank You and TSD forum at the level of these useful informations.
I sincerely thank you very much.