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 charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        60 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        147 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        161 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 05-10-2026, 08:12 PM
        0 responses
        97 views
        0 likes
        Last Post CarlTrading  
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        284 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Working...
        X