I have developed a strategy that runs on daily bars. I have coded it to do what I want it to do and it executes trades in the Strategy Analyzer as I would expect. It primarily uses Bollinger bands and looks for multiple closes below the Bollinger bands and then looks to enter on a close above the lower band.
In version 2 of this strategy I have added a second data series (1 minute) and am working on a Draw.ArrowDown and a Draw.Text alert to appear at the end of the trading day BEFORE the trade executes at the open the following morning.
I have set the Calculate to OnPriceChange
I have added the following code to get the close of the 3:59 bar as an approximation of the close.
if (BarsInProgress == 1)
{
if (IsFirstTickOfBar)
{
if(ToTime(Time[0]) >92900
&&
ToTime(Time[0]) <155900)
{
EOD=false;
}
else if (ToTime(Time[0]) >=155900)
{
EOD=true;
}
if (EOD==true)
{
LastMinuteClose = Close[0];
Print(Time[0]+"The current 5 minute close is : " + LastMinuteClose);
}
The problem I am having is getting the Bollinger Band Values for the current day (based on the daily time frame) at the 3:59 time stamp as they should be on the daily bars(if calculating OnPriceChange) and not on the Close of the daily bar.
Once I have the LastMinuteBar price I would like to compare it to the Daily Lower Bollinger Band price for today calculated at 3:59, not the day prior.
I have tried several methods and have used a print in the IsFirstTickOfBar on the one minute bar series including a data series and a bars array, but It only seems to reference the prior day Lower Bollinger Band value calculated at the close of the prior days bar. The Value for each 1 minute bar matches the close of the prior daily bar BB.Lower value
I have reviewed this thread: https://ninjatrader.com/support/foru...ng-minute-data
and this thread: https://ninjatrader.com/support/foru...aily-bar-close
The first thread though for Ninja 7 would seem to indicate the indicator logic has to be loaded in both time frames to get these values calculated. I am not exactly sure how to load the bollinger band indicator in the 1 minute Bars in Progress, but have it calculate the daily bar value OnPriceChange. The second thread seems to indicate adding this secondary time frame is the way to go.
I am clearly missing something here. Any help would be appreciated.
Comment