Hi,
I am wondering if its possible to nest complex objects inside of a VariableSeries or VariableObject, with each nested object containing its own members of VariableSeries or VariableObject type.
My use case:
I have an indicator - let's call it MyIndicator and I need to store a lot of repeating information. I could put each item as a member in MyIndicator. However, if I want to stick to Object Oriented concepts then it makes more sense to group these variables in a struct or class.
So instead of having:
class MyIndicator {
VariableSeries<int> HiPi_A_Bars
VariableSeries<double> HiPi_A_Price
VariableSeries<double> HiPi_A_Reg
VariableSeries<int> HiPi_B_Bars
VariableSeries<double> HiPi_B_Price
VariableSeries<double> HiPi_B_Reg
}
I would like something like
class MyIndicatorInfo {
VariableSeries<int> Bars
VariableSeries<double> Price
VariableSeries<double> Reg
}
class MyIndicator {
VariableObject<MyIndicatorInfo> HiPi_A
VariableObject<MyIndicatorInfo> HiPi_B
}
Is this possible? I'm not sure how I would declare 'MyIndicatorInfo' so that the VariableSeries members would be managed by MC.NET.
Organising and nesting variables in functions? [SOLVED]
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Organising and nesting variables in functions? [SOLVED]
Hello jarym,
Yes, that is possible to do that. Please find sample code attached.
Yes, that is possible to do that. Please find sample code attached.
- Attachments
-
- ClassVariables.pln
- (1.28 KiB) Downloaded 530 times