Here is the problem I'm trying to solve:
I have 2 periods in my strategy: daily and minute.
Every day (in the MINUTE period), right before market close (ie 2:15pm) I'd like to compute the next value of the DAILY MACD chain, ie. compute MACD based off all prior daily values and then the values at 2:15pm instead of waiting for the session close at 2:30pm. That way I could exit a position before waiting for the next morning.
I cannot use CalculateOnBarClose=false as other parts of my strategy rely on keeping that true.
I am very able with C# and have worked some with Bars/IBar etc, so I just need to know the easiest way to do this.
Thanks, help is much appreciated.
EDIT:
Here is what I've tried:
Bars test =BarsArray[dailyBars];
int index=0;
DateTime lastTime = test.Get(0).Time;
for (int i=0; i<test.Count; i++)
{
if (test.Get(i).Time > lastTime && test.Get(i).Time<Time[0] && test.Get(i).Time.Day!=Time[0].Day)
{
lastTime = test.Get(i).Time;
index=i;
}
}
Bars evalBars = new Bars(test.Instrument,test.Period,test.From,Time[0],test.SplitAdjusted,test.DividendAdjusted);
for (int i=0; i<index; i++)
{
evalBars.Add(test.Get(i).Open,test.Get(i).High,test.Get(i).Low,test.Get(i).Close,test.Get(i).Time,test.Get(i).Volume,1,false);
}
IBar sampleBar = test.Get(index);
Print("LAST: OPEN: " + sampleBar.Open + " HIGH: " + sampleBar.High + " LOW: " + sampleBar.Low + " CLOSE: " + sampleBar.Close + " TIME: " +sampleBar.Time.ToString() + " VOL: "+sampleBar.Volume);
Print("NEW: OPEN: "+ CurrentDayOHL().CurrentOpen[0] + " HIGH: " + CurrentDayOHL().CurrentHigh[0] + " LOW: " + CurrentDayOHL().CurrentLow[0] + " CLOSE: " + Close[0] + " TIME: " +Time[0].ToString() + " VOL: "+volumeCount);
Print("EVAL COUNT: " + evalBars.Count);
Print("Daily COUNT: " + test.Count);
evalBars.Add(CurrentDayOHL().CurrentOpen[0],CurrentDayOHL().CurrentHigh[0],CurrentDayOHL().CurrentLow[0],Close[0],Time[0],volumeCount,1,false);
Then use MACD(evalBars,etc,etc,etc) to compare...

Comment