![]() |
|
|||||||
| Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
I'm trying to DrawRegion for Opening Range. I am using the following code:
if (ToTime(Time[0]) >= ToTime(9, 45, 01) && ToTime(Time[0]) <= ToTime(16, 15, 00)){ DrawRegion("OpenRangeRegion" + Time[0].Date.ToString(), CurrentBar - rangeEndBar, 0, RangeHigh, RangeLow, Color.Transparent, Color.White, 2); } The Region draws exactly as it should with one exception. When I scroll back on the chart to the previous day it has today's region not yesterday's. I know the "tag" property is the issue, but I don't know how to fix it. Is there a simple solution? Thanks |
|
|
|
|
|
#2 | |
|
Senior Member
|
Quote:
|
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
koganam
Thanks, I thought that was a great idea, but the result was the same. The current day is the only day that the region draws correctly. Any prior days have the same region as the current. What's interesting is that if I scroll back to a prior day on my chart and reload NinjaScript the region is redrawn correctly as the current day. And then each following day draws correctly as the "current day". But any prior days are incorrect. Thanks again |
|
|
|
|
|
#4 | |
|
Senior Member
|
Quote:
|
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
I'm using a DrawRegion to display an opening range. So if today's opening range on the ES was RH=1550 and RL=1545, then the today's DrawRegion would draw between 1550 and 1545. The problem is that if I scroll back on my chart to yesterday's opening range, it draws the same 1550 to 1545 DrawRegion , when yesterday's opening range was NOT 1550 to 1545.
I have RangeHigh and RangeLow plots that work fine. I have DrawText that work fine and they all reflect the individual data of each day, with the exception of the one DrawRegion for the opening range. And they all use the tag code from post #1. I hope I'm being clear enough. Thanks
Last edited by kenb2004; 07-15-2012 at 04:15 PM.
|
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jul 2012
Location: Houston, TX
Posts: 17
Thanks: 1
Thanked 15 times in 9 posts
|
Ken, if you would like to upload the indicator, I'd be happy to look at it for you and see why it's not drawing the regions correctly. You can PM it to me if you prefer.
My first guess would be that RangeHigh and RangeLow might not be updating correctly. However, what sounds so peculiar is that when you scroll back, all regions on the chart and to the right of your scroll position are drawn correctly? I would love to figure out what is causing that... |
|
|
|
|
|
#7 | |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,183
Thanks: 178
Thanked 300 times in 258 posts
|
Look in the Pivots indicator code to get around this.
// This namespace holds all indicators and is required. Do not change it. namespace NinjaTrader.Indicator { /// <summary> /// Pivot Points. /// </summary> [Description("Pivot Points.")] public class Pivots : Indicator Quote:
|
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
|
Thank you for your input. The issue has been resolved by adding:
= new DataSeries(this, MaximumBarsLookBack.Infinite); to each of the DataSeries. This is to overide Ninja's caching up to 256 bars. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Opening Range indicator | mod99 | Indicator Development | 15 | 09-03-2011 02:06 PM |
| Opening range breakout | bradypreston | General Programming | 7 | 02-28-2010 05:13 AM |
| Programing an opening range | MJUK05 | General Programming | 6 | 02-09-2010 02:58 PM |
| Opening Range Breakout | maninjapan | Strategy Development | 32 | 10-20-2009 02:55 PM |
| Please help with Opening Range Breakout Strategy | OrderFlow | Strategy Development | 2 | 08-03-2009 04:30 AM |