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

Problen drawing plots in Multitimeframe Indicator

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

    Problen drawing plots in Multitimeframe Indicator

    Hello I’m working developing some multi timeframe indicators but i have a trouble with a parameter.
    In the following code when I plot “Paint”, Draw in the 1 minute chart the 5minute result at least all its ok (Notice: the indicator draw each 5 bars)

    protected override void Initialize()
    {
    Add(PeriodType.Minute, 5 );
    }
    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1 )
    {
    Paint.Set(SUM(Close,10)[ 0 ]);
    }
    }




    How ever when i change the following code Notice I’m changing “Close” by “X”)

    #region Variables
    private DataSeries X ;
    #endregion
    protected override void Initialize()
    {
    Add (PeriodType.Minute, 5 );
    X = new DataSeries( this ) ;
    }
    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1 )
    {

    Paint.Set(SUM( X ,10)[ 0 ]);
    }
    }




    “X”save a radom value and “Paint” draw a plot totally different in 1 minute chart about 5 min chart.

    IM INTERESTED TO KNOW WHAT MODIFICATION I MUST TO DO IN THE CODE TO GET THE3 SAME PLOT IN THE 1 MIN AS 5 MINUTE CHART.

    I will hope any guide to do that correctly.
    Best regards.

    Im ataching showing the Plot Problem

    #2
    Hello GAVETSO,
    To assist you further may I know:
    From which bars array does the X data sereis takes reference from?
    If it takes reference from the secondary data series you need to make sure it is syncronized to it. Please refer to this sample code which further discusses it
    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


    Also, use the primary bar to assign the plot value (Paint).

    Code:
    if (BarsInProgress == 0 )
    {
    …
    Paint.Set(SUM( X ,10)[ 0 ]);
    }
    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hello NinjaTrader_Joydeep , thanks for answer..
      X dataseries takes reference from secondary DataS.
      The code:

      Add(PeriodType.Minute, 5);
      if (BarsInProgress == 1)
      {
      bool ALPHA = false ;
      bool BETA = false ;
      bool GAMMA = false ;
      bool DELTA = false ;



      if (Close[0] > Close[1] && Volume[0] > Volume[1] ) ALPHA = true ;
      if (Close[0] > Close[1] && Volume[0] < Volume[1] ) BETA = true ;
      if (Close[0] < Close[1] && Volume[0] < Volume[1] ) GAMMA = true ;
      if (Close[0] < Close[1] && Volume[0] > Volume[1] ) DELTA = true ;

      if(ALPHA ) x.Set(2) ;
      else
      if(BETA) x.Set(1 ) ;
      else
      if(GAMMA) x.Set(-1) ;
      else
      if(DELTA) x.Set( -2) ;


      aCC_pre.Set(SUM(x ,50)[0]);

      AccumulatorPaint.Set( aCC_pre[0] );
      }


      In the sampleDataSeries.Zip example, use these lines:

      secondarySeries = new DataSeries(SMA(BarsArray[1], 50));
      … and …
      if (BarsInProgress == 1)
      {
      secondarySeries.Set(Close[0] - Open[0]);
      }

      But I don’t want to use Close or Highs, I want to use others dataseries objects like x in the previous example:

      Paint.Set(SUM(x ,50)[0]);
      Paint.Set(SMA(Y ,50)[0]);
      Paint.Set(HMA(Z ,50)[0]);

      Best regards.

      Comment


        #4
        Hello GAVETSO,
        To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

        Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

        I look forward to assisting you further.

        *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        0 responses
        1 view
        0 likes
        Last Post helpwanted  
        Started by Brevo, Today, 01:45 AM
        0 responses
        6 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X