Hello
I feel sure that there is an answer in a post somewhere to my problem - but I cannot find it despite a search. Basically a custom indicator displays different values for one of the indicator lines (thick line, purple/Plum) when dropped onto StrategyTester in visual mode. The indicator line is using iMaOnArray. Source coude and screenshots attached. If anyone can help, or point to a post that answers this, I would be very grateful
Many thanks!
The code is below. The indicator lines 1-3 are fine. Indictor line #4 is the problem.
The Strategy Tester is designed to test Strategies (EAs) not Indicators . . . so when you place an Inddicator on a ST chart you have to consider what data the Indicator is seeing.
For example, does it get the correct value when it does this . . .
TimeHour(now)
does it get the correct value for Bars ?
The Strategy Tester is designed to test Strategies (EAs) not Indicators . . . so when you place an Inddicator on a ST chart you have to consider what data the Indicator is seeing.
For example, does it get the correct value when it does this . . .
does it get the correct value for Bars ?
Ok. I put a Comment line in the indicator to report Bars and Time(now) - both seem to report correct values, ie, Bars increases, TimeHour matches the simulated time in tester. I ran it by using a "dummy" EA that does nothing.
Sorry for being "thick", but is it incorrect use to drop custom indicators on StrategyTester charts in order to visually see what the EA I'm testing "sees"?
Ok. I put a Comment line in the indicator to report Bars and Time(now) - both seem to report correct values, ie, Bars increases, TimeHour matches the simulated time in tester. I ran it by using a "dummy" EA that does nothing.
Sorry for being "thick", but is it incorrect use to drop custom indicators on StrategyTester charts in order to visually see what the EA I'm testing "sees"?
I think it depends on how your Indicator works . . . I have Indicators that work just fine, I have other bits of code that will just not work in the Strategy Tester. The only thing that you should assume will work correctly, because it is being given the bar data generated by the Strategy tester, is an EA. Indicators may work . . . some do, but others don't. When an Indicator doesn't work it will be due to it getting data from a chart other than the one being generated in the Strategy Tester . . . in my opinion. If you can find the incorrect information that the Indicator is getting you may be able to re-code to avoid the issue.
This issue wouldn't happen with an EA in the Strategy Tester . . . . Bid would be the Bid price produced by the Strategy Tester.
now = Time[i]; sod = now - TimeHour(now)*60*60 - TimeMinute(now)*60 - TimeSeconds(now);
Can be simplifiednow = Time[i]; sod = DateOfDay(now); /////// #define HR2400 86400 // 24 * 3600 datetime TimeOfDay(datetime when){ return( when % HR2400 ); } datetime DateOfDay(datetime when){ return( when - TimeOfDay(when) ); }
now=Time[i]; TimeHour(now) is fine but Hour() would not be.- HarriMQL4:You can put CI on the chart, but remember that if the iCustom call uses different parameters than the CI, the two won't be the same. This is why I wrote my Polyline, to display the actual values the EA is getting.
Ok. I put a Comment line in the indicator to report Bars and Time(now) - both seem to report correct values, ie, Bars increases, TimeHour matches the simulated time in tester. I ran it by using a "dummy" EA that does nothing.
Sorry for being "thick", but is it incorrect use to drop custom indicators on StrategyTester charts in order to visually see what the EA I'm testing "sees"?
if(counted_bars>0) counted_bars--;
Delete that line. Bars - 1 - counted_bars is correct https://www.mql5.com/en/forum/132447if (counted_bars < avg) counted_bars = avg; limit=Bars-counted_bars-1; for(i=limit; i>=0; i--) ma[i] = iMAOnArray(maInd, 0, prd, 0, MODE_EMA, i);
prd not avg
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I feel sure that there is an answer in a post somewhere to my problem - but I cannot find it despite a search. Basically a custom indicator displays different values for one of the indicator lines (thick line, purple/Plum) when dropped onto StrategyTester in visual mode. The indicator line is using iMaOnArray. Source coude and screenshots attached. If anyone can help, or point to a post that answers this, I would be very grateful
Many thanks!
The code is below. The indicator lines 1-3 are fine. Indictor line #4 is the problem.