Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MultiTime SMA PlotColor

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

    MultiTime SMA PlotColor

    Hi,

    I'm working on an indicator that plots values from indicators in secondary timeframes. I strated and simply plot the SMA vaues of 3, 10, and 30 min to a 5 min chart. Everything works fine and my next idea was to change the plot color with the Rising/Falling method.

    My problem is that the SMA of higher secondary timeframes keeps its value and thus is neither rising, nor falling. How can I code it to keep the last color used? Or define the color as a function of the Rising/Falling of the SMA in the secondary timeframe?

    #2
    Originally posted by marcoheimann View Post
    Hi,

    I'm working on an indicator that plots values from indicators in secondary timeframes. I strated and simply plot the SMA vaues of 3, 10, and 30 min to a 5 min chart. Everything works fine and my next idea was to change the plot color with the Rising/Falling method.

    My problem is that the SMA of higher secondary timeframes keeps its value and thus is neither rising, nor falling. How can I code it to keep the last color used? Or define the color as a function of the Rising/Falling of the SMA in the secondary timeframe?
    It would be easier to see what you have going on if you posted some sample code.

    In the NT Help Guide, does the Plots example help?

    NinjaScript > Language Reference > Indicator >Plots



    Examples
    // Initialize method of a custom indicator
    protected override void Initialize()
    {
    // Lines are added to the Lines collection in order
    Add(new Plot(Color.Orange, "Plot1")); // Stored in Plots[0]
    Add(new Plot(Color.Blue, "Plot2")); // Stored in Plots[1]
    }

    // Dynamically change the primary plot's color based on the indicator value
    protected override void OnBarUpdate()
    {
    if (Value[0] > 70)
    Plots[0].Pen = new Pen(Color.Blue);
    else
    Plots[0].Pen = new Pen(Color.Red);
    }

    Comment


      #3
      Originally posted by marcoheimann View Post
      Hi,

      I'm working on an indicator that plots values from indicators in secondary timeframes. I strated and simply plot the SMA vaues of 3, 10, and 30 min to a 5 min chart. Everything works fine and my next idea was to change the plot color with the Rising/Falling method.

      My problem is that the SMA of higher secondary timeframes keeps its value and thus is neither rising, nor falling. How can I code it to keep the last color used? Or define the color as a function of the Rising/Falling of the SMA in the secondary timeframe?
      Oh yeah, this looks like it has already been done, by photog53

      Comment


        #4
        Hi sledge,

        Thanks for the link, I had made a quick search but didn't come across this indicator.

        You're right this is pretty much what I was trying to do, so I'll work with it.

        Thanks

        Marco

        Comment

        Latest Posts

        Collapse

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