![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Why would:
if (BarsInProgress == 0) Print(LowestBar(Low, 10)); not work?
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
|
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...? |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Try this and see if it works.
if (BarsInProgress == 1) Print(LowestBar(Lows[0], 10));
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
|
Got it. Great Ray. All working now. Thanks.
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#7 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Yes you can.
In case you have not reviewed yet, please see this reference - http://www.ninjatrader-support.com/H...struments.html
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Mar 2008
Posts: 111
Thanks: 0
Thanked 0 times in 0 posts
|
Of course. Doh!! I even quoted an example of it in my orignal post to you!!!
Sorry, losing my mind. Thanks |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |