Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Get # of Sessions
Collapse
X
-
Get # of Sessions
Hi guys, Is there a way to get the # of sessions that have occurred since a backtest started? My primary series is BetterRenko 4, but I want to test how many days have passed during the backtest for my primary series.Tags: None
-
Thanks, one other question, I want to get the close of two sessions ago, like PriorDayOHLC().PriorClose[x] but how do you get it to look back two sessions and not just 1?
Thanks
Comment
-
Hello elitetradernyc,
This is something also that would have to be calculated if you want to use the PriorDayOHCL() indicator as well.
Since you are checking for the start of a session you can save the bar that new session starts on so that you can reference it later inside of the PirorDayOHLC().PriorClose[x] so since you know what bar the session started on you can use the "CurrentBar" minus the variable that has the variable that is storing what bar the session you want to access it from.
Let me know if you have any questions.JCNinjaTrader Customer Service
Comment
-
Originally posted by elitetradernyc View PostThanks, one other question, I want to get the close of two sessions ago, like PriorDayOHLC().PriorClose[x] but how do you get it to look back two sessions and not just 1?
Thanks
Code:PriorDayOHLC().PriorClose[GetBar(Time[0].AddDays(-1))]
Comment
-
Thanks, I was adding an array to store all the previous values and that really slowed down my backtests, perhaps ill try doing it another way.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by CortexZenUSA, Today, 12:53 AM
|
0 responses
1 view
0 likes
|
Last Post
by CortexZenUSA
Today, 12:53 AM
|
||
Started by CortexZenUSA, Today, 12:46 AM
|
0 responses
0 views
0 likes
|
Last Post
by CortexZenUSA
Today, 12:46 AM
|
||
Started by usazencortex, Today, 12:43 AM
|
0 responses
2 views
0 likes
|
Last Post
by usazencortex
Today, 12:43 AM
|
||
Started by sidlercom80, 10-28-2023, 08:49 AM
|
168 responses
2,262 views
0 likes
|
Last Post
by sidlercom80
Today, 12:05 AM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
3 responses
10 views
0 likes
|
Last Post Yesterday, 11:58 PM |
Comment