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 | ||
---|---|---|---|---|
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
9 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
5 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
||
Started by wzgy0920, 04-20-2024, 06:09 PM
|
2 responses
28 views
0 likes
|
Last Post
by wzgy0920
Yesterday, 10:43 PM
|
Comment