Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error drawing EMA with Ninja Script indicator

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

    Error drawing EMA with Ninja Script indicator

    Hello friends,
    I am designing an indicator that prints emas on the chart and I have a problem in the following line:

    Draw.Line(this, "EMA9" + CurrentBar, 0, ema9[0], -1, ema9[0], Brushes.Green, DashStyleHelper.Solid, 2);

    The error that the console gives me is the following:

    "The name DashStyleHelper does not exist in the current context."

    I guess there is some problem with the DashStyle property that is misspelled on the line. Can someone help me please?
    THANKS​
    Last edited by gustavobp; 01-24-2025, 05:42 AM.

    #2
    Hello gustavobp,

    Welcome to the NinjaTrader forums!

    This code appears to be for NinjaTrader 8 and not NinjaTrader 7, yet you have posted your thread in the NinjaTrader 7 section of the forums.

    I have moved your thread from the NinjaTrader 7 > Indicator Development​ section of the forums to the NinjaTrader Desktop > Indicator Development section of the forums.
    If your inquiry was actually for NinjaTrader 7, please let me know and I will move it back.

    Moving forward post in the NinjaTrader Desktop Indicators section for indicators, NinjaTrader Desktop Strategies for strategies, and General Development for addons, market analyzer columns, etc.


    If you want specify the DashStyleHelper you will need to use a overload signature that accepts DashStylerHelper and supply all of the parameters in that overload signature.

    Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Brush brush, DashStyleHelper dashStyle, int width)
    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


    Also, using negative barsAgo indexes is not supported and will cause unexpected behavior in some circumstances.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea B!
      Thanks for your answer.
      Following your links, i am tried with this code line for to print Tag, but there is the same error:

      Linecode: Draw.Line(this, "tag1", false, 10, 1000, 0, 1001, Brushes.LimeGreen, DashStyleHelper.Dot, 2);

      Error line: The name DashStyleHelper does not exist in the current context.
      Can you help me, please??
      Thanks!!!

      Comment


        #4
        Hello gustavobp,

        You may have deleted necessary using statements at the top of the script.

        Make a new indicator in the NinjaScript Editor. Copy and paste the default using statements at the top of the new script to your original script.

        Moving forward always create new scripts using the NinjaScript Editor and do not remove the using statements from the top of the script.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        557 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 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
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X