NinjaTrader Support Forum  
X

Attention!

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


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

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 10-05-2008, 11:42 AM   #1
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default price at specific time

Hi,

I wish to set such a condition in my startegy: Current Asking Price is bigger than Session Opening Price (at 9:30).
Below, I attach part of a code, please take a look at that and say what I did wrong.
I compiled this code and strategy works fine, but it triggers despite a condition is NOT done.


protected override void OnBarUpdate()
{
if (ToTime(Time[0]) >= 93000 && ToTime(Time[0]) <= 160000)

{

int opening = GetBar(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 9, 30, 0));
{

if (GetCurrentAsk() > Close[opening]);

{ //do sth
}}}}
Kowal is offline  
Reply With Quote
Old 10-05-2008, 04:19 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

For opening just use the CurrentDayOHL() indicator.

More information - http://www.ninjatrader-support.com/H...entDayOHL.html
NinjaTrader_Ray is offline  
Reply With Quote
Old 10-06-2008, 08:43 AM   #3
Kowal
Member
 
Join Date: Sep 2008
Location: CT
Posts: 48
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to Kowal
Default

Well,
it was surprisingly easy - I solved that in a St Wizard.
Thanks Ray for good advice.
Kowal 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
Plot High Low of a specific time vidda Indicator Development 5 08-27-2008 12:51 PM
How to get the highest/lowest close of a specific time range. strategy1 General Programming 4 07-23-2008 10:18 PM
How to access price range of specific time period. strategy1 General Programming 1 07-22-2008 03:18 PM
Plots during specific time frame blaporte Indicator Development 1 01-19-2008 02:55 PM
Price data on specific time frame. The Shadow Indicator Development 4 03-17-2007 01:04 PM


All times are GMT -6. The time now is 11:34 AM.