NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 01-06-2011, 09:15 AM   #1
marotom
Senior Member
 
Join Date: Jul 2009
Location: Hungary
Posts: 148
Thanks: 4
Thanked 2 times in 2 posts
Default Multiple Data Series with different Indicator Input series

Hello advance programer, Josh!

I’d like to ask a little help from you. I’d like create a multiple data series within a single chart window in NinjaSript, as I can make it manually. (it can probably make using NinjaScript). In help I can’t find the convenient method and properties to create a new chart with different Data Series object, and to place indicators, which Input series are belong to the secondary instrument data series but they are shown on different, on the main Data Series. I can create in script a new DataSeries, and I can reach the value, but I can’t able to made it on the chart represent. What I think about:
I want to reach this state:



I’ve tried this way, but doesen’t want to work for nuts:
Code:
  
protectedoverridevoid Initialize()
          {
                                     Add(PeriodType.Minute, 30); 
                                     Add(Bollinger(2, 14));          
                                     Add(Bollinger(BarsArray[1], 2, 14));
                                     Bollinger(BarsArray[1], 2, 14).PanelUI = 1;  
  }
Second way, it shows something, but not correct. I've tried using insteed of Bollinger Band the _ADXVMA_Alerts_v01_5 indicator, but it is confused for me. it can be seen in attached picture.

Code:
 protectedoverridevoid Initialize()
  {
                            Add(PeriodType.Minute, 30); 
                                     Add(StrategyPlot(0));
                                     Add(StrategyPlot(1));
                                     Add(StrategyPlot(2));
  
                                     StrategyPlot(0).Plots[0].Pen.Color = Color.Blue;
                                     StrategyPlot(1).Plots[0].Pen.Color = Color.Green;
                                     StrategyPlot(2).Plots[0].Pen.Color = Color.Red;
                                     StrategyPlot(0).PanelUI = 1;
                                     StrategyPlot(1).PanelUI = 1;
                                     StrategyPlot(2).PanelUI = 1;
  CalculateOnBarClose = true;
  }
  protectedoverridevoid OnBarUpdate()
          {
                                     StrategyPlot(0).Value.Set( Bollinger(BarsArray[1], 2,14).Upper[0]);
                                     StrategyPlot(1).Value.Set( Bollinger(BarsArray[1], 2,14).Middle[0]);
                                     StrategyPlot(2).Value.Set(Bollinger(BarsArray[1], 2,14).Lower[0]);
  }
It can be seen:


The question would be in NinjaScript.
-How can make visible the additional data series in Multiple Data Series chart window?
- how can I correctly place an 30 min Input series Indicator on other, e.g. 10 min chart?
I'd appreciate it.

Many Thanks for help!
Tom
Attached Images
File Type: jpg _ADXVMA_Alerts_v01_5.jpg (83.7 KB, 43 views)
marotom is offline  
Reply With Quote
Old 01-06-2011, 09:26 AM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

This is Brett Assisting here for Josh.

Unfortunately it is unsupported to make price data from a secondary series visible on the chart. It must be added manually via the user.

Secondly, on your other question is is possible with your current method. However you would need to add some BarsInProgress checks. So that you only set values that matter to the current series.

For example only set the 30 minute indicator value when it is running the 30 minute bars, or only set the 10 minute indicator value when it is running the 10 minute bars.
I.E. For every 30 minute bar you will get 3 calls to the OnBarUpdate to the 10 minute bars.

You can check this with BarsInProgress which is detailed here:

http://www.ninjatrader.com/support/h...nstruments.htm

Let me know if I can be of further assistance.
NinjaTrader_Brett is offline  
Reply With Quote
Old 01-06-2011, 10:22 AM   #3
marotom
Senior Member
 
Join Date: Jul 2009
Location: Hungary
Posts: 148
Thanks: 4
Thanked 2 times in 2 posts
Default

Hello Brett,

thanks for help. I've made it followed your suggestion. I used BarsInProgress == 1 to set the 30 min DataSeries. but I don't have an idea where is the mistake since it doesen't want to work. when I change the progress 0, it give me the right indicator on 10 min chart.

could you correct, how will work correctly, please? it would be important to solve it.

Code:
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    /// <summary>
    /// Enter the description of your strategy here
    /// </summary>
    [Description("Enter the description of your strategy here")]
    public class ProbMulti : Strategy
    {
        #region Variables
        // Wizard generated variables
        private int myInput0 = 1; // Default setting for MyInput0
        // User defined variables (add any user defined variables below)
        #endregion

        /// <summary>
        /// This method is used to configure the strategy and is called once before any strategy method is called.
        /// </summary>
        protected override void Initialize()
        {
            CalculateOnBarClose = true;
            ClearOutputWindow();
            Add(PeriodType.Minute, 30);  //BarsArray[1]
            
            Add(StrategyPlot(0));
            Add(StrategyPlot(1));
            Add(StrategyPlot(2));
            
            StrategyPlot(0).Plots[0].Pen.Color = Color.Blue;
            StrategyPlot(1).Plots[0].Pen.Color = Color.Green;
            StrategyPlot(2).Plots[0].Pen.Color = Color.Red;
            
            StrategyPlot(0).PanelUI = 1;
            StrategyPlot(1).PanelUI = 1;
            StrategyPlot(2).PanelUI = 1;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            if (CurrentBar < 20) return;
                
            if (BarsInProgress == 1) 
           { 
            StrategyPlot(0).Value.Set( Bollinger(BarsArray[1], 2,14).Upper[0]);
            StrategyPlot(1).Value.Set( Bollinger(BarsArray[1], 2,14).Middle[0]);
            StrategyPlot(2).Value.Set(Bollinger(BarsArray[1], 2,14).Lower[0]);        
            
            }
            
        }

        #region Properties
        [Description("")]
        [GridCategory("Parameters")]
        public int MyInput0
        {
            get { return myInput0; }
            set { myInput0 = Math.Max(1, value); }
        }
        #endregion
    }
}
is it impossible to call the indicator similar this way?

Code:
  
protectedoverridevoid Initialize()
          {
                                     Add(PeriodType.Minute, 30); 
                                     Add(Bollinger(2, 14));          
                                     Add(Bollinger(BarsArray[1], 2, 14));
                                     Bollinger(BarsArray[1], 2, 14).PanelUI = 1;  
  }
Thanks for help!
Tom
Last edited by marotom; 01-06-2011 at 10:28 AM.
marotom is offline  
Reply With Quote
Old 01-06-2011, 10:58 AM   #4
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

I misread your question. Thought you were asking about the original chart plotting a secondary period.

Make the following change to do what your looking for.

StrategyPlot(0).Panel = 1;
StrategyPlot(
1).Panel = 1;
StrategyPlot(
2).Panel = 1;

Take UI in the above calls out in your Init() then your g2g.

Let me know if I can be of further assistance.

NinjaTrader_Brett is offline  
Reply With Quote
Old 01-06-2011, 11:49 AM   #5
marotom
Senior Member
 
Join Date: Jul 2009
Location: Hungary
Posts: 148
Thanks: 4
Thanked 2 times in 2 posts
Default

Hello,
yes, I'm going to plot the secondary chart(30 min) indicator on the primary chart (10 min).
I've rewrote this, but there isn't effect on the script. the indicator still can be seen on the secondary chart, if I use the primary BarsInProgress with value 0. but I want to see on the primary chart the secondary period's indicator. As we better keep this short, do you have/write a working sript in brief, how works it, please?

thanks

Quote:
Originally Posted by NinjaTrader_Brett View Post
Hello,

I misread your question. Thought you were asking about the original chart plotting a secondary period.

Make the following change to do what your looking for.

StrategyPlot(0).Panel = 1;
StrategyPlot(
1).Panel = 1;
StrategyPlot(
2).Panel = 1;

Take UI in the above calls out in your Init() then your g2g.

Let me know if I can be of further assistance.

marotom is offline  
Reply With Quote
Old 01-06-2011, 12:11 PM   #6
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

I guess I'm still not sure what your looking for here then.

Take out the

StrategyPlot(0).Panel = 1;
StrategyPlot(
1).Panel = 1;
StrategyPlot(
2).Panel = 1;


and delete them and then the StrategyPlot's will plot on your same chart that you started the strategy on.

Use the above if you want it added to panel 1 which is below panel 0.

I will need further explination of what your trying to do if the above is not what you need.

Let me know if I can be of further assistance.
NinjaTrader_Brett is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieving price data when indicator input series is another indicator MikeInMA Indicator Development 6 01-06-2011 07:33 AM
Can indicator draw on its own panel as well as the Input Series upshon Indicator Development 1 12-22-2010 06:35 AM
Indicator and multiple data series fff222 Indicator Development 1 12-01-2010 07:07 AM
Multiple Data Series, Indicator Displacement Bug pureporsche Indicator Development 1 07-28-2010 06:08 AM
Input Series For Indicator CraigC Indicator Development 7 06-28-2008 03:58 AM


All times are GMT -6. The time now is 02:43 PM.