Login Page - Create Account

Support Board


Date/Time: Fri, 29 Nov 2024 17:52:12 +0000



Post From: ACSIL: sc.ATR() - Output SCFloatArrayRef FloatArrayOut_2: No Vulues

[2020-04-10 14:47:20]
User36703 - Posts: 29
Hello,

please can somebody help me with the issue below. I am not able to get the ATR array output (FloatArrayOut_2) from the function.

I am using this syntax according the intructions:
SCFloatArrayRef ATR(SCBaseDataRef BaseDataIn, SCFloatArrayRef FloatArrayOut_1, SCFloatArrayRef FloatArrayOut_2 , int Length, unsigned int MovingAverageType);

Code:

sc.AutoLoop = 1;

SCFloatArray TrueRangeArray;
SCFloatArray AverageTrueRangeArray;

if (CalculationMethod == 1)

{
BarIndex = sc.Index;
}

else if (CalculationMethod == 0) { BarIndex = sc.Index - 1; }

int ATRPeriodLength = Input_ATRPeriodLength.GetInt();

sc.DataStartIndex = ATRPeriodLength - 1;

sc.ATR(sc.BaseDataIn, TrueRangeArray, AverageTrueRangeArray, ATRPeriodLength, MOVAVGTYPE_SIMPLE);

float actualTR = TrueRangeArray[BarIndex];
float actualATR = AverageTrueRangeArray[BarIndex];

I get actualTR value from the function, but I am not able to get values from AverageTrueRangeArray output, only zero is returned.

Thank you.