Currently I am getting prior day close price from priordayOHLC indicator due to FXCM as my data provider, as they don't provide last day close price. But using priordayOHLC, does not allow me to use the value in a daily or higher time frame chart. Is there any other way I could get prior day close price to calculate and use it in my ninjascirpt code? thanks in advance.
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
prior day close price
Collapse
X
-
prior day close price
Hi,
Currently I am getting prior day close price from priordayOHLC indicator due to FXCM as my data provider, as they don't provide last day close price. But using priordayOHLC, does not allow me to use the value in a daily or higher time frame chart. Is there any other way I could get prior day close price to calculate and use it in my ninjascirpt code? thanks in advance.Tags: None
-
Hi asmmbillah,
I'm not sure, I understand the issue with your data feed. You shouldn't need a separate indicator to determine prior day data.
I assume, you get market data for the entire session, be it as 1 min bars or greater.
To grab the close of the day before, just check on OnBarUpdate if the date of the bar is different from the date of the bar before.
If Yes, you have a day break in between and it just happened.
if (Times[1][0].Date != Times[1][1].Date) // true once a day when the first bar of the new day closes.
{
myYesterdayClose = Closes[1][1]; // goes back one bar = yesterday and grabs the close of such session.
You can also use IsFirstBarOfSession logic to identify the bar from which to go back one bar to grab the prior day close.
NT-Roland
-
Hello asmmbillah,
NT-Roland is suggesting that if the primary series is a daily series, High[1] would be the high of 1 bar ago, or 1 day ago.
If this is not achieving the goal, for reasons like applying a custom trading hours template, it is possible to add a minute series to the script with AddDataSeries and use this for the input series of the PriorDayOHLC indicator.
Chelsea B.NinjaTrader Customer Service
Comment
-
thanks everyone. I have replace priordayohlc close with adding add data series of daily bartype with period 1 and getting Closes[1][1]. That solved my issue. thanks again.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by XXtrader, Yesterday, 11:30 PM
|
2 responses
10 views
0 likes
|
Last Post
by XXtrader
Today, 03:07 AM
|
||
Started by Waxavi, Today, 02:10 AM
|
0 responses
6 views
0 likes
|
Last Post
by Waxavi
Today, 02:10 AM
|
||
Started by TradeForge, Today, 02:09 AM
|
0 responses
11 views
0 likes
|
Last Post
by TradeForge
Today, 02:09 AM
|
||
Started by Waxavi, Today, 02:00 AM
|
0 responses
2 views
0 likes
|
Last Post
by Waxavi
Today, 02:00 AM
|
||
Started by elirion, Today, 01:36 AM
|
0 responses
4 views
0 likes
|
Last Post
by elirion
Today, 01:36 AM
|
Comment