Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
EasyLanguage to NinjaScript
Collapse
X
-
Good News, I was able to solve both problems.
The close problem was solved by making
CalculateOnBarClose = false;
as you suggested. However, the confusing thing was that the statement was sporadic in Initialize, but worked ok in OnStartUp.
The GetBar problem was solved by using:
if ( BarsInProgress == 0 ) { spx_cls = Close [GetBar ( dt )] ; }
if ( BarsInProgress == 1 ) { es_cls = Close [GetBar ( dt )] ; }
loading the variables at the start of session.
As always, thanks for your help.Last edited by RobinT; 02-27-2016, 02:49 PM.
-
could it be a timezone issue as I am 5 hrs ahead. Close is at 9pm local.
Leave a comment:
-
if I do
value1 = GetBar (dt) ;
I get value1 = 7 which is as expected.
value1 = BarsArray[0].GetBar (dt) ;
gives me 1169 which is strange
value1 = BarsArray[1].GetBar (dt) ;
gives me 1253 which is the right difference from 1169 but wrong.as it shd bearound 100.
Leave a comment:
-
I am using
value1 = BarsArray[1].GetBar (dt) ;
I get a strange answer
dt = 2/22/2016 9:00:00 PM
Leave a comment:
-
Yes, the GetNextBeginEnd is based on the Session Template and will work on Historical data.Should it work with Historical Charts? If I just have a daily chart, how would I get the close if I have to wait for the next days open ?
You would check the time of the Session End against the DateTime.Now or Time[0].
BarsArray[1].GetBar()If I wanted to get the close at a specific time of two charts with different periods, I could do:
spx_cls = Close [GetBar ( dt )] ;
es_cls = Closes[1][GetBar ( dt )]
if I wanted the bars ago count for channel [0] I could do:
back = GetBar ( dt ) ;
but how would I do it for channel [1]
Leave a comment:
-
do you think you can help me with this? Hoping to work over weekend.
Leave a comment:
-
I will try the sessionend first. Should it work with Historical Charts? If I just have a daily chart, how would I get the close if I have to wait for the next days open ?
also
If I wanted to get the close at a specific time of two charts with different periods, I could do:
spx_cls = Close [GetBar ( dt )] ;
es_cls = Closes[1][GetBar ( dt )]
if I wanted the bars ago count for channel [0] I could do:
back = GetBar ( dt ) ;
but how would I do it for channel [1]
Leave a comment:
-
You could compare the current bar timestamp (using CalculatOnBarClose = false) against the Session End. You can use GetNextBeginEnd to do so: http://ninjatrader.com/support/helpG...xtbeginend.htmbut the question still remains, how would I get the close value of a stock that closes at the NYSE close
Can you provide the exact scenario? Chart, instrument, and the script used?if i do closes [1][0] it gives me the close of the correct bar but closes[0][0] gives me the previous bar. these are historical charts.
BarsArray[1].GetBar()if I wanted the bars ago count for channel [0] I could do:
back = GetBar ( dt ) ;
but how would I do it for channel [1]
No, there is no way to order BarsInProgress. If the timestamp of the bars is the same BarsInProgress 0 is generally called first but there is no guarantee of that.is there an order to the BarsInProgress == , ie does 0 always get run first then 1 and so on ?
Leave a comment:
-
is there an order to the BarsInProgress == , ie does 0 always get run first then 1 and so on ?
Leave a comment:
-
I was wrong:
es_cls = Closes[1][GetBar ( dt )] ;
does not work.
with dt = 2/12/2016 9:00:00 PM
I get the wrong data for [1] and the correct data for [0].
Leave a comment:
-
If I wanted to get the close at a specific time of two charts with different periods, I could do:
spx_cls = Close [GetBar ( dt )] ;
es_cls = Closes[1][GetBar ( dt )]
if I wanted the bars ago count for channel [0] I could do:
back = GetBar ( dt ) ;
but how would I do it for channel [1]
Leave a comment:
-
I'm still trying to get the close value.
I have got the time sorted as I use es futures on stream 2 so I can use
time = day_close & BarsInProgress == 1
as the futures trade for 15 minutes after the close.
but the question still remains, how would I get the close value of a stock that closes at the NYSE close. Also, I use closes [0][0] to get the close price but this gives me the close price of the bar 5 minutes earlier.
Leave a comment:
-
This does occur in NinjaTrader 7. You can increment the bar by pressing the right arrow on your keyboard if you wanted to process bar by bar and analyze for example.Originally posted by RobinT View PostMy software only seems to run to the date on the screen. If I scroll to the lastbar then the software runs to completion.
Have I got one of the control commands (like overlay = true) set wrongly ?
Leave a comment:
-
My software only seems to run to the date on the screen. If I scroll to the lastbar then the software runs to completion.
Have I got one of the control commands (like overlay = true) set wrongly ?
Leave a comment:
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by kinfxhk, 07-14-2026, 09:39 AM
|
0 responses
127 views
0 likes
|
Last Post
by kinfxhk
07-14-2026, 09:39 AM
|
||
|
Started by kinfxhk, 07-13-2026, 10:18 AM
|
0 responses
105 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 10:18 AM
|
||
|
Started by kinfxhk, 07-13-2026, 09:50 AM
|
0 responses
85 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 09:50 AM
|
||
|
Started by kinfxhk, 07-13-2026, 07:21 AM
|
0 responses
105 views
0 likes
|
Last Post
by kinfxhk
07-13-2026, 07:21 AM
|
||
|
Started by kinfxhk, 07-11-2026, 02:11 AM
|
0 responses
86 views
0 likes
|
Last Post
by kinfxhk
07-11-2026, 02:11 AM
|

Leave a comment: