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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    55 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    132 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X