MQL4 Add indicator to chart from EA - page 2

To add comments, please log in or register
Georgiy Liashchenko
4333
Georgiy Liashchenko  
Vasyl Nosal:
Maybe write to srvice desk and ask they to add ChartIndicatorAdd() like in mql5?
Most likely they wont :) they have already declined suggestion in simular request with Server time offset which exist in mql5 but not iin mql4. And they wont because if they will add all + of mql5 to mql4, noone will chose mql5 anymore! 
eevviill7
20350
eevviill7  
Georgiy Liashchenko:
Most likely they wont :) they have already declined suggestion in simular request with Server time offset which exist in mql5 but not iin mql4. And they wont because if they will add all + of mql5 to mql4, noone will chose mql5 anymore! 

This? :)))))))))))))))))))))))))))

TimeGMT()

TimeGMTOffset() 

Georgiy Liashchenko
4333
Georgiy Liashchenko  
Vasyl Nosal:

This? :)))))))))))))))))))))))))))

TimeGMT()

TimeGMTOffset() 

no, this gives time difference between server and your pc local time, what i meant is a time difference between server GMT time and 0 GMT
eevviill7
20350
eevviill7  
Georgiy Liashchenko:
no, this gives time difference between server and your pc local time, what i meant is a time difference between server GMT time and 0 GMT

TimeCurrent()-TimeGMT()

Georgiy Liashchenko
4333
Georgiy Liashchenko  
Vasyl Nosal:

TimeCurrent()-TimeGMT()

that works only if you make ea particularly for your time zone

eevviill7
20350
eevviill7  
Georgiy Liashchenko:

that works only if you make ea particularly for your time zone

No. TimeCurrent() is broker time and timeGMT is 0 GMT time

my time zone is not in calculation 

Georgiy Liashchenko
4333
Georgiy Liashchenko  
Vasyl Nosal:

No. TimeCurrent() is broker time and timeGMT is 0 GMT time

my time zone is not in calculation 

imagine a case, Server is in 0 GMT, you live in GMT+1, broker time GMT+2. TimeCurrent() returns GMT 0, because server is GMT 0, same goes for TimeGMT(). TimeLocal() returns GMT+1 or whatever time you chose on your pc. TimeGMTOffset() returns difference between GMT+1 and GMT 0 which is 1h. And there is no command to get offset between GMT 0 and broker time. Which would be equal 2h. In other words, there is no command, which would tell us for how many hours the time has shifted.

Why do we need this? For strategies based on predifined time events, like Trading sessions, news and etc. Where you want ea automatically adjust to any timezone or broker time.

Georgiy Liashchenko
4333
Georgiy Liashchenko  

This was a service desk reply

"Is there a way in mql4 to add indicator to a chart from within EA without using templates?"

There is no way. And we don't have plans to add ChartIndicatorAdd() in MQL4 

Alain Verleyen
36131
Alain Verleyen  
Georgiy Liashchenko:
Thanks, it has worked now, but it works only from second attemp. If i start ea, indicator call returns error fail to open / .ex4[123]. If the ea is already attached to a chart and i try to re attach it, then it works. How this can be solved?

I don't have this problem (with the code I posted).

Check that hWnd is different from 0.

You can also try to increase the sleep value to 50 or 100.

Sleep(100);
Georgiy Liashchenko
4333
Georgiy Liashchenko  
Alain Verleyen:

I don't have this problem (with the code I posted).

Check that hWnd is different from 0.

You can also try to increase the sleep value to 50 or 100.

sleep has worked, thanks
123
To add comments, please log in or register