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 cmoran13, Yesterday, 01:02 PM
        0 responses
        30 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        22 views
        0 likes
        Last Post PaulMohn  
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        160 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        95 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        148 views
        2 likes
        Last Post CaptainJack  
        Working...
        X