Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Not Plotting In Live Mode

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

    Not Plotting In Live Mode

    Hi,
    I tried the following but observed that it was not plotted live. I have to reload the indicator then it started to show on chart.Advice needed. Thanks!

    #region Using declarations
    using System;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Xml.Serialization;
    using NinjaTrader.Cbi;
    using NinjaTrader.Data;
    using NinjaTrader.Gui.Chart;
    #endregion
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {


    /// </summary>
    [Description("Breakout System")]
    public class NTMTSGetBarUS : Indicator
    {
    #region Variables
    // Wizard generated variables
    // User defined variables (add any user defined variables below)

    private bool RedBars;

    private double op01;

    #endregion
    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {

    Add (PeriodType.Minute,30);

    CalculateOnBarClose = false;
    Overlay = true;
    PriceTypeSupported = false;

    }

    private DateTime startDateTime01;
    private DateTime endDateTime01;

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()

    {
    startDateTime01 = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 13, 00, 0);
    endDateTime01 = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 13, 30, 0);

    int startBarsAgo01 = GetBar(startDateTime01);
    int endBarsAgo01 = GetBar( endDateTime01);

    if(BarsInProgress ==1)

    if( ToTime(Time[0]) == 133000 )
    {
    op01 = Open[0];
    }

    DrawLine("Rega01", false, startBarsAgo01, op01 , endBarsAgo01 ,op01, Color.Pink, DashStyle.Dot, 3);

    {
    if (ToTime(Time[0]) >= 80000 && ToTime(Time[0]) < 83000 ||
    ToTime(Time[0]) >= 90000 && ToTime(Time[0]) < 93000 ||
    ToTime(Time[0]) >= 100000 && ToTime(Time[0]) <103000 ||
    ToTime(Time[0]) >= 110000 && ToTime(Time[0]) <113000 ||
    ToTime(Time[0]) >= 120000 && ToTime(Time[0]) <123000 ||
    ToTime(Time[0]) >= 130000 && ToTime(Time[0]) <133000 ||
    ToTime(Time[0]) >= 140000 && ToTime(Time[0]) <143000 ||
    ToTime(Time[0]) >= 150000 && ToTime(Time[0]) <153000 ||
    ToTime(Time[0]) >= 160000 && ToTime(Time[0]) <163000 ||
    ToTime(Time[0]) >= 170000 && ToTime(Time[0]) <173000 ||
    ToTime(Time[0]) >= 180000 && ToTime(Time[0]) <183000 ||
    ToTime(Time[0]) >= 190000 && ToTime(Time[0]) <193000 ||
    ToTime(Time[0]) >= 200000 && ToTime(Time[0]) <203000 ||
    ToTime(Time[0]) >= 210000 && ToTime(Time[0]) <213000 ||
    ToTime(Time[0]) >= 220000 && ToTime(Time[0]) <223000 )



    {RedBars = true;} else RedBars = false;
    if (RedBars) BarColor = Color.Yellow;
    }


    }
    #region Properties

    #endregion
    }
    }
    #region NinjaScript generated code. Neither change nor remove.
    // This namespace holds all indicators and is required. Do not change it.
    namespace NinjaTrader.Indicator
    {
    public partial class Indicator : IndicatorBase
    {
    private NTMTSGetBarUS[] cacheNTMTSGetBarUS = null;
    private static NTMTSGetBarUS checkNTMTSGetBarUS = new NTMTSGetBarUS();
    /// <summary>
    /// Breakout System
    /// </summary>
    /// <returns></returns>
    public NTMTSGetBarUS NTMTSGetBarUS()
    {
    return NTMTSGetBarUS(Input);
    }
    /// <summary>
    /// Breakout System
    /// </summary>
    /// <returns></returns>
    public NTMTSGetBarUS NTMTSGetBarUS(Data.IDataSeries input)
    {
    if (cacheNTMTSGetBarUS != null)
    for (int idx = 0; idx < cacheNTMTSGetBarUS.Length; idx++)
    if (cacheNTMTSGetBarUS[idx].EqualsInput(input))
    return cacheNTMTSGetBarUS[idx];
    lock (checkNTMTSGetBarUS)
    {
    if (cacheNTMTSGetBarUS != null)
    for (int idx = 0; idx < cacheNTMTSGetBarUS.Length; idx++)
    if (cacheNTMTSGetBarUS[idx].EqualsInput(input))
    return cacheNTMTSGetBarUS[idx];
    NTMTSGetBarUS indicator = new NTMTSGetBarUS();
    indicator.BarsRequired = BarsRequired;
    indicator.CalculateOnBarClose = CalculateOnBarClose;
    #if NT7
    indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
    indicator.MaximumBarsLookBack = MaximumBarsLookBack;
    #endif
    indicator.Input = input;
    Indicators.Add(indicator);
    indicator.SetUp();
    NTMTSGetBarUS[] tmp = new NTMTSGetBarUS[cacheNTMTSGetBarUS == null ? 1 : cacheNTMTSGetBarUS.Length + 1];
    if (cacheNTMTSGetBarUS != null)
    cacheNTMTSGetBarUS.CopyTo(tmp, 0);
    tmp[tmp.Length - 1] = indicator;
    cacheNTMTSGetBarUS = tmp;
    return indicator;
    }
    }
    }
    }
    // This namespace holds all market analyzer column definitions and is required. Do not change it.
    namespace NinjaTrader.MarketAnalyzer
    {
    public partial class Column : ColumnBase
    {
    /// <summary>
    /// Breakout System
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.NTMTSGetBarUS NTMTSGetBarUS()
    {
    return _indicator.NTMTSGetBarUS(Input);
    }
    /// <summary>
    /// Breakout System
    /// </summary>
    /// <returns></returns>
    public Indicator.NTMTSGetBarUS NTMTSGetBarUS(Data.IDataSeries input)
    {
    return _indicator.NTMTSGetBarUS(input);
    }
    }
    }
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    public partial class Strategy : StrategyBase
    {
    /// <summary>
    /// Breakout System
    /// </summary>
    /// <returns></returns>
    [Gui.Design.WizardCondition("Indicator")]
    public Indicator.NTMTSGetBarUS NTMTSGetBarUS()
    {
    return _indicator.NTMTSGetBarUS(Input);
    }
    /// <summary>
    /// Breakout System
    /// </summary>
    /// <returns></returns>
    public Indicator.NTMTSGetBarUS NTMTSGetBarUS(Data.IDataSeries input)
    {
    if (InInitialize && input == null)
    throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
    return _indicator.NTMTSGetBarUS(input);
    }
    }
    }
    #endregion
    Attached Files

    #2
    Hello m. khalid,

    I'm not sure if this is causing it, but there's not curly brackets { } for the if statement highlighted below.




    if(BarsInProgress ==1)

    if( ToTime(Time[0]) == 133000 )
    {
    op01 = Open[0];
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hi Ryan,
      (1) I've checked and comfirmed the right bracket was used.
      (2) My objective is to access 30 minute OPEN then show on 1 range bar chart by using multi time series method.

      Comment


        #4
        I would start simple. See the following reference sample which is a little closer to what you're looking for:
        Getting indicator values from a specified time

        Get the open value for one series, verify it's the value you expect, and then start working on getting this value into a multiseries indicator.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi Ryan,
          I tried to download the sample script but error encounted.
          Attached Files

          Comment


            #6
            Can you please try the one attached? This should import well on NT7, too - thanks.
            Attached Files

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            603 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            349 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            104 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            560 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X