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 Lele2k24, Yesterday, 11:24 AM
|
11 responses
36 views
0 likes
|
Last Post
by Lele2k24
Today, 03:00 PM
|
||
Started by RaygunWizzle, Yesterday, 08:52 PM
|
3 responses
11 views
0 likes
|
Last Post Today, 02:50 PM | ||
Started by Tim-c, Today, 08:36 AM
|
4 responses
14 views
0 likes
|
Last Post Today, 02:45 PM | ||
Started by JohnS52, 03-22-2024, 08:06 AM
|
4 responses
28 views
0 likes
|
Last Post
by JohnS52
Today, 02:30 PM
|
||
Started by carnitron, 03-25-2024, 01:59 PM
|
11 responses
53 views
0 likes
|
Last Post
by carnitron
Today, 02:18 PM
|
Comment