This is a technical forum. If you want any help, you need to provide all the evidence you can so that moderators and other readers can see what you are on about.
Typical evidence at a minimum is posting of the exact code that you used to come to your conclusions. If your scenario is replicable, then, moderators will forward a bug report onto the devs.
First, i noted that A and B have the same indicator handle value, that is 10. Is it expected behaviour?
More, adding B to chart with ChartIndicatorAdd(0,0,B) is not working (B is not added to chart) in Strategy Tester, how can i do it?
Try to use ChartID() instead of 0.
Hi, i'm simply asking if it is expected behaviour or not.
Already answered.
First, i noted that A and B have the same indicator handle value, that is 10. Is it expected behaviour?
Hi Alain, when I posted I haven't seen your answer.
Ok, i understand each mql program has its own set of handles value. So no problem here.
About adding ChartIndicatorAdd, yes, i tried with ChartId() but nothing changes. I found a very old thread having my same problem: https://www.mql5.com/en/forum/98373
I'm trying to do the same stuff in that old thread. So summarizing the problem on TESTER:
- inside EA, i call iCustom of A, add A to chart using ChartIndicatorAdd. A call B using iCustom, but i can't be able to add B to chart, because chartIndicatorAdd does not work, no error from the function, using ChartID() not help.
- i also tried changing logic: inside EA i call iCustom of B, then i call iCustom of A, add both to chart using ChartIndicatorAdd, working correctly. But the call of iCustom of B inside A, instead of use already existant instance of B created in EA, create an other instance! So I have two instances of B, having same properties, symb, period etc, and this seems to be a bug. I can figure out that I have two instances of B because I can see in the tester journal double logs.
- 2016.10.20
- www.mql5.com
Hi Alain, when I posted I haven't seen your answer.
Ok, i understand each mql program has its own set of handles value. So no problem here.
About adding ChartIndicatorAdd, yes, i tried with ChartId() but nothing changes. I found a very old thread having my same problem: https://www.mql5.com/en/forum/98373
I'm trying to do the same stuff in that old thread. So summarizing the problem on TESTER:
- inside EA, i call iCustom of A, add A to chart using ChartIndicatorAdd. A call B using iCustom, but i can't be able to add B to chart, because chartIndicatorAdd does not work, no error from the function, using ChartID() not help.
- i also tried changing logic: inside EA i call iCustom of B, then i call iCustom of A, add both to chart using ChartIndicatorAdd, working correctly. But the call of iCustom of B inside A, instead of use already existant instance of B created in EA, create an other instance! So I have two instances of B, having same properties, symb, period etc, and this seems to be a bug. I can figure out that I have two instances of B because I can see in the tester journal double logs.
EA
int OnInit() { int B = iCustom(_Symbol,_Period, "B"); ChartIndicatorAdd(0,0,B); int A = iCustom(_Symbol,_Period, "A"); ChartIndicatorAdd(0,0,A); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { } void OnTick() { }
A
#property indicator_chart_window int OnInit() { int B = iCustom(_Symbol,_Period, "B"); return(INIT_SUCCEEDED); } int OnCalculate(const int32_t rates_total, const int32_t prev_calculated, const int32_t begin, const double &price[]) { return(rates_total); }
B
#property indicator_chart_window int OnInit() { return(INIT_SUCCEEDED); } int OnCalculate(const int32_t rates_total, const int32_t prev_calculated, const int32_t begin, const double &price[]) { if(prev_calculated<rates_total) Print("B ["+GetMicrosecondCount()+"]-> "+prev_calculated+"/"+rates_total); return(rates_total); }
Testing EA in Strategy Tester, you can see double logs from B, i suppose two instances of B was created, and it should not happen.
Weird stuff, testing this simple code, i now also have same (wrong) behavior in terminal chart too...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
First, i noted that A and B have the same indicator handle value, that is 10. Is it expected behaviour?
More, adding B to chart with ChartIndicatorAdd(0,0,B) is not working (B is not added to chart) in Strategy Tester, how can i do it?
Thanks