1+ using System ;
2+
13namespace TALib
24{
35 public static partial class Core
46 {
57 public static RetCode Ppo ( double [ ] inReal , int startIdx , int endIdx , double [ ] outReal , out int outBegIdx , out int outNbElement ,
6- MAType optInMAType , int optInFastPeriod = 12 , int optInSlowPeriod = 26 )
8+ MAType optInMAType = MAType . Sma , int optInFastPeriod = 12 , int optInSlowPeriod = 26 )
79 {
810 outBegIdx = outNbElement = 0 ;
911
@@ -20,12 +22,12 @@ public static RetCode Ppo(double[] inReal, int startIdx, int endIdx, double[] ou
2022
2123 var tempBuffer = new double [ endIdx - startIdx + 1 ] ;
2224
23- return TA_INT_PO ( inReal , startIdx , endIdx , tempBuffer , out outBegIdx , out outNbElement , optInFastPeriod , optInSlowPeriod ,
24- optInMAType , outReal , true ) ;
25+ return TA_INT_PO ( inReal , startIdx , endIdx , outReal , out outBegIdx , out outNbElement , optInFastPeriod , optInSlowPeriod ,
26+ optInMAType , tempBuffer , true ) ;
2527 }
2628
2729 public static RetCode Ppo ( decimal [ ] inReal , int startIdx , int endIdx , decimal [ ] outReal , out int outBegIdx , out int outNbElement ,
28- MAType optInMAType , int optInFastPeriod = 12 , int optInSlowPeriod = 26 )
30+ MAType optInMAType = MAType . Sma , int optInFastPeriod = 12 , int optInSlowPeriod = 26 )
2931 {
3032 outBegIdx = outNbElement = 0 ;
3133
@@ -42,18 +44,18 @@ public static RetCode Ppo(decimal[] inReal, int startIdx, int endIdx, decimal[]
4244
4345 var tempBuffer = new decimal [ endIdx - startIdx + 1 ] ;
4446
45- return TA_INT_PO ( inReal , startIdx , endIdx , tempBuffer , out outBegIdx , out outNbElement , optInFastPeriod , optInSlowPeriod ,
46- optInMAType , outReal , true ) ;
47+ return TA_INT_PO ( inReal , startIdx , endIdx , outReal , out outBegIdx , out outNbElement , optInFastPeriod , optInSlowPeriod ,
48+ optInMAType , tempBuffer , true ) ;
4749 }
4850
49- public static int PpoLookback ( MAType optInMAType , int optInFastPeriod = 12 , int optInSlowPeriod = 26 )
51+ public static int PpoLookback ( MAType optInMAType = MAType . Sma , int optInFastPeriod = 12 , int optInSlowPeriod = 26 )
5052 {
5153 if ( optInFastPeriod < 2 || optInFastPeriod > 100000 || optInSlowPeriod < 2 || optInSlowPeriod > 100000 )
5254 {
5355 return - 1 ;
5456 }
5557
56- return MaLookback ( optInMAType , optInSlowPeriod <= optInFastPeriod ? optInFastPeriod : optInSlowPeriod ) ;
58+ return MaLookback ( optInMAType , Math . Max ( optInSlowPeriod , optInFastPeriod ) ) ;
5759 }
5860 }
5961}
0 commit comments