Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using Max/Min as y values for a Trend Channel.

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

    Using Max/Min as y values for a Trend Channel.

    I am in the process of making a custom indicator that uses the highest high and lowest low of the last n bars to make a horizontal channel. I have used Max/Min but the indicator does not plot. However when I use High or Low it does. Is there another way of finding the Max/Min of a certain number of bars?

    #2
    Hello VTrades,

    Thank you for your reply.

    When you use Max/Min in the indicator and it doesn't plot, do you see an error in the Control Center regarding the indicator when you try to apply it to the chart? Max/Min should not generally keep the indicator from plotting. If so, what is the full text of the error? Keep in mind that there need to be enough bars loaded on the chart before you use one of them to look back at bars, so you'd want to make sure you are checking that CurrentBar is greater than the lookback period before processing. You'd want to make sure you have something like this at the beginning of OnBarUpdate:

    if (CurrentBar < n)
    return;

    Where n is the largest lookback period you're using.

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      There was no error and the indicator compiled successfully. I went back and defined them as variables that i then used to set the y values for the channel and it works correctly now.

      Thank you for your help and quick response.

      Comment


        #4
        I wanted the same to implement it in an app for the chilean stock exchange.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        128 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        73 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        116 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        109 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        88 views
        0 likes
        Last Post CarlTrading  
        Working...
        X