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

DrawText syntax

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

    DrawText syntax

    Hello,

    I calculate in the indicator doubles and want them to plot above last bar of dataseries2 but its always plotted above high of chart-dataseries (BIP==0). From the syntax in the helpguide I do not find a solution. As the chart is 30 min with the syntax here below its plotting, of course, above high of last 30min bar (as I run it with cobctrue). But it should be plotted above the "inside" 2 minute bar that is "within" the new 30 min bar.

    DrawText("diffHigh", true, str1, 0, currentHigh+8*TickSize, 0, Color.Black, new Font ("Arial",6), StringAlignment.Center, Color.Transparent, Color.Transparent, 1);

    How can I get the dataseries 2 bar as "horizontal position" please?

    Thank you!
    Tony
    Last edited by tonynt; 11-30-2020, 10:50 AM. Reason: add explanation

    #2
    Hello tonynt,

    Thank you for your post.

    To draw calculated values from your added data series onto the Primary data series, you would need to use a BarsInProgress == 1 check followed by calling your DrawText logic. In a multi-bars script, the OnBarUpdate() method is called for each Bars object of a script. Using a BarsInProgress check for the added series allows you to separate trading logic from different bar events.

    You would also need to use a CurrentBars check to ensure that there are enough bars loaded in the chart for both data series.

    Please see the documentation below for more information.

    BarsInProgress - https://ninjatrader.com/support/help...inprogress.htm
    CurrentBars - https://ninjatrader.com/support/help...urrentbars.htm
    DrawText - https://ninjatrader.com/support/help...7/drawtext.htm

    Additionally, please see the attached example script demonstrating how this would be accomplished. In our example script, we add a 2-minute data series. Then, we use a BarsInProgress check for the added series, save the current High of the 2-minute series to a variable, followed by calling our logic for DrawText. When the script is applied to a 30-minute primary series, we see the current High of the added 2-minute series drawn above the High on the primary series.

    Let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Shansen, 08-30-2019, 10:18 PM
    24 responses
    941 views
    0 likes
    Last Post spwizard  
    Started by Max238, Today, 01:28 AM
    0 responses
    9 views
    0 likes
    Last Post Max238
    by Max238
     
    Started by rocketman7, Today, 01:00 AM
    0 responses
    4 views
    0 likes
    Last Post rocketman7  
    Started by wzgy0920, 04-20-2024, 06:09 PM
    2 responses
    28 views
    0 likes
    Last Post wzgy0920  
    Started by wzgy0920, 02-22-2024, 01:11 AM
    5 responses
    33 views
    0 likes
    Last Post wzgy0920  
    Working...
    X