![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#31 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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?
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#32 |
|
Member
|
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.
|
|
|
|
|
|
#33 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#34 |
|
Member
|
How do I access the day's open in code?
|
|
|
|
|
|
#35 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
Hi occam, you can use the CurrentDayOHL indicator for this task - http://www.ninjatrader-support.com/H...entDayOHL.html
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#36 |
|
Member
|
I am using Print(CurrentDayOHL().CurrentOpen[0].ToString()); and I get a number that keeps changing through the day.
|
|
|
|
|
|
#37 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
|
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.
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#38 |
|
Member
|
I am using DTN IQ.
I am not doing any charting. |
|
|
|
|
|
#39 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#40 |
|
Member
|
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 |
|
|
|
|
|
#41 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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.
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#42 |
|
Member
|
No good.
It reports MSFT's open as 25.12 but it opened at 24.59 |
|
|
|
|
|
#43 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
What does a chart look like with the same indicator, series, and session template applied?
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#44 |
|
Member
|
Lets try a different approach. How would you access the opening 24.59 for MSFT in code?
Is it even possible in NT? |
|
|
|
|
|
#45 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
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.
Ryan M
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |