I have a problem with, I guess, the resolution in my real time scanner. I am using a study which counts up and down days, and it works fine with daily data. A screen shot is attached. When I use this study in the scanner, it starts counting up and down ticks – even though my resolution is set to days.
I observe that other daily studies, like RSI, will compute on a daily basis even as they adjust the current day based on the latest tick. My study doesn’t behave that way. What am I doing wrong?
How to Ensure Resolution is 1 Day?
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: How to Ensure Resolution is 1 Day?
Do you might have your indicator set to 'Update on every tick'? Setting that setting on will force the indicator to recalculate on every incoming tick, while that setting off will only calculate the indicator on bar close (i.e. once a day with daily data).I have a problem with, I guess, the resolution in my real time scanner. I am using a study which counts up and down days, and it works fine with daily data. A screen shot is attached. When I use this study in the scanner, it starts counting up and down ticks – even though my resolution is set to days.
You can also control this in the code, like this:
Code: Select all
namespace PowerLanguage.Indicator
{
[UpdateOnEveryTick(false)] // No updating on every tick, just on bar close
public class Example : IndicatorObject
{
public Example(object _ctx):base(_ctx){}
protected override void Create()
{
}
protected override void StartCalc()
{
}
protected override void CalcBar()
{
}
}
}
Re: How to Ensure Resolution is 1 Day?
Thanks for the quick response, Josh. I can also set that flag on the properties sheet in the scanner. It has the effect of freezing the study with yesterday’s data. So, you are correct, but I want the current value of the study.
To clarify … think about a 10 day simple moving average. This study changes during the day, as each tick updates the tenth value in the average, but the other nine values don’t change. It updates with each tick, but it only updates the current day.
So, for my Streak study … if we were up the last three days, it’s +3. Based on today’s intraday price, it might be up to +4. Instead, I have +22 because it’s counting ticks not days.
To clarify … think about a 10 day simple moving average. This study changes during the day, as each tick updates the tenth value in the average, but the other nine values don’t change. It updates with each tick, but it only updates the current day.
So, for my Streak study … if we were up the last three days, it’s +3. Based on today’s intraday price, it might be up to +4. Instead, I have +22 because it’s counting ticks not days.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: How to Ensure Resolution is 1 Day?
I don't follow you here. Do you mean that your indicator recalculates the values for all previous x bars (and not only the recent)? If so, you have a coding error I suppose (loop somewhere?). But without posting code, we can only speculate.To clarify … think about a 10 day simple moving average. This study changes during the day, as each tick updates the tenth value in the average, but the other nine values don’t change. It updates with each tick, but it only updates the current day.
At the risk of stating the obvious, have you tried to calculate your indicator only on bar close?
Code: Select all
if (Bars.Status == EBarState.Close)
{
// On bar close
}