Hi, i'm working on custom indicator but when i added ChartIndicatorAdd that doesn't work on strategy tester, but that's work fine on the main MT5 program.
Here is a sample code:
Is there something wrong in this code ?
if you mean you want the indicator to be visually present then you have to load it manually on the chart.
The indicators are not visually present in the tester because it slows down the speed of testing.
Thanks Marco for your answer.
Do you mean that it's possible to load manually an indicator on strategy tester ? How ?
What is the error code ?
Indicators are automatically added by the Strategy Tester.
You can't add indicator manually with MT5 but you can use template.
I have the same problem. Eager to know the solution.
In my opinion, your code has no problem. It seems that Strategy Tester does not support an indicator loads another indicator. Avoid this way.
I looked into this problem deeply, have got conclusions as below.
1. My scenario is that EA loads indicator A and in turns indicator A loads indicator B. Use ChartIndicatorAdd to show the indicators. It works well but does not work well in the circustance of Strategy Tester. In Strategy Tester, indicator A shows up, but indicator B never shows up.
2. the calls to ChartIndicatorAdd always return success. However, ChartIndicatorName() can't return the newly added name, ChartIndicatorsTotal() returns 0.
3. My work-around way is that EA load indicator A and indicator B in OnInit() process. Indicator A searches the handle of indicator B in the event of OnCalcute() for the first time. it shouldn't be done in the event of OnInit(). This work-around works well.
I'm have similar problem. What happens it that sometimes B finds A, sometimes not. ChartIndicatorAdd always returns true, but I can't visualize it on the chart.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.