Announcement

Collapse
No announcement yet.

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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        161 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        308 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        245 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        349 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X