Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator values in Multi Time Frame strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Indicator values in Multi Time Frame strategy

    Hi there,

    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.



    #2
    Hi stalt, thanks for your question.

    I attached an example that hosts a Bollinger applied to the secondary time frame for your reference.

    Note that a daily bar will only have 1 timestamp. A daily bar's timestamp is the time of closing. To get millisecond time stamps on a bar series you would need to use tick-based bars.

    Please test the script with Tick Replay enabled. This will accurately return the first tick for the daily bar that has not yet closed (when tick replay is off, the FirstTickOfBar will happen on the first real-time tick because it's literally the first tick of the bar after loading historical data).

    Please let me know if I can assist any further.
    Attached Files

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    131 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X