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

Drawline

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

    Drawline

    I am trying to setup some draw items in my NT script for when and where I am bid or offered and where my stop and target is when in a position. However Here is one line of my code below and I am not seeing an items draw on the chart, what am i missing:-
    Code:
    DrawLine("bid @ bar " + item.Key + CurrentBar, false, 0, item.Key, 0, item.Key, Color.Black, DashStyle.Solid, 2);
    every draw item has a unique tag so they should all be drawn, but nothing.

    #2
    Hello,

    Thank you for the question.

    I see that this is likely being called in a Loop based on the item.Key being used.

    Can you confirm the Price values you are using are valid? I.E. if you use Close[0] instead of item.Key do you see the lines? If the item.Key is not a price value, and you have false for AutoScale, likely the line is being plotted by off screen. You could try turning AutoScale to true instead to have the scale adjust to check for that.

    Otherwise, if this is in a loop, are there items in the collection or is the loop iterating? Have you tried using prints to confirm the logic is being executed where you have this DrawLine?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      I am stepping tho the code with Visual Studio, the item.Key is valid double price. I have tried switching auto scale to true but still no lines.

      Comment


        #4
        Hello,

        Thank you for the reply.

        I would be unsure without further context of the code, have you tried drawing using specific values such as Close[0]? Or have you taken the drawing objects out of the loop scope and placed it somewhere you can verify it works correct?

        Also is this on the main panel or in a secondary panel?

        If you can ensure the draw command works somewhere outside of the current scope using generic prices, you could move it more into the scope of the loop and locate the problem that way possibly. It would be hard to say at this point without a sample that shows the issue so we could look at what my be happening.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by inanazsocial, Today, 01:15 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        6 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        1 view
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Started by Davidtowleii, Today, 12:15 AM
        0 responses
        3 views
        0 likes
        Last Post Davidtowleii  
        Working...
        X