Go Back   NinjaTrader Support Forum > NinjaTrader 8 > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

NinjaTrader
Reply
 
Thread Tools Display Modes
Old 02-17-2017, 10:24 AM   #1
JBU1314
Member
 
Join Date: Jul 2015
Posts: 46
Thanks: 15
Thanked 0 times in 0 posts
Default Draw 2nd Data Series on Panel 2

Hi All,
I am trying to get the second data series onto Panel 2 but have difficulties to implement it.
Attached a picture to clarify. Any advice what I missed?
I basically only want the 50 Period of the SPY on the chart on the second panel which currently shows as AAPL. Here my code.

else if (State == State.Configure)
{
AddDataSeries("SPY", Data.BarsPeriodType.Day, 1, Data.MarketDataType.Last);

_smaSPY = SMA(Closes[1], 50);
_smaSPY.Plots[0].Width = 2;
_smaSPY.Plots[0].Brush =Brushes.Purple;
_smaSPY.Panel = 3;
base.AddChartIndicator(_smaSPY);
Attached Images
File Type: jpg PicNT.JPG (89.6 KB, 4 views)
JBU1314 is offline  
Reply With Quote
Old 02-17-2017, 11:09 AM   #2
NinjaTrader_JessicaP
NinjaTrader Customer Service
 
NinjaTrader_JessicaP's Avatar
 
Join Date: Dec 2015
Location: Denver, CO
Posts: 1,836
Thanks: 165
Thanked 369 times in 366 posts
Default

Hello JBU1314, and thank you for your question. You will need to set your indicator or strategy's DrawOnPricePanel setting to true during State.SetDefaults. Please let us know if there are any other ways we can help.
NinjaTrader_JessicaP is offline  
Reply With Quote
Old 02-17-2017, 11:21 AM   #3
JBU1314
Member
 
Join Date: Jul 2015
Posts: 46
Thanks: 15
Thanked 0 times in 0 posts
Default

Hi Jessica,
I did that but I still dont have SPY displayed on Panel 2 jsut the apple as shown in the screen shot attached.
JBU1314 is offline  
Reply With Quote
Old 02-17-2017, 12:48 PM   #4
NinjaTrader_JessicaP
NinjaTrader Customer Service
 
NinjaTrader_JessicaP's Avatar
 
Join Date: Dec 2015
Location: Denver, CO
Posts: 1,836
Thanks: 165
Thanked 369 times in 366 posts
Default

I misunderstood your intent. In order to do this we have to make a copy of the SMA indicator and override its PanelUI member. I have provided an example.
Attached Files
File Type: cs SMAPanel2.cs (4.1 KB, 4 views)
File Type: cs Example1663081.cs (2.4 KB, 4 views)
NinjaTrader_JessicaP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_JessicaP for this post:
Old 02-17-2017, 03:51 PM   #5
JBU1314
Member
 
Join Date: Jul 2015
Posts: 46
Thanks: 15
Thanked 0 times in 0 posts
Default

This is great information. Thank you very much!
JBU1314 is offline  
Reply With Quote
Old 02-17-2017, 04:12 PM   #6
JBU1314
Member
 
Join Date: Jul 2015
Posts: 46
Thanks: 15
Thanked 0 times in 0 posts
Default

The problem is only that The SMAPanel2 is still showing the primary series (in this example APPL) instead of the SPY which is he secondary Dataseries. So I still do have the same problem. What did i miss?
Attached Images
File Type: jpg Capture3.JPG (137.3 KB, 1 views)
JBU1314 is offline  
Reply With Quote
Old 02-20-2017, 08:02 AM   #7
NinjaTrader_JessicaP
NinjaTrader Customer Service
 
NinjaTrader_JessicaP's Avatar
 
Join Date: Dec 2015
Location: Denver, CO
Posts: 1,836
Thanks: 165
Thanked 369 times in 366 posts
Default

If you would like your strategy to trade on your secondary data series, you can pass in your SPY series to your strategy as shown in the attached image.

Otherwise, if you would like your strategy to monitor AAPL and your SMA to monitor SPY you will need to modify the code I sent you so that it incorporates your second data series into your SMA indicator, e.g.

Code:
 _smaSPY = SMAPanel2(BarsArray[1], Closes[1], 50);
If neither of these was quite what you were looking for or there is any other way we can help please let us know.
NinjaTrader_JessicaP 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
Indicator on 2nd data series meyer99 Platform Technical Support 1 12-08-2016 04:17 PM
Can't Draw In 2nd Data Series Panel 2 tradenj General Development 5 03-10-2013 01:52 PM
Can indicator draw on its own panel as well as the Input Series upshon Indicator Development 1 12-22-2010 07:35 AM
2nd data series mballagan Strategy Development 1 12-07-2009 11:36 AM


All times are GMT -6. The time now is 12:37 AM.

Futures, foreign currency and options trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones financial security or lifestyle. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results. View Full Risk Disclosure.

CFTC Rules 4.41 - Hypothetical or Simulated performance results have certain limitations, unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.

This website is hosted and operated by NinjaTrader, LLC (“NT”), a software development company which owns and supports all proprietary technology relating to and including the NinjaTrader trading platform. NT is an affiliated company to NinjaTrader Brokerage (“NTB”), which is a NFA registered introducing broker (NFA #0339976) providing brokerage services to traders of futures and foreign exchange products. This website is intended for educational and informational purposes only and should not be viewed as a solicitation or recommendation of any product, service or trading strategy. No offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, is made, given, or in any manner endorsed by any NT affiliate and the information made available on this Web site is not an offer or solicitation of any kind. Specific questions related to a brokerage account should be sent to your broker directly. The content and opinions expressed on this website are those of the authors and do not necessarily reflect the official policy or position of NT or any of its affiliates. 

Vendors along with their websites, products and services, collectively referred to as (“Vendor Content”), are independent persons or companies that are in no manner affiliated with NT or any if its affiliates. NT or any of its affiliates are not responsible for, do not approve, recommend or endorse any Vendor Content referenced on this website and it’s your sole responsibility to evaluate Vendor Content. Please be aware that any performance information provided by a vendor should be considered hypothetical and must contain the disclosures required by NFA Rule 2-29(c). If you are interested in learning more about, or investigating the quality of, any such Vendor Content you must contact the vendor, provider or seller of such Vendor Content. No person employed by, or associated with, NT or any of its affiliates is authorized to provide any information about any such Vendor Content. Visit the CFTC resources for education regarding the industry and signs of fraud.