NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 05-21-2012, 07:00 AM   #1
stocktraderbmp
Senior Member
 
Join Date: Jun 2011
Location: Ireland
Posts: 184
Thanks: 32
Thanked 20 times in 19 posts
Default DrawRegion - start & end at specific time

Hi all;

I have used 'DrawRegion' to fill between two plots but I want the fill to start and end at specific times. I have done the following:

In the 'Initialize' I have:

private DateTime zonestart;
private DateTime zoneend;

'OnBarUpdate'

zonestart = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 08, 30, 0);
zoneend = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, 15, 14, 0);

DrawRegion("Zone", zonestart, zoneend, HighestHigh, LowestLow,Color.Empty, Color.Blue, opacity);

I still have my plots/dataseries on the chart that I want to fill between but no fill. If I use '0' and 'CurrentBar' instead of 'zonestart' etc I get a fill but it doesn't terminate until midnight. The help file isn't particularly helpful as it only gives an example for 'BarsAgo'. I have tried putting in the times '083000' and '151400' but that doesn't work either. Also tried turning these into integers with 'int zonestartBarsAgo = GetBar(zonestart);' This didn't work either.

What is the obvious answer I am missing please.

Thanks;

Ben.
stocktraderbmp is offline  
Reply With Quote
Old 05-21-2012, 07:19 AM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Ben,
Thanks for writing in and I am happy to assist you.

If you change the code to as below can you get the right fill.
Code:
this.DrawRegion("tag" + Time[0].Date.ToString(), zonestart, zoneend, Upper, Lower, Color.Blue, Color.Blue, 3);
Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Joydeep for this post:
Old 05-21-2012, 07:32 AM   #3
stocktraderbmp
Senior Member
 
Join Date: Jun 2011
Location: Ireland
Posts: 184
Thanks: 32
Thanked 20 times in 19 posts
Default

Thanks for your help ! Works perfectly.
stocktraderbmp is offline  
Reply With Quote
Old 05-21-2012, 07:33 AM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Ben,
Glad to know everything is working fine at your end.

Please let me know if I can assist you any further.
NinjaTrader_Joydeep 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
Session start and end time BobTN Version 7 Beta General Questions & Bug Reports 1 08-04-2010 04:10 PM
candle stick start time and end time coffeedan Charting 5 05-19-2010 12:51 PM
Strategy Start Time and End Time kaywai Strategy Development 1 03-24-2010 05:19 AM
Start & end times for FOREX bmaltz Charting 3 05-02-2007 04:50 PM
Session Start/End Time MindSabre General Programming 1 04-29-2007 12:29 AM


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