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
Getting current day indicator value in a multi time series strat. (OnBarClose = true)
Collapse
X
-
Getting current day indicator value in a multi time series strat. (OnBarClose = true)
Hello! Can you please advise on how can I get the current value of an indicator (for example SAR) of the current day from a secondary daily data series if my strategy runs in OnBarClose mode? For getting OHLC values I use Bars.GetOpen()/GetHigh()/GetLow and GetClose. Is there any analogue for indicators' data?Tags: None
-
Hello,
Thank you for the post.
I wanted to clarify, are you trying to access the SAR for the Daily bars from a more granular timeframe?
There are two ways to use each indicator, you can call the indicator for the current series or you can supply a series to it. If you are referring to getting the Daily value or the value using the daily bars, you could pass a daily bar series to the SAR:
Code:ParabolicSAR(ISeries<double> input, double acceleration, double accelerationStep, double accelerationMax)[int barsAgo]
Code:ParabolicSAR(BarsArray[1], 0.2, 0.2, 0.2)[0] BarsArray[IndexOfYourDailyBars]
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Hello Jesse! Thank you for your answer!
I am trying to access the Daily SAR current day value from a 5 minute time frame within a strategy that runs in OnBarClose mode.
In State == State.DataLoaded I am adding the SAR indicator using the formula that you have provided (and assigning it to a variable - "dailySar"), but later when I access this variable from the OnBarUpdate() method like "dailySar[0]" I am receiving the value of the previous day SAR - not the current day because the strategy runs in OnBarClose mode and 0 bar on the Daily time frame is previous day, since current day is not yet closed.
So my question is how I can get the current value of the Daily SAR while my strategy runs in OnBarClose mode on a more granular time frame?
Comment
-
Hello,
Thank you for the reply.
Yes, that would be the case when using OnBarClose. To get the current value, you would need to be able to reference the current bar but that would only be available when running the script OnEachTick or OnPriceChange.
You would very likely need to change to using OnEachTick or OnPriceChange and If that were to affect your logic, you would likely need to convert your script to also use IsFirstTickOfBar to simulate OnBarClose events for that portion of your logic.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WHICKED, 03-27-2024, 12:33 PM
|
4 responses
41 views
0 likes
|
Last Post Today, 12:28 AM | ||
Started by f.saeidi, Today, 12:12 AM
|
0 responses
3 views
0 likes
|
Last Post
by f.saeidi
Today, 12:12 AM
|
||
Started by Conall, Today, 12:06 AM
|
0 responses
5 views
0 likes
|
Last Post
by Conall
Today, 12:06 AM
|
||
Started by proptradingshop, 03-21-2024, 09:50 AM
|
6 responses
27 views
0 likes
|
Last Post Today, 12:02 AM | ||
Started by mly916, Yesterday, 09:48 PM
|
1 response
12 views
0 likes
|
Last Post Yesterday, 11:54 PM |
Comment