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
How to make Indicator Values accessible by another indicator
Collapse
X
-
How to make Indicator Values accessible by another indicator
Hi, I have an indicator that plots each bars sum of bid and ask values. I want to make this indicators bar values store in history. This way I can access the bar history with other indicators. Is this possible? The indicator is attached. Anybody's help would be appreciated. Thanks,Tags: None
-
Hello woodyfox,
You would not be able to access historical bid/ask values within OnMarketData. See the 2nd note at the following link for more information.
You may use TickReplay to accomplish this, or you may consider using a secondary series of tick data, and calculate buys as those that traded above the previous trade and sells as those that traded below the last trade. This would give you a historical plot.
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
-
Here's what I got:
I pointed out in the strategy
Code:else if(state == state.dataloaded) { gomdeltavol = gomdeltavolume(multipler, true); addchartindicator(gomdeltavol); }
Code:protected override void OnMarketData(MarketDataEventArgs e) { if(backtest) { if (e.MarketDataType == MarketDataType.Last) { if (e.Price >= e.Ask) { Ask[0] += e.Volume; Print(e.Volume + " contracts traded at asking price " + e.Ask); } else if (e.Price <= e.Bid) { Bid[0] += e.Volume; Print(e.Volume + " Contracts Traded at bidding price " + e.Bid); } } }
Indicator 'GomDeltaVolume': Error on calling 'OnMarketData' method on bar -1: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
Comment
-
Hello woodyfox,
Does your strategy have a current bar check? See the following for more information,
What data series are you trying to access?
Here is a link that demonstrates how to access indicator values that are not plots,
I look forward to your reply.Alan P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by f.saeidi, Today, 11:02 AM
|
0 responses
0 views
0 likes
|
Last Post
by f.saeidi
Today, 11:02 AM
|
||
Started by geotrades1, Today, 10:02 AM
|
3 responses
10 views
0 likes
|
Last Post Today, 11:00 AM | ||
Started by rajendrasubedi2023, Today, 09:50 AM
|
3 responses
15 views
0 likes
|
Last Post Today, 10:57 AM | ||
Started by lorem, Today, 09:18 AM
|
2 responses
11 views
0 likes
|
Last Post Today, 10:55 AM | ||
Started by geddyisodin, Today, 05:20 AM
|
4 responses
30 views
0 likes
|
Last Post
by geddyisodin
Today, 10:45 AM
|
Comment