Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator doesn't work unless tab is selected

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

    Indicator doesn't work unless tab is selected

    If I have a chart with 2 tabs(same instrument), it appears that if I have tab1 selected then the indicators on tab1 will function correctly.

    If I select tab2 that has no indicators then the indicator on tab 1 stops functioning.

    if I wait a while and select tab1 again then it appears that the indicator catches up from where it left off.

    I also notice the same thing if I switch between OPEN workspaces.

    Is this as designed???



    Tab1 has the indicator below that prints to the output window, alert window and a txt file. I tried the same thing with just the output window OR alert OR txt file. Same result.

    Tab2 has no indicators.


    public class PKTestTab1 : Indicator
    {
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Indicator here.";
    Name = "PKTestTab1";
    Calculate = Calculate.OnPriceChange;
    IsOverlay = true;
    DisplayInDataBox = true;
    DrawOnPricePanel = true;
    DrawHorizontalGridLines = true;
    DrawVerticalGridLines = true;
    PaintPriceMarkers = true;
    ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right;
    //Disable this property if your indicator requires custom values that cumulate with each new market data event.
    //See Help Guide for additional information.
    IsSuspendedWhileInactive = true;
    }
    else if (State == State.Configure)
    {
    }
    }

    protected override void OnBarUpdate()
    {

    Print(Time[0] + " \t" + Instrument.FullName + "\tPrice=" + Close[0]);

    NinjaTrader.NinjaScript.Alert.AlertCallback(NinjaT rader.Cbi.Instrument.GetInstrument(Instrument.Mast erInstrument.Name), this, Instrument.MasterInstrument.Name + CurrentBar, NinjaTrader.Core.Globals.Now, Priority.Low, Time[0] + " \t" + this.GetType().Name + " \t" + " Print Line." + Time[0] + " " + Close[0] , NinjaTrader.Core.Globals.InstallDir + @"\sounds\Alert1.wav", new SolidColorBrush(Colors.Blue), new SolidColorBrush(Colors.White), 0);

    File.AppendAllText(@"C:\Test.txt", Time[0] + " " + Close[0] + "\r\n");

    }
    }



    So say I select Tab1 for a while, I will get the following:

    8/2/2019 12:44:50 PM NFLX Price=315.2
    8/2/2019 12:45:00 PM NFLX Price=315.31
    8/2/2019 12:45:00 PM NFLX Price=315.35
    8/2/2019 12:45:00 PM NFLX Price=315.34
    8/2/2019 12:45:00 PM NFLX Price=315.3
    8/2/2019 12:45:00 PM NFLX Price=315.38
    8/2/2019 12:45:00 PM NFLX Price=315.39
    8/2/2019 12:45:00 PM NFLX Price=315.3
    8/2/2019 12:45:00 PM NFLX Price=315.29
    8/2/2019 12:45:10 PM NFLX Price=315.29
    8/2/2019 12:45:10 PM NFLX Price=315.27
    8/2/2019 12:45:10 PM NFLX Price=315.23
    8/2/2019 12:45:10 PM NFLX Price=315.26
    8/2/2019 12:45:10 PM NFLX Price=315.23
    8/2/2019 12:45:10 PM NFLX Price=315.19
    8/2/2019 12:45:10 PM NFLX Price=315.09
    8/2/2019 12:45:20 PM NFLX Price=315.27

    If I select Tab 2 I get nothing.

    If I wait a while and select Tab1 it catches up with what it missed.

    8/2/2019 12:45:50 PM NFLX Price=315.27
    8/2/2019 12:46:00 PM NFLX Price=315.29
    8/2/2019 12:46:10 PM NFLX Price=315.45
    8/2/2019 12:46:20 PM NFLX Price=315.45
    8/2/2019 12:46:30 PM NFLX Price=315.53
    8/2/2019 12:46:40 PM NFLX Price=315.45
    8/2/2019 12:46:50 PM NFLX Price=315.51
    8/2/2019 12:47:00 PM NFLX Price=315.54
    8/2/2019 12:47:10 PM NFLX Price=315.59
    8/2/2019 12:47:10 PM NFLX Price=315.6
    8/2/2019 12:47:10 PM NFLX Price=315.62
    8/2/2019 12:47:10 PM NFLX Price=315.63
    8/2/2019 12:47:20 PM NFLX Price=315.6
    8/2/2019 12:47:20 PM NFLX Price=315.63
    8/2/2019 12:47:20 PM NFLX Price=315.66


    That means that I won't get any alerts or if I draw something on Tab2 then a custom indicator that looks at drawn objects on Tab1 won't see it until I switch back.

    SO BUG OR AS DESIGNED??????

    thx,
    Peter

    #2
    Hello pkinoc,

    Thanks for your post,

    The behavior you are observing is expected and is controlled by the code line "IsSuspendedWhileInactive = true;" in your indicator.

    Please review the help guide here for clarity of this: https://ninjatrader.com/support/help...leinactive.htm

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      I guess that's the default when an indicator is created.

      Is there a problem setting that to false other than requiring more CPU?

      Thx,
      peter

      Comment


        #4
        Hello Peter,

        Thanks for your reply.

        Correct that is the default and as the help guide advises it is just a way to conserve resources.

        There would be no issues setting that to false if that is what you need.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          One last question, is there a way to not suspend a MarketAnalyzer custom column if it is in a workspace and you switch to another workspace for a while.

          I don't see IsSuspendedWhileInactive as an option.

          I still want alerts to be generated from a MarketAnalyzer in an open workspace if I am in a different workspace.

          Thx,
          Peter

          Comment


            #6
            Hello Peter,

            Thank you for your reply.

            I was able to test and confirm that you'd still be alerted. Here's a test you can try to confirm this:

            Open a Market Analyzer and set a basic alert on a column and set it to alert you with a popup. Open a second workspace and wait. Your alert should eventually be triggered; you may want to use the Simulated data feed for this so you can control market direction in such a way that it should set off your alert.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by pechtri, 06-22-2023, 02:31 AM
            9 responses
            122 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by frankthearm, 04-18-2024, 09:08 AM
            16 responses
            66 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by habeebft, Today, 01:18 PM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by benmarkal, Today, 12:52 PM
            2 responses
            15 views
            0 likes
            Last Post benmarkal  
            Started by f.saeidi, Today, 01:38 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X