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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        38 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        287 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        289 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        134 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        95 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X