![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Member
Join Date: Jan 2009
Posts: 36
|
Normally, a simple moving average based on closing price, however if wanting it based on High from a BarsArray[], which of these is correct....
SMA(BarsArray[1].High, 20)[0] SMA(BarsArray[1], 20).High[0] SMA(BarsArray[1],20)[0].High Couldn't find any examples. Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 1,760
|
borland, you could start working with Highs[barsArrayIndex][barsAgo], which is a multi-dimensional array of all bars' highs. There is an equivalent array for all of the following: Opens, Lows, Closes, Volumes, and Times.
__________________
Austin, NinjaTrader Customer Service NinjaTrader is a FREE application for advanced charting, market analytics, system development and trade simulation. View schedule of upcoming online product training events. |
|
|
|
|
|
#3 |
|
Member
Join Date: Jan 2009
Posts: 36
|
Thanks Austin,
Then it must be this ... SMA(Highs[1],20)[0] for SMA based on intrabar high, and these SMA(BarsArray[1],20)[0] SMA(Closes[1],20)[0] for SMA based on closing bar price. I now see we have Highs[], Lows[], Closes[], Opens[]. So, since Closes[] is identical to BarsArray[] when used with SMA. Why is there a BarsArray[] method? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Hamburg / Lueneburg - Germany
Posts: 11,858
|
Correct, BarsArray[0] would for example equal Close[0] - it returns just the dataseries for the specifc bars object pointed to, while for example Closes etc would also offer a second parameter for referencing past index values of the bars object.
__________________
Bertrand, NinjaTrader Customer Service NinjaTrader is a FREE application for advanced charting, market analytics, system development and trade simulation. View schedule of upcoming online product training events. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| BarsArray | mballagan | Miscellaneous Support | 7 | 06-01-2009 04:20 PM |
| How to declare a BarsArray class? | atrader | General Programming | 8 | 04-22-2009 10:22 AM |
| BarsArray question | Jeff 15 | General Programming | 4 | 04-02-2009 11:05 AM |
| BarsArray properties | pippero | General Programming | 3 | 09-04-2008 08:54 AM |
| BarsArray Intrabar Synchronization | whitmark | Strategy Development | 2 | 06-27-2007 08:10 AM |