Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RegionHighLightX - only draw the first bar

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

    RegionHighLightX - only draw the first bar

    Hello, I'm a newbie with ninjascript. At the moment I'm testing a little bit and compare the source code between the strategy builder and ninjascript. I would like to draw in the chart and need yourt help. I would like to draw the region of the first bar, if both lines from the indicator macd higher than the defined value (see attachment).

    Many thanks for your help
    majank
    Attached Files

    #2
    Hello majank,

    Thanks for your post.

    I would recommend using the Strategy Builder to generate logic to show how to draw on the chart, and to also create conditions to compare indicator plot values. Our Help Guide provides direction for how you can make conditions with Indicator plots, and how you can use drawing tools in the Strategy Builder. I suggest setting up the conditions and actions from there, and then to see the resulting C# syntax. with the View Code button.

    Drawing on a chart (follow this and test drawing a region with Draw > Region Highlight X) - https://ninjatrader.com/support/help...ToDrawOnAChart

    Creating indicator plot comparisons (follow this to create conditions which compare MACD plots to numeric values) - https://ninjatrader.com/support/help...lueComparisons

    We look forward to assisting.

    Comment


      #3
      Hi Jim,
      your links are very helpfully for me. Anyway I have some problems and I need your experience. In the uploaded picture you can see the short source code and the chart with the result. The region line should be on the left side at the yellow marked and not on the right side of the chart. What have I done wrong?

      Thank you for your help.

      Comment


        #4
        Hello majank,

        I don't see the full line for how the region is drawn, but I can note that a custom drawing tool tab is not being used. Since the tag is being re-used, older drawing objects are being replaced with newly drawn objects that have the same tag. The Help Guide page linked in post # 2 demonstrates how you can append CurrentBar to the drawing object so it has a unique tag.

        Something else to note, your conditions are checking if the current Avg plot value is greater than the previous Avg plot value. If you would like to draw a region based on the Avg line and the default line being above your input variable, the conditions would like the images attached.

        We look forward to assisting.
        Attached Files

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        607 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        353 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        560 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        561 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X