Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawingTools.TrendChannel

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

    DrawingTools.TrendChannel

    Hi,

    Is it not possible to get and compare TrendChannel using below code? When I tried to debug the program, I am getting draw as NinjaTrader.NinjaScript.DrawingTools.TrendChannel but it is not going inside the condition draw is NinjaTrader.NinjaScript.DrawingTools.TrendChannel and returns false. How do I fix the issue? Additionally, how do I filter in the foreach loop to get only TrendChannel DrawObjects. Thanks


    foreach (DrawingTool draw in DrawObjects.ToList())
    {
    // Finds line objects that are attached globally to all charts of the same instrument
    if (draw is DrawingTools.Line)
    {
    myBuyLine = draw as DrawingTools.Line;
    }
    else if (draw is NinjaTrader.NinjaScript.DrawingTools.TrendChannel)
    {
    trendChannel = draw as DrawingTools.TrendChannel;
    }
    }​
    Last edited by kezyclaire; 03-27-2023, 04:45 PM.

    #2
    Hello kezyclaire,

    If you are wanting assistance with an error message, please provide the full error message. Ctrl + c to copy, Ctrl + v to paste. Or provide screenshot.

    Your suggested code does not show the variable definitions, which is where the issue could be.

    Making a test script, I don't see anything that would be wrong with that code.

    TrendChannelsDrawObjectsTest_NT8.zip
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X