MT4 Expert Advisor EA issue with updating price for offline chart

MT4 Expert Advisor EA issue with updating price for offline chart

Manage alerts

Loading saved threads...

YUSUF KIPROP · External communityPost link
External question — Stack Overflow Stack Exchange Author: YUSUF KIPROP Original post: https://stackoverflow.com/questions/69953155 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. The following script uses a timer and works well in normal charts to comment current candle closing price every 1 second on chart. However, on offline chart, it only loads the closing price once and does not update it every second. Here is the code: void OnTimer() { int m=TimeSeconds(TimeLocal()); double CloseValue = Close[0]; //Current Candle Close Value string CloseValueString = DoubleToString(CloseValue,5); //Current price Comment( "Current value :",CloseValueString,"\n", "Candle time :",m ); }
Quote
Report
YUSUF KIPROP · External communityPost link
External answer — Stack Overflow Stack Exchange Author: YUSUF KIPROP Original post: https://stackoverflow.com/a/69956795 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. Solved by adding the Refreshrates() function which updates data for the offline chart at the end of my function: void OnTimer() { int m=TimeSeconds(TimeLocal()); double CloseValue = Close[0]; //Current Candle Close Value string CloseValueString = DoubleToString(CloseValue,5); //Current price Comment( "Current value :",CloseValueString,"\n", "Candle time :",m ); RefreshRates(); }
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: YUSUF KIPROP Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/69953155 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. The following script uses a timer and works well in normal charts to comment current candle closing price every 1 second on chart. However, on offline chart, it only loads the closing price once and does not update it every second. Here is the code: void OnTimer() { int m=TimeSeconds(TimeLocal()); double CloseValue = Close[0]; //Current Candle Close Value string CloseValueString = DoubleToString(CloseValue,5); //Current price Comment( "Current value :",CloseValueString,"\n", "Candle time :",m ); }

Cancel quote

Checking account access…