vaeVictis:
And how can I add Time in a human readable format?
I can not figure out how to do it.
- Perhaps you should read the manual.
Converting a value containing time in seconds elapsed since 01.01.1970 into a string of "yyyy.mm.dd hh:mi" format.
Conversion Functions / TimeToString - Reference on algorithmic/automated trading language for MetaTrader 5 - You haven't stated a problem, you stated a want.
Show us your attempt
(using CODE button) and state
the nature of your problem.
No free help
urgent help.
for(int i = 0; i <= Window ; i++ ) { PrintFormat("Open:%g, Close:%g, High:%g, Low:%g, Time:%s", Open[i], Close[i], High[i], Low[i], TimeToStr(Time[i])); }
I am sorry. I'll follow your directives.
So, I have this code inside the function onInit. This correctly prints the values of a "Window" number of candles in the correct time order (am I right it is the correct time order and not the reverse one?)
I have a question: how can I update and print the new candlestick's values when it is completly formed? I suppose I must write something inside the function onTick, but I need some help.
Thank you :)
I am thinking about something like this, but I need some feedback since it is my first EA.
void OnTick(){ //--- static datetime oldTime; datetime newTime = iTime(_Symbol,PERIOD_CURRENT,0); if(newTime!=oldTime){ oldTime=newTime; prices = StringFormat("Open:%g, Close:%g, High:%g, Low:%g, Time:%s", iOpen(_Symbol,PERIOD_CURRENT,0), iClose(_Symbol,PERIOD_CURRENT,0), iHigh(_Symbol,PERIOD_CURRENT,0), iLow(_Symbol,PERIOD_CURRENT,0), TimeToStr(iTime(_Symbol,PERIOD_CURRENT,0))); //more code which uses prices }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everybody
I am trying to write my very first EA and I need some help with printing open and close values of the last five candlesticks in reverse orders.
And how can I add Time in a human readable format?
I can not figure out how to do it.
Many thanks in advance :)