Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Trend Channel Price Level Logic Staying *Fixed*

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

    Trend Channel Price Level Logic Staying *Fixed*

    I'm working on a strategy to use trend channels for entries, using the trend (0), mid (50) and parallel (100) levels as price levels for entry. I found some logic on the forums to compute the price levels, but the price appears (via prints & trade entry) to stay fixed at the points where the channel was first drawn. I need the price to adjust with the slope of the channel. Any ideas where I can adjust? The chart screenshot hopefully gives an idea of what I'm trying to accomplish.

    Here's the code I'm using to get trend channel levels:
    Code:
    if (draw is DrawingTools.TrendChannel)
    DrawingTools.TrendChannel subWave = draw as DrawingTools.TrendChannel;
                            
                            foreach (PriceLevel priceLevel in subWave.PriceLevels)
                            {
                                // skip the first two price levels which are the start and end prices
                                if (subWave.PriceLevels.IndexOf(priceLevel) < 2)
                                    continue;
    
                                double price = Math.Abs(subWave.TrendStartAnchor.Price - subWave.ParallelStartAnchor.Price) * (priceLevel.Value / 100);
    
                                //priceLevel.GetPrice(trendWall.ParallelStartAnchor.Price, (trendWall.TrendStartAnchor.Price - trendWall.ParallelStartAnchor.Price), (trendWall.TrendStartAnchor.Price > trendWall.ParallelStartAnchor.Price));
    
                                //Print(string.Format("Level {0}: {1}", priceLevel.Value, price ));
                                if (priceLevel.Value == 100)
                                ParallelLevel = priceLevel.GetPrice(subWave.ParallelStartAnchor.Price, (subWave.TrendStartAnchor.Price - subWave.ParallelStartAnchor.Price), (subWave.TrendStartAnchor.Price > subWave.ParallelStartAnchor.Price));
                                if (priceLevel.Value == 75)
                                SeventyFiveLevel = priceLevel.GetPrice(subWave.ParallelStartAnchor.Price, (subWave.TrendStartAnchor.Price - subWave.ParallelStartAnchor.Price), (subWave.TrendStartAnchor.Price > subWave.ParallelStartAnchor.Price));
                                if (priceLevel.Value == 50)
                                MidLevel = priceLevel.GetPrice(subWave.ParallelStartAnchor.Price, (subWave.TrendStartAnchor.Price - subWave.ParallelStartAnchor.Price), (subWave.TrendStartAnchor.Price > subWave.ParallelStartAnchor.Price));
                                if (priceLevel.Value == 25)
                                TwentyFiveLevel = priceLevel.GetPrice(subWave.ParallelStartAnchor.Price, (subWave.TrendStartAnchor.Price - subWave.ParallelStartAnchor.Price), (subWave.TrendStartAnchor.Price > subWave.ParallelStartAnchor.Price));
                                if (priceLevel.Value == 0)
                                TrendLevel = priceLevel.GetPrice(subWave.ParallelStartAnchor.Price, (subWave.TrendStartAnchor.Price - subWave.ParallelStartAnchor.Price), (subWave.TrendStartAnchor.Price > subWave.ParallelStartAnchor.Price));
                                
                              
                                Print(string.Format ("Subwave: 100 Level: {0} | 50 Level: {1} | 0 Level {2} | 75 Level {3} | 25 Level {4} ", ParallelLevel, MidLevel, TrendLevel, SeventyFiveLevel, TwentyFiveLevel));
                                  
                            }​
    And here's the print output:

    Subwave: 100 Level: 72.4 | 50 Level: 72.59 | 0 Level 72.78 | 75 Level 71.0725 | 25 Level 71.7775
    Subwave: 100 Level: 72.4 | 50 Level: 72.59 | 0 Level 72.78 | 75 Level 71.0725 | 25 Level 72.685
    Subwave: 100 Level: 72.4 | 50 Level: 72.59 | 0 Level 72.78 | 75 Level 72.495 | 25 Level 72.685​
    Attached Files

    #2
    In this case my entry was supposed to be off the the trend (0) level, but it's using the fixed price...
    Attached Files

    Comment


      #3
      Hello swjake,

      Thanks for your notes.

      When you mention "it's using the fixed price", are you referring to the StartAnchor price that the trend channel object is being drawn to?

      Are you submitting the order to the 'TrendLevel' price that you are assigning a value to in the code you shared?

      Please send us a simple exported test script that demonstrates the behavior in question and send us the exact steps and settings used to reproduce the behavior so that we may look into this matter further.

      Note that a reduced copy refers to a copy of the script that contains the minimum amount of code needed to reproduce the issue. All other code is commented out or removed.

      To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.​

      To export the test script, go to Tools > Export > NinjaScript AddOn.
      <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        Thank you Brandon. I have that for you. What email is best?
        Last edited by swjake; 01-15-2024, 04:34 PM.

        Comment


          #5
          Hello swjake,

          Thanks for your notes.

          You could write in to support[at]ninjatrader[dot]com with a brief description of your question, answers to the questions asked in post # 2, the exact steps and settings used to reproduce the behavior using the test script, and attach your simple exported test script.

          In the subject of the email include Attn: BrandonH and in the body of the email include a link to this forum thread.

          We look forward to assisting further.
          <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          50 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          126 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          69 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X