- Anyone know how to develop a multicurrency indicator ?
- MT5 terminal updated today and the "Optimisation" window does not show up during the test
- How to change, that Tester only uses one year of history before start?
In its simplest form it is just a matter for detecting the currency pair and assigning the comment you want - e.g:
string strComment = ""; if(_Symbol == "GBPUSD") { strComment = "USD comment"; } else if(_Symbol == "USDJPY") { strComment = "JPY comment"; } Comment(strComment);
I have an EA in mql5 that I launch from a single graph and, from it, it operates several pairs.
How can I refer to those other graphs to be able to put a Comment() on them?
Forum on trading, automated trading systems and testing trading strategies
Creating objects on multiple charts
Fernando Carreiro, 2023.10.31 01:00
To be able to add graphical objects for other symbols (i.e. other charts), you would need to ...
- Scan all open charts, using ChartFirst and ChartNext to find the one you wish to use (i.e. the desired symbol, time-frame, etc.). There may be more than one or none at all.
- If none exist, then you would have to open up a new chart for the desired symbol.
- Once you have identified the desired chart id, then you can add graphical objects to that chart.
Forum on trading, automated trading systems and testing trading strategies
How can I draw a simple moving average on a newly created chart?
Fernando Carreiro, 2023.10.12 07:22
The Comment function always applies to the current chart. As you can see from the documentation, it does not have any parameter for selecting a target chart.
However, if you read the Comment documentation, you will notice that it instructs you to also read about ChartSetString and ChartGetString.
So, instead of Comment, use the ChartSetString function with CHART_COMMENT property.
Sets the string value for a corresponding property of the specified chart
ID
Description
Property Type
Text of a comment in a chart
string
I have an EA in mql5 that I launch from a single graph and, from it, it operates several pairs.
How can I refer to those other graphs to be able to put a Comment() on them?
An EA doesn't "operate on a graph", neither one or several, it "operates" on one symbol or several symbols and it runs on a chart.
I guess you are talking about the Strategy Tester ?
If yes there is no way to draw/add anything to the additional charts. If not then Fernando gives you the solution.
Thank you very much Fernando, I already have it active, visualizing the comment with ChartSetString.
Juan.
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use