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 funk10101, Today, 12:02 AM
        0 responses
        3 views
        0 likes
        Last Post funk10101  
        Started by gravdigaz6, Yesterday, 11:40 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by MarianApalaghiei, Yesterday, 10:49 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by XXtrader, Yesterday, 11:30 PM
        0 responses
        4 views
        0 likes
        Last Post XXtrader  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Working...
        X