Announcement

Collapse
No announcement yet.

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 pel11, Today, 06:44 PM
            0 responses
            2 views
            0 likes
            Last Post pel11
            by pel11
             
            Started by traderbot, Today, 06:40 PM
            0 responses
            2 views
            0 likes
            Last Post traderbot  
            Started by CCLQMT, Today, 05:31 PM
            0 responses
            6 views
            0 likes
            Last Post CCLQMT
            by CCLQMT
             
            Started by yodaler, Today, 03:17 PM
            2 responses
            12 views
            0 likes
            Last Post yodaler
            by yodaler
             
            Started by tatir, Today, 03:09 PM
            2 responses
            18 views
            0 likes
            Last Post tatir
            by tatir
             
            Working...
            X