Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicator BarsPeriods perhaps wonky

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

    Indicator BarsPeriods perhaps wonky

    Hi guys,
    I was using the following code to add some info to an Alert message in an indicator (NT 7 rev 9).

    message = BarsPeriods[0].Value+BarsPeriods[0].Id+" "+message;

    Should be cool. It was running on a 5 minute YM ##-## chart using Simulated Data Feed.

    The results I got were:
    first two alerts said the Period was "Day".
    All the rest said the period was "HeikenAshi".

    There are only four charts in the workspace open, and only one running the indicator which can produce these particular alerts. None of the charts are Day or HeikenAshi.

    I used BarsPeriods[0] instead of BarsPeriod out of habit. It should be the same thing of course. There is only one timeframe (the chart's) in this indicator.

    Cheers,
    saltminer

    p.s. I changed it to BarsPeriod and recompiled. It says "Day" again on a 1 minute chart.
    Last edited by saltminer; 02-17-2012, 01:29 AM.

    #2
    saltminer, just tried here and could not reproduce an issues with the reporting of those properties - do you see this consistently and also when running on the Simulated Feed?

    Thanks,
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Won't this print the same thing?
      Bars.Period.ToString()
      eDanny
      NinjaTrader Ecosystem Vendor - Integrity Traders

      Comment


        #4
        replicable

        Hi,
        I can replicate.

        Strangely, it seems to change if I change the order of various print statements! Here is a combination that produces consistently silly results.
        I am using the 1 minute chart from my first bug report and I created a new 2 minute chart as well. Using Simulated DataFeed. (It's the weekend). I don't know if it is a problem with real data or not.

        Here is the code. It is in a simple one-timeframe indicator in NT7 v9.

        Code:
        Print(BarsPeriods[0].Value+BarsPeriods[0].Id+", "+Bars.Period.ToString());
        			message = BarsPeriod.Value+BarsPeriod.Id+" "+message;			
        Alert(message,Priority.Medium,message,audioAlerts?alertSound:"",5,Color.Black,col);
        Print("2: "+BarsPeriod.Value+BarsPeriod.Id+", "+Bars.Period.ToString());
        and the output is :

        Day, 1 Min
        2: 1Minute, 1 Min

        Week, 2 Min
        2: 2Minute, 2 Min

        Comment


          #5
          Thanks much saltminer, will recheck on my end with your snippet and YM 1 min on Simulated Feed.
          BertrandNinjaTrader Customer Service

          Comment


            #6
            saltminer, works if you use this snippet?

            protected override void OnBarUpdate()
            {
            Print("1: " + BarsPeriods[0].Value + BarsPeriods[0].Id + ", " + Bars.Period.ToString());

            Print("2: " + BarsPeriod.Value + BarsPeriod.Id + ", " + Bars.Period.ToString());
            }

            Reason being that it needs to be correctly formatted as string to produce a comparable output.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by guillembm, Yesterday, 11:25 AM
            2 responses
            9 views
            0 likes
            Last Post guillembm  
            Started by junkone, 04-21-2024, 07:17 AM
            9 responses
            68 views
            0 likes
            Last Post jeronymite  
            Started by trilliantrader, 04-18-2024, 08:16 AM
            4 responses
            18 views
            0 likes
            Last Post trilliantrader  
            Started by mgco4you, Yesterday, 09:46 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by wzgy0920, Yesterday, 09:53 PM
            0 responses
            10 views
            0 likes
            Last Post wzgy0920  
            Working...
            X