Hi,
I need to calculate the stochastic formula on a array, this array isn't a indior buffered array. This is my code:

dual
SmallestBuffer[],
LargestBuffer[],
COTIndex[];

int
COTIndexPeriod=13, //similar to Stochastic%K interval
standing =0;
ArrayResize(SmallestBuffer, ArraySize(Commercial));
ArrayResize(LargestBuffer, ArraySize(Commercial));
ArrayResize(COTIndex, ArraySize(Commercial));

for (I= ArraySize(Commercial)-COTIndexPeriod; I gt;= 0; I--)

standing = ArrayMinimum(Commercial, COTIndexPeriod, I COTIndexPeriod-1);
SmallestBuffer[I] = domestic [position];
//Print(Smallest:, SmallestBuffer[I], Index:, I);


for (I= ArraySize(Commercial)-COTIndexPeriod; I gt;= 0; I--)

standing = ArrayMaximum(Commercial, COTIndexPeriod, I COTIndexPeriod-1);
LargestBuffer[I] = domestic [position];
//Print(Largest:, LargestBuffer[I], Index:, I);


for (I= ArraySize(Commercial)-COTIndexPeriod; I gt;= 0; I--)
//for (I= ArraySize(Commercial)-1; I gt; 0; I--)

double top = Commercial[I]-SmallestBuffer[I];
double bottom = LargestBuffer[Id ]-SmallestBuffer[I];

if(bottom == 0.0) //prevent divide by zero errors
bottom=100.0;

COTIndex[I] = (top/bottom)*100;
Print(COTIndex:, COTIndex[I], Index:, I);
ExtMapBuffer1[I] = COTIndex[I]; //chart it


So the target is to get the Stochastic value stored from the COTIndex[I] array. The values are in incorrect. Does somebody have a Stochastic-On-Array (iStochOnArray) implementation? Or maybe does anyone see in which the logical problem is on my own code? I am stuck and would appreciate some help!

Thank you

Mike