Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Market Analyzer Trend Column

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

    Market Analyzer Trend Column

    I have a 50 SMA column on my market analyzer. How would I go about coloring this if it has increased/decreased from the last bar?

    I've done it in all my other platforms but am finding it quite a bit more difficult in ninjatrader (I'm sure lack of experience on my part).

    Thank you

    #2
    Hello UncleRyan,

    Welcome to the NinjaTrader support forums.

    In this situation the requirement to check if its changed from the previous value requires being able to look at the previous value. This is a good situation to make a simple wrapper indicator to be used in the analyzer. This will also prevent the actual SMA value from being reported in that cell but would allow you to use this indicator for cell coloring or row filtering.

    The market analyzer specifically wants very simple conditions for its cell conditions. Something that works good for that is using 1, -1 or 0 to denote three states.

    To do this you can use the following steps:
    1. Open the NinjaScript editor and right click on the indicator folder -> new indicator
    2. Click next and give it a unique name
    3. Go to the Plots and lines page
    4. Click Add and create a new plot, you can name it anything like SignalPlot
    5. Click Generate

    This creates the basic structure you need, the condition you want to check could be accomplished like this:


    Code:
     protected override void OnBarUpdate()
            {
                Value[0] = 0; //set a default for every bar
                if(CurrentBar < 1) return; // set the 1 to whatever the max bars ago used was
    
                if(SMA(12)[0] > SMA(12)[1])
                {
                    Value[0] = 1; // increased, set to 1
                } 
                else if(SMA(12)[0] < SMA(12)[1])
                {
                    Value[0] = -1; // decreased, set to -1
                }
            }
    Now in the analyzer you can use this script instead of the SMA, for its cell conditions you can check if the value is 0 for neutral or 1/-1 for positive/negative to have 3 states.


    I look forward to being of further assistance.

    Comment


      #3
      Thanks

      Comment

      Latest Posts

      Collapse

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