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
Access property of custom BarsType from Indicator OnBarUpdate
Collapse
X
-
Welcome to the forums remcovdmeulen!
I have attached an example BarsType and Indicator showing how this can be done.
Let me know if you have any questions.
-
Access property of custom BarsType from Indicator OnBarUpdate
Hello,
I have created a custom BarsStyle (MyCustomBarsType) with a public property named MaxBoundary.
I also create a custom Indicator (MyCustomIndicator).
I want to read the MaxBoundary property in MyCustomIndicator.OnBarUpdate().
I'm not sure if this is the right approach:
protected override void OnBarUpdate()
{
MyCustomBarsType barsType = (MyCustomBarsType)Bars.BarsType;
double max = barsType.MaxBoundary;
}
Casting the Bars.BarsType gives me a casting exception:
[A]NinjaTrader.NinjaScript.BarsTypes.MyCustomBarsType cannot be cast to [B]NinjaTrader.NinjaScript.BarsTypes.MyCustomBarsType . Type A originates from '02e059d8a7514a8888f4c7b11dc7e21e, Version=8.0.25.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadFrom' at location 'C:\Users\myuser\OneDrive\Documents\NinjaTrader 8\tmp\02e059d8a7514a8888f4c7b11dc7e21e.dll'. Type B originates from '2eacf33ca9c8476f8048f37791276a65, Version=8.0.25.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadFrom' at location 'C:\Users\myuser\OneDrive\Documents\NinjaTrader 8\tmp\2eacf33ca9c8476f8048f37791276a65.dll'.
Is the way I am trying to read this custom property the right way or must I try a different approach?Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pechtri, 06-22-2023, 02:31 AM
|
10 responses
124 views
0 likes
|
Last Post Today, 12:03 AM | ||
Started by judysamnt7, 03-13-2023, 09:11 AM
|
4 responses
59 views
0 likes
|
Last Post
by DynamicTest
Yesterday, 08:25 PM
|
||
Started by ScottWalsh, Yesterday, 06:52 PM
|
4 responses
36 views
0 likes
|
Last Post
by ScottWalsh
Yesterday, 07:40 PM
|
||
Started by olisav57, Yesterday, 07:39 PM
|
0 responses
7 views
0 likes
|
Last Post
by olisav57
Yesterday, 07:39 PM
|
||
Started by trilliantrader, Yesterday, 03:01 PM
|
2 responses
22 views
0 likes
|
Last Post
by helpwanted
Yesterday, 07:25 PM
|
Leave a comment: