Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Daily,Weekly,Monthly view Indicator

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

    Daily,Weekly,Monthly view Indicator

    I have a Indicator. My task is to add Daily, Weekly, Monthly views for that indicator.
    Anyone please guide and tell me the steps that i need to follow.


    In my Research i found that, 2 events have to be changed
    1. OnstateChange

    2. OnBarUpdate

    This is my OnBarUpdate() code:

    protected override void OnBarUpdate()
    {

    this._price = (this.Open[0] + this.High[0] + this.Low[0] + this.Close[0]) / 4.0;
    if (Bars.IsFirstBarOfSession)
    {
    this._VolumeSUM[0] = this.Volume[0];

    this._VolumePriceSUM[0] = this.Volume[0] * this._price;
    this._VolumePrice2SUM[0] = this.Volume[0] * this._price * this._price;
    }
    else
    {
    this._VolumeSUM[0] = this._VolumeSUM[1] + this.Volume[0];
    this._VolumePriceSUM[0] = this._VolumePriceSUM[1] + this.Volume[0] * this._price;
    this._VolumePrice2SUM[0] = this._VolumePrice2SUM[1] + this.Volume[0] * this._price * this._price;
    }

    this.Values[0][0] = this._VolumePriceSUM[0] / this._VolumeSUM[0];

    this._deviation = Math.Sqrt(Math.Max(0, this._VolumePrice2SUM[0] / this._VolumeSUM[0] - this.Values[0][0] * this.Values[0][0]));
    if (this._std1 > 0)
    {
    this.Values[1][0] = this.Values[0][0] + this._std1 * this._deviation;
    this.Values[2][0] = this.Values[0][0] - this._std1 * this._deviation;
    }
    else
    {
    this.Values[1].Reset();
    this.Values[2].Reset();
    }
    if (this._std2 > 0)
    {
    this.Values[3][0] = this.Values[0][0] + this._std2 * this._deviation;
    this.Values[4][0] = this.Values[0][0] - this._std2 * this._deviation;
    }
    else
    {
    this.Values[3].Reset();
    this.Values[4].Reset();
    }
    }

    If we modify these 2 events,is it enough or to add some more into code


    Please guide
    exactly
    what has to be added.can anyone share sample codes.
    Last edited by [email protected]; 08-17-2017, 12:14 AM.

    #2
    Hello,

    So I can best answer your question, could you please provide more information on what exactly you are attempting to do with the longer term time periods?

    Here are two samples which pull in additional data series, which it sounds like you may be looking for.
    Note: In NinjaTrader 8 It is no longer needed to use an indicator to sync a secondary series. This can be done directly from the Series<T> (https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?seriest.htm) constructor. This post is left for historical purposes. Series objects are useful for



    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      There is a custom Indicator and my task is to add daily,weekly,monthly profile views to it.I am new to Ninja Trader hence I need some help and guidance to implement this.
      Last edited by [email protected]; 08-17-2017, 12:41 AM.

      Comment


        #4
        Hello,

        I suggest looking at the pivots indicator preloaded with NinjaTrader for a reference sample for adding different time options, i.e daily, weekly, and monthly.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mestor, 03-10-2023, 01:50 AM
        15 responses
        378 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by samish18, Yesterday, 08:57 AM
        10 responses
        27 views
        0 likes
        Last Post samish18  
        Started by matty89, 03-02-2020, 08:31 AM
        34 responses
        3,039 views
        1 like
        Last Post NinjaTrader_BrandonH  
        Started by kujista, Today, 05:44 AM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by samish18, Today, 08:31 AM
        0 responses
        0 views
        0 likes
        Last Post samish18  
        Working...
        X