Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

reference indicator in strategy

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

    reference indicator in strategy

    Any help here would be greatly appreciated. I'm trying to reference two of the plots within the NT BidAskHistVolume indicator. The ones I'm trying to reference are the ones referred to as "Buys" & "Sells" in the indicator parameters window when you are using the BidAskHistVolume.

    I know the indicator itself is referenced as;
    BidAskHistVolume()[
    0], but this just refenences the total volume for the current bar, and not the Buys or Sells volume. Any thoughts?

    Safetrading

    #2
    Hi Safetrading, a good way to determine what code to use to access a specific plot is to use the condition builder. You can right-click in the editor window and select "Insert condition". From there, you can pick what you're looking for in the left side and then just select numeric value in the Misc category on the right side.

    I did just write that before I tried this for the BidAskHistVolume indicator, and it doesn't work for this specific indicator. I'd suggest contacting the author of BidAskHistVolume and working with him to figure out the right value to call.

    If you look at the code for the indicator, it isn't quite a standard implementation of setting a plot value:
    Code:
    if(Open[0] > Close[0])
                   [B]Values[2].Set(Volume[0]);[/B]
                else if(Open[0] < Close[0])
                   [B]Values[3].Set(Volume[0]);[/B]
                else 
                  [B]Values[4].Set(Volume[0]);[/B]
    
                if (CurrentBar < activeBar)
                {
                    return;
                }
                else if (CurrentBar != activeBar)
                {
                    buys = 0;
                    sells = 0;
                    activeBar = CurrentBar;
                }
    
                if (!Historical)
                {
                 [B]Values[1].Set(buys);
                 Values[0].Set(sells);[/B]
                }
    The author is using Values[n].Set(value) instead of the actual plot name to set the plot. It would take some modifications of the indicator to be able to access the plot values from another indicator.

    If you look at the last Values sets and compare to the Add(new Plot)s, you will notice the Values match up. Thus, the code:
    Code:
    Values[1].Set(buys);
    Values[0].Set(sells);
    could be:
    Code:
    Buys.Set(buys);
    Sells.Set(sells);
    This would not work right away though, because the code is missing the plot properties in the properties section, which could be something like this:
    Code:
    #region Properties
    [Browsable(false)]    // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
    [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
    public DataSeries Sells
            {
                get { return Values[0]; }
            }
    // there would need to be a declaration for every DataSeries, like this
    public DataSeries Buys
            {
                get { return Values[1]; }
            }
    In short, you can create the properties for each DataSeries, change up how the values get set, and then you'd be able to access the indicator from another indicator/strategy.
    Last edited by NinjaTrader_Austin; 08-07-2009, 10:55 AM.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Thanks, I'll play with that.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      662 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      376 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
      574 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