I have a simple formula that is calculating the FastK. I am using the ds array to allow me to access historical values as well. When I use the Print statement, it shows that it is calculating the formula properly, but it is not assigning the value to the specified array element. I have attached an image showing the output log. Anyone know why this would happen?
class FastK
{
public:
// Variablesint Length;
double ds[];
// Constructors
FastK(void){};
FastK(int length)
{
Length=length;
ArraySetAsSeries(ds,true);
};
void Calculate(int shift)
{
int bar = Bars-IndicatorCounted();
if (bar<Length)
return;
double lowest = Low[iLowest(NULL,0,MODE_LOW,Length,shift)];
double highest = High[iHighest(NULL,0,MODE_HIGH,Length,shift)];
double num = Close[shift]-lowest;
double den = highest-lowest;
if (den!=0)
{
ds[shift]=num/den*100;
Print("ds = ",ds[shift],", formula = ",num/den*100);
}
else
ds[shift]=0;
};
};
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I have a simple formula that is calculating the FastK. I am using the ds array to allow me to access historical values as well. When I use the Print statement, it shows that it is calculating the formula properly, but it is not assigning the value to the specified array element. I have attached an image showing the output log. Anyone know why this would happen?