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 04-13-2008, 07:57 AM   #1
Sidhartha
Senior Member
 
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
Default Syntax of BarsArray with LowestBar() method

Hi Guys, One for Josh maybe...

Can I use the BarsArray[] call within the context of the LowestBar() Method...

Say I have two dataseries and I want to access LowestBar(Low,10) but for the dataseries represented by BarsInProgress==0 but when the code is invoked by a call from BarsInProgress==0. Is this possible...? If so, what's the syntax...??

Obviously it's easy for indicators as described in your example CCI(BarsArray[2],20)... or indeed for open, high, low close etc... in the syntax Low[0][20].... but is it possible to do this with methods such as LowestBar()...??

Many Thanks
Sidhartha is offline  
Reply With Quote
Old 04-13-2008, 08:21 AM   #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

Why would:

if (BarsInProgress == 0) Print(LowestBar(Low, 10));

not work?
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-13-2008, 08:44 AM   #3
Sidhartha
Senior Member
 
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Ray,

That would work except for this,

I'm executing into a 1 min bar dataseries (BarsInProgress==1)... my primary series is, say, 10 min bars.

When I place an entry order into the 1 min bar dataseries, I then place a stop via OnOrderUpdate()... and I want this stop price to be based off a price in the primary dataseries (10 min). However, when OnOrderUpdate() gets called in this context BarsInProgress==1 so somehow I have to access the primary data series when BarsInProgress==1 using the LowestBar() method...

Does that makes sense...?
Sidhartha is offline  
Reply With Quote
Old 04-13-2008, 09:11 AM   #4
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

Try this and see if it works.

if (BarsInProgress == 1) Print(LowestBar(Lows[0], 10));
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-13-2008, 09:23 AM   #5
Sidhartha
Senior Member
 
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
Default

Got it. Great Ray. All working now. Thanks.
Sidhartha is offline  
Reply With Quote
Old 04-13-2008, 09:29 AM   #6
Sidhartha
Senior Member
 
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
Default

Ray, while I've got you... one more question.

Is it possible to apply indicators to dataseries that you add to a strategy. For example, in this case, if my primary is 10 min bars, and I've added 1 mins bars via Add()... can I think apply, say, some SMA's to the 1 min bar dataseries and use those as part of my entry & exit methodology...??

Cheers
Sidhartha is offline  
Reply With Quote
Old 04-13-2008, 09:46 AM   #7
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

Yes you can.

In case you have not reviewed yet, please see this reference - http://www.ninjatrader-support.com/H...struments.html
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-13-2008, 09:55 AM   #8
Sidhartha
Senior Member
 
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
Default

Of course. Doh!! I even quoted an example of it in my orignal post to you!!!

Sorry, losing my mind.

Thanks
Sidhartha 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
NinjaScript LowestBar & HighestBar Documentation KBJ General Programming 3 06-11-2012 03:02 PM
HighestBar and LowestBar Sidhartha General Programming 14 04-07-2008 01:22 PM
Compiler bug or hidden syntax error sbgtrading General Programming 3 11-22-2007 07:14 AM
Syntax Warning on Ninja Editor but not Microsoft ct General Programming 2 10-05-2007 07:03 AM
BarsArray Intrabar Synchronization whitmark Strategy Development 2 06-27-2007 08:10 AM


All times are GMT -6. The time now is 06:13 AM.