![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Feb 2010
Location: Kansas
Posts: 142
Thanks: 4
Thanked 9 times in 5 posts
|
The basic problem is that I cannot get an indicator to plot the same on 'Strategy Analyzer' as it does on basic Ninja charts.
The indicator in question is a simple one...EMA(20)..... that plots "barsinprogress" and draws a 5 min EMA on a 1 min chart... (see attached 1min chart grab NinjaChart ....) It works very well on Ninja charts and plots a line on the 1 min that is almost exactly tick for tick the same as the EMA(20) plotted on a 5min chart. However...when I add this same indicator to a Strategy, it plots "weird". (see attached 1min Strategy chart grab Ninja Strat) The short 'pink lines' on the Strategy chart were drawn by me to show where the same indicator plotted values on a standard 1 min Ninja chart.....but the plotted values on the Strategy Analyzer 1 min chart are way off. - Both use the same instrument and the same Default 24/7 session - Both use 1 min.... - Both use the same Instrument and day range. - Price action matches EXACTLY between both charts. I can't figure out what is going wrong....it almost looks like the Strategy Analyzer shuts off calculations from 14:00 until 7:20in the morning... (see chart grab zNinjaStrat2) but the Strategy is using Default 24/7.... Strategy Code is basic.... { #region Variables private int myInput0 = 1; // Default setting for MyInput0 #endregion //********************************************** protected override void Initialize() { Add(xcEMA15(20)); CalculateOnBarClose = true; } //***************************************** protected override void OnBarUpdate() { // do nothing.... myInput0 = 2; } #region Properties [Description("")] [GridCategory("Parameters")] public int MyInput0 { get { return myInput0; } set { myInput0 = Math.Max(1, value); } } #endregion } |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi photog53,
It's working OK here. Attached is the indicator and strategy I'm using for this. If you can post the indicator script you're using I'm happy to take a look.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Feb 2010
Location: Kansas
Posts: 142
Thanks: 4
Thanked 9 times in 5 posts
|
Thanks for the quick reply!!
Let me take a look at the code you sent...... |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Feb 2010
Location: Kansas
Posts: 142
Thanks: 4
Thanked 9 times in 5 posts
|
Ok.... we are making progress.
Your indicator code works the same as mine...so the indicator code is not the issue. The problem occurs when I try to use "Default 24/7" instead of "Instrument Settings". When I switch "Session Template" to Default 24/7....both indicators have long "flat spots" between 14:00 and 07:30. Price action keeps creating bars, but both indicators 'freeze' at the value they had at 14:00 hours. Thanks!!! P.S. I get the same "flat spots" when I use the MultiSeriesAdding strategy...imported exactly as you sent it. My problem is something other than indicator code.
Last edited by photog53; 03-09-2011 at 04:02 PM.
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
It sounds like there may be difference in session template used.
These lines can help you track down the session template used for all series. Add the BIP0 and BIP1 lines to the indicator, and the BIP0 line to your strategy. Print (this + "BIP0 " + BarsArray[0].Session.TemplateName); Print (this + "BIP1 " + BarsArray[1].Session.TemplateName);
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Feb 2010
Location: Kansas
Posts: 142
Thanks: 4
Thanked 9 times in 5 posts
|
Got it....(thanks)
|
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Feb 2010
Location: Kansas
Posts: 142
Thanks: 4
Thanked 9 times in 5 posts
|
You nailed it....
EMA5Min(6E 03-11 (1 Min),20)BIP0 ind Default 24/7 EMA5Min(6E 03-11 (1 Min),20)BIP1 ind CME FX Futures RTH So how do I get the strategy to use just one (the desired one) Session for everything? (I say 'strategy' only because the indicator works perfectly on regular charts... but perhaps there is extra code needed in the indicator itself) Thanks!!!
Last edited by photog53; 03-09-2011 at 08:52 PM.
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Feb 2010
Location: Kansas
Posts: 142
Thanks: 4
Thanked 9 times in 5 posts
|
How should I go about 'syncing' the session templates?
The answer might be simple, but I'm not finding it... (also...if you have spare time, could you explain why the regular chart doesn't have this issue but the Strategy Analyzer does....just so I'll know for future reference) Thanks again for the help.... |
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
It's getting the session template from the Instrument Manager. You can change for 6E to use Default 24 / 7. The difference between the strategy analyzer and applying it directly to a chart is that the strategy does not add the series directly. The strategy is hosting the multiseries indicator. These are the following scenarios:
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Feb 2010
Location: Kansas
Posts: 142
Thanks: 4
Thanked 9 times in 5 posts
|
Thanks!!
(let me go in and see how this works....) |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problems with multi time frames | Sangui | Indicator Development | 3 | 03-31-2011 09:37 PM |
| one indicator and multi time frames | aytacasan | Indicator Development | 17 | 11-26-2010 05:19 AM |
| Problems with two time frames | soyjesus | Automated Trading | 7 | 10-09-2009 02:06 PM |
| multi time frames | price777999 | Automated Trading | 0 | 01-02-2009 02:21 PM |
| Multi time frames | bobby1001 | Strategy Development | 1 | 07-23-2007 10:41 AM |