Announcement

Collapse
No announcement yet.

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
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    566 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X