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

draw.text BarsInProgress ==1 on BarsInProgress =0 Bar Height

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

    draw.text BarsInProgress ==1 on BarsInProgress =0 Bar Height

    I have a list of information that I want to draw on the main chart but I need the Low of the main chart not the low on the BarsInProgress = 1 Low;

    This is my line issue Bars.GetLow(Bars.GetBar(drawList[nCount].Time))


    if I try to draw my drawList information when bars in progress is 0 it won't work because I need the algorithm in barsinprogress== 1 to finish.


    Draw.Text(this, "MyCount" + nCount.ToString(), false, "J", drawList[nCount].Time, Bars.GetLow(Bars.GetBar(drawList[nCount].Time)) , 0, Brushes.Yellow, myFont, TextAlignment.Center, Brushes.Transparent, Brushes.Yellow, 0);


    The printing does work but my information is sometimes far away to my candle.

    If I try to print when barsinprogress ==0; my info will not print on screen

    #2
    Hello ballboy11,

    Thanks for opening the thread.

    You could use BarsArray[0] to explicitly reference the Bars object for the primary data series.

    BarsArray[0].GetLow(BarsArray[0].GetBar(drawList[nCount].Time))

    Publicly available documentation can be found below.

    BarsArray - https://ninjatrader.com/support/help.../barsarray.htm

    If you have any additional questions, please don't hesitate to ask.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks I am not sure if it worked but this actually helps me wit hother scenario

      Comment


        #4
        Hello ballboy11,

        Without the full context of the code I can only speculate on what the issue may be.

        To assist you further I have attached some sample code demonstrating Draw.Text() being called from from BarsInProgress 1 (BIP1) with the Close from BIP1 so it is drawn in relation to the bars on BIP0.

        Code:
        protected override void OnStateChange()
        {
        	if (State == State.SetDefaults)
        	{
        		...
        	}
        	else if (State == State.Configure)
        	{
        		AddDataSeries(BarsPeriodType.Second, 5);
        	}
        }
        
        protected override void OnBarUpdate()
        {
        	if(CurrentBars[0] < 1 || CurrentBars[1] < 1)
        		return;
        	if(BarsInProgress == 1)
        	{
        		Draw.Text(this, "MyCount" + CurrentBars[0].ToString(), false, Close[0].ToString(), Times[0][0], BarsArray[0].GetLow(BarsArray[0].GetBar(Times[0][0])), 10, Brushes.Green, ChartControl.Properties.LabelFont, TextAlignment.Center, Brushes.Transparent, Brushes.Yellow, 0);
        	}
        }
        Further information on how each price/time series should be referenced can be found in the Multi Series NinjaScript documentation which provides a complete guide for creating and using Multi Series NinjaScripts.

        Multi Series NinjaScripts - https://ninjatrader.com/support/help...nstruments.htm

        If there is anything else we can do to help, please let us know.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        27 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 04-23-2024, 09:53 PM
        2 responses
        74 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        193 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,235 views
        0 likes
        Last Post xiinteractive  
        Working...
        X