Also an intresting thing -
it doesn't work only when I choose another indicator in the tester.
What I mean is that I test a working INDICATOR-1 in the tester but have displayed also INDICATOR-2 which has problems described in the previous post.
If I choose INDICATOR-2 in the tester it works with no problems...
It makes it even more difficult to understand for me...
while(15>=0)
What do you mean?
barNumber=Bars-counted_bars-1;
After first iteration of code barNumber becomes small numer. And you chek always 0 or 1 bar only.
while(15>=0)
I tested your code from the first post in the strategy tester and on a live chart.
The values change every tick.
That will always be true, so the while loop can only be exited with a break.
I mean int barNumber=15;
:))
barNumber=Bars-counted_bars-1;
After first iteration of code barNumber becomes small numer. And you chek always 0 or 1 bar only.
But this is what I want to do I guess? I am on live data so I'm interested only in bar 0 from M15 and H1 interval? The problem is that time changes but RSI for bar 0 for H1 doesn't. Why in int barNumber=15 do you have 15? Is it some magic number?:)
I tested your code from the first post in the strategy tester and on a live chart.
The values change every tick.
It really does... but only if you choose that indicator in the tester. If I test another indicator and have this visible on the chart it doesn't change... This is what I explained in my second post. It's very strange. I can send you a screenshot later that will maybe better illustrate what I mean.
Anyway thanks guys.
It really does... but only if you choose that indicator in the tester. If I test another indicator and have this visible on the chart it doesn't change... This is what I explained in my second post. It's very strange. I can send you a screenshot later that will maybe better illustrate what I mean.
Anyway thanks guys.
It has been reported in a number of topics that multi timeframe indicators do not display properly when attached to a chart in the tester. However, in my experience an EA that calls the indicator and then prints the value will get the correct value.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to get RSI value from H1 when I am on other intervals like M15.
I have a following snippet of code in onCalculate method:
int barNumber=Bars-counted_bars-1;
while(barNumber>=0)
{
int h1BarNumber=iBarShift(Symbol(),PERIOD_H1,Time[barNumber]);
double rsi=iRSI(Symbol(),PERIOD_H1,rsiPeriod,apply_to,h1BarNumber);
Print("H1 barNumber: " + h1BarNumber +", RSI: "+ rsi);
barNumber--;
}
When I run this code in the tester for M15 interval I always see in the console that the same value of RSI gets printed on live data even when it goes through several days, like:
H1 barNumber: 0, RSI: 72.3215423
H1 barNumber: 0, RSI: 72.3215423
H1 barNumber: 0, RSI: 72.3215423
For the history it works nice, I get a proper value, it just doesn't work in the tester and on live data. Just to add on live data I am interested on the current bar of H1 so I imagine the value should change with every tick.
What am I doing wrong?