Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator BarsPeriods perhaps wonky

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

  • NinjaTrader_Bertrand
    replied
    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.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    Thanks much saltminer, will recheck on my end with your snippet and YM 1 min on Simulated Feed.

    Leave a comment:


  • saltminer
    replied
    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

    Leave a comment:


  • eDanny
    replied
    Won't this print the same thing?
    Bars.Period.ToString()

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    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,

    Leave a comment:


  • saltminer
    started a topic Indicator BarsPeriods perhaps wonky

    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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by chartchartchart, Today, 08:08 AM
1 response
5 views
0 likes
Last Post NinjaTrader_Emily  
Started by andreslazor7, Today, 08:08 AM
2 responses
12 views
0 likes
Last Post andreslazor7  
Started by FatCanary, Today, 08:09 AM
2 responses
5 views
0 likes
Last Post FatCanary  
Started by vantojo, 01-12-2021, 02:13 PM
15 responses
196 views
0 likes
Last Post FatCanary  
Started by nailui, Today, 07:26 AM
0 responses
24 views
0 likes
Last Post nailui
by nailui
 
Working...
X