NinjaTrader Support Forum  

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

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 09-29-2010, 03:06 PM   #31
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi Occam,

I'm sorry - I don't follow.

If you're using CurrentDayOHL in an indicator, it needs to be applied to an intraday series. Your steps indicated you applied this to a daily series.

Have you changed the series for this indicator to intraday (60 minute)? What are your results?
NinjaTrader_RyanM is offline  
Reply With Quote
Old 09-29-2010, 04:24 PM   #32
occam
Member
 
Join Date: Aug 2010
Posts: 89
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to occam
Default

I know I am getting confused myself. I have an indicator that, among other things, uses a daily moving average of the highs and the current day's open price. So through the day these inputs should be static, but I have not sorted out how to get these values in code yet.
occam is offline  
Reply With Quote
Old 09-29-2010, 04:47 PM   #33
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

It sounds like your indicator requires multiple series. I would get the values you expect for each component independently, in two separate indicators, and then work on creating a multiseries indicator from this.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 09-29-2010, 04:56 PM   #34
occam
Member
 
Join Date: Aug 2010
Posts: 89
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to occam
Default

How do I access the day's open in code?
occam is offline  
Reply With Quote
Old 09-30-2010, 03:22 AM   #35
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Hi occam, you can use the CurrentDayOHL indicator for this task - http://www.ninjatrader-support.com/H...entDayOHL.html
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 09-30-2010, 05:53 AM   #36
occam
Member
 
Join Date: Aug 2010
Posts: 89
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to occam
Default

I am using Print(CurrentDayOHL().CurrentOpen[0].ToString()); and I get a number that keeps changing through the day.
occam is offline  
Reply With Quote
Old 09-30-2010, 06:19 AM   #37
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Which chart and provider are you working on? Are you sure you're checking the value for the last Day and not the historical values for the other days?

Please compare directly to the indicator value when it's plotting on your chart.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 09-30-2010, 06:27 AM   #38
occam
Member
 
Join Date: Aug 2010
Posts: 89
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to occam
Default

I am using DTN IQ.

I am not doing any charting.
occam is offline  
Reply With Quote
Old 09-30-2010, 08:08 AM   #39
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

Hi Occam,

Charting is useful to compare values and see visually what is happening.

Please post some screenshots of your setup including the column configuration for your indicator.
NinjaTrader_RyanM is offline  
Reply With Quote
Old 09-30-2010, 09:15 AM   #40
occam
Member
 
Join Date: Aug 2010
Posts: 89
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to occam
Default

namespace NinjaTrader.Indicator
{
public class Key : Indicator
{

protected override void Initialize()
{
Add(PeriodType.Day, 1);
Add(new Plot(Color.FromKnownColor(KnownColor.MediumAquamar ine), PlotStyle.Line, "Key1"));
Overlay = false;
CalculateOnBarClose = true;
}

protected override void OnBarUpdate()
{
double f1 = CurrentDayOHL().CurrentOpen[0];

Print(Instrument.FullName.ToString());
Print(CurrentDayOHL().CurrentOpen[0].ToString());

Print(f1.ToString());



Key1.Set(f1);
}

}
}


Column values for indicator
Last
Day
1
50
False
White
Black
Key
TwoHundredFiftySix
False
Regular
Key
Data Series
Key1
Close
No
No
No
occam is offline  
Reply With Quote
Old 09-30-2010, 09:32 AM   #41
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

From the looks of it you still have this indicator applied to a daily series.

Please see my screenshot and set it up like this.
Attached Images
File Type: png maIntraDay.png (49.2 KB, 7 views)
NinjaTrader_RyanM is offline  
Reply With Quote
Old 09-30-2010, 09:38 AM   #42
occam
Member
 
Join Date: Aug 2010
Posts: 89
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to occam
Default

No good.

It reports MSFT's open as 25.12 but it opened at 24.59
occam is offline  
Reply With Quote
Old 09-30-2010, 09:53 AM   #43
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

What does a chart look like with the same indicator, series, and session template applied?
NinjaTrader_RyanM is offline  
Reply With Quote
Old 09-30-2010, 10:55 AM   #44
occam
Member
 
Join Date: Aug 2010
Posts: 89
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to occam
Default

Lets try a different approach. How would you access the opening 24.59 for MSFT in code?

Is it even possible in NT?
occam is offline  
Reply With Quote
Old 09-30-2010, 11:04 AM   #45
NinjaTrader_RyanM
NinjaTrader Customer Service
 
NinjaTrader_RyanM's Avatar
 
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
Default

We can't help you get a specific number.

First- look at your MSFT chart on daily to see what NinjaTrader displays.

If you want this value programatically - It's Open[0] with CalculateOnBarClose = false, on a daily series.
NinjaTrader_RyanM 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
How to program stop on close at close price foxido Strategy Development 1 04-02-2010 09:33 AM
Exit-on-close handling initiated after market close tooearly Automated Trading 3 08-05-2009 08:07 AM
CrossAbove Close & Close[0] different results un$ane Strategy Development 6 06-05-2009 09:59 AM
Enter at Close, Exit next day Close tjendra Strategy Development 3 04-08-2009 11:33 AM
Charting high/low/close and open/close widths gluebunny Charting 11 09-29-2008 10:47 AM


All times are GMT -6. The time now is 04:26 PM.