# Need help with Polynomial System Study

i just have a hard time understanding you Pseudo code. Maybe try to code it yourself first. That is the way to learn to code.

I have been playin a bit with this Python code to recognize patterns. I might post this code later (in a few weeks). I have to make sure it is functioning correctly. But basically is fits a pattern consisting of 3 MA's and 1 Polyfit and try to find the best historical patterns in order to make a prediction. Within the yellow box you see the pattern. The prediction is the white dots

2 Likes

That's fine. I will try to solve it

Regards
Ajesh

Hi Edward
I made the threshold calculation more static rather than using standard deviation. My observation from the initial round of testing, we can capture movement in the better way. I am attaching the api, i written to achieve the same

May be further refactoring and optimization possible for this.

``````function fun_velocity_ThresholdCalculation( velocity,lookback )
{
hhvSum = 0;
llvSum = 0;
idx = 0;
matrixVelocity = Matrix( lookback+ 1, 1, 0 );
for(index = BarCount-lookback; index < BarCount-1; index++)
{
matrixVelocity[idx][0] = velocity[index];
idx++;
}

sortedMatrix = MxSort(matrixVelocity, 1);
// printf("matsort" +sortedMatrix);

NbrOfBarForThresholdCal = 15;
for(index = 1;index <= NbrOfBarForThresholdCal;index++){
llvsum =  sortedMatrix[index][0] + llvsum;
}

numberOfRaws = MxGetSize(sortedMatrix,0);

for(index = numberOfRaws - NbrOfBarForThresholdCal; index<numberOfRaws;index++){
hhvsum = hhvsum + sortedMatrix[index][0];
}

llvavg = abs(llvsum)/NbrOfBarForThresholdCal;
hhvavg = abs(hhvsum)/NbrOfBarForThresholdCal;

threshold = IIf(hhvavg>llvavg,hhvavg,llvavg);

return threshold;
}

``````

Regards
Ajesh