Here is what I am doing and why.
NT Support, please don't just send the links to the sample code. I have used the ones you sent, read the manuals.. they are either not complete or not complex enough of an example for me to fully understand things.
Strategy premise is fairly simple: Use a long time frame (DAILY bars) for direction using CCI and trend lines, shorter time frames for trade execution (30 MINUTE bars).
I am asking about 2 options:
OPTION 1: Calculate ALL the second series indicators in the primary data stream (IE: Calcuate the DAILY CCI in the 30 MINUTE time frame - in BarsInProgress==0 (I do want to know the CURRENT value for the CCI in Daily
CODE SNIPPITS:
1) #region Variables
private Series<double> CCIData_1; // holds the CCI data for TF1
2) protected override void OnStateChange()
{
if (State == State.SetDefaults)
// standard defaults
BarsRequiredToPlot = 20;
CCIPeriod = 6;
2) else if (State == State.Configure)
//Add the second data series here
AddDataSeries(Data.BarsPeriodType.Day, 1);
3) else if (State == State.Historical)
/* Syncs another DataSeries object to the secondary bar object.
We use an arbitrary indicator overloaded with an ISeries<double> input to achieve the sync.
The indicator can be any indicator. The Series<double> will be synced to whatever the
BarsArray[] is provided.
*/
QUESTION: NT - Given Option 1 below, do I need to do this step IF the DAILY (second series) is calculated in BarsInProgress==0 ?
CCIData_1 = new Series<double>(SMA(BarsArray[1], 50));
4) protected override void OnBarUpdate()
{
if ((CurrentBars[0] <= BarsRequiredToPlot) ||
(CurrentBars[1] <= BarsRequiredToPlot))
return;
This is standard, but
OPTION 1: Calculate all DAILY indicators on every TICK (or IsFirstTickOfBar)
if(BarsInProgress == 0)
{
CCIData_1[0] = CCI(BarsArray[1], CCIPeriod)[0];
// this would give me the most up to date value for the DAILY CCI
ISSUE: NT Support - this is NOT working correctly - Even at end of day, I get a different value for the calculated value for CCI using this method, than I do on a chart where I just add the indicator to the daily chart. The numbers are NOT the same.
OPTION 2: Calculate ALL DAILY indicators in BarsInProgress==1, then reference the data in BarsInProgress==0
else if(BarsInProgress == 1)
{
CCIData_1[0] = CCI(BarsArray[1], CCIPeriod)[0];
// this way would calculate the CCI only on ticks in BIP1, rather than the more frequent ticks of BIP0. You could reference CCIData_1[0] in BIP0.
QUESTION 1) What is the best practises on using multiple time frames? Should we use the fastest time frame in BIP0? (I have typically tried to put it fastest (BarsInProcess==0) to slowest time frame (BarsInProcess==1)
QUESTION 2) Am I doing all the right things here? Do most people use Option 1 or Option 2?
Comment