11namespace StockSharp . Algo . Gpu . Indicators ;
22
3- using System . Reflection ;
4-
53/// <summary>
64/// Parameter set for GPU Know Sure Thing (KST) calculation.
75/// </summary>
@@ -95,14 +93,14 @@ public readonly void FromIndicator(IIndicator indicator)
9593
9694 if ( indicator is KnowSureThing kst )
9795 {
98- self . Roc1Length = GetLength ( kst , "_roc1" , self . Roc1Length , defaults . Roc1Length ) ;
99- self . Roc2Length = GetLength ( kst , "_roc2" , self . Roc2Length , defaults . Roc2Length ) ;
100- self . Roc3Length = GetLength ( kst , "_roc3" , self . Roc3Length , defaults . Roc3Length ) ;
101- self . Roc4Length = GetLength ( kst , "_roc4" , self . Roc4Length , defaults . Roc4Length ) ;
102- self . Sma1Length = GetLength ( kst , "_sma1" , self . Sma1Length , defaults . Sma1Length ) ;
103- self . Sma2Length = GetLength ( kst , "_sma2" , self . Sma2Length , defaults . Sma2Length ) ;
104- self . Sma3Length = GetLength ( kst , "_sma3" , self . Sma3Length , defaults . Sma3Length ) ;
105- self . Sma4Length = GetLength ( kst , "_sma4" , self . Sma4Length , defaults . Sma4Length ) ;
96+ self . Roc1Length = kst . Roc1 . Length ;
97+ self . Roc2Length = kst . Roc2 . Length ;
98+ self . Roc3Length = kst . Roc3 . Length ;
99+ self . Roc4Length = kst . Roc4 . Length ;
100+ self . Sma1Length = kst . Sma1 . Length ;
101+ self . Sma2Length = kst . Sma2 . Length ;
102+ self . Sma3Length = kst . Sma3 . Length ;
103+ self . Sma4Length = kst . Sma4 . Length ;
106104 self . SignalLength = kst . Signal ? . Length ?? defaults . SignalLength ;
107105 }
108106
@@ -118,18 +116,7 @@ public readonly void FromIndicator(IIndicator indicator)
118116 }
119117
120118 private static int EnsurePositive ( int value , int fallback )
121- => value > 0 ? value : fallback ;
122-
123- private static int GetLength ( KnowSureThing indicator , string fieldName , int currentValue , int fallback )
124- {
125- var field = typeof ( KnowSureThing ) . GetField ( fieldName , BindingFlags . Instance | BindingFlags . NonPublic ) ;
126- if ( field ? . GetValue ( indicator ) is LengthIndicator < decimal > lengthIndicator )
127- {
128- return EnsurePositive ( lengthIndicator . Length , fallback ) ;
129- }
130-
131- return EnsurePositive ( currentValue , fallback ) ;
132- }
119+ => value > 0 ? value : fallback ;
133120}
134121
135122/// <summary>
0 commit comments