Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How can I selectively plot indicators in a strategy?

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

    How can I selectively plot indicators in a strategy?

    Hi,

    Does anybody know how to selectively plot indicators in a strategy?

    I have a strategy program that my need the EMA(fast) and EMA(slow) in some instances and the EMA(Close,13) and VOLMA(20) in other instances, but I do not want to plot them all simultaneously.

    Since the "if" condition cannot be used within the Initialize() method, what other resourse may I use?

    For example:

    protected override void Initialize()
    {
    Add(EMA(fast));
    Add(EMA(slow));
    Add(EMA(Close,13));
    Add(VOLMA(20));
    Add(ATR(aTRperiods));
    }

    I would like to be able to do something like the following:

    if condition 1
    {
    Add(EMA(fast));
    Add(EMA(slow));
    EMA(fast).Plots[0].Pen.Color = Color.Blue;
    EMA(slow).Plots[0].Pen.Color = Color.Green;
    }
    else
    {
    Add(EMA(Close,20));
    Add(VOLMA(20));
    Add(ATR(aTRperiods));
    EMA(Close,20).Plots[0].Pen.Color = Color.Gold;
    EMA(Close,20).Plots[0].Pen.Width = 2;

    }

    Thank you.

    #2
    rperez,

    Unfortunately you can't selectively plot indicators. It is either plotted always or never plotted.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      You can use "if" in initialize(). I do it all the time. The catch is that you don't have data yet so your conditions should relay on parameters values.

      Baruch

      Comment


        #4
        Good idea Baruch, thank you. I applied your idea and it works great. That's exactly what I was looking for.

        Roberto
        Last edited by rperez; 12-16-2009, 09:01 AM.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        666 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        377 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X