Hi

I am trying to create an indicator similar to the espectral indicator. In this case it suppose to detect cluster zones by counting the number of times that the price close into a grid level.
For that, I divide the price data into a grid and I count the number of close between each line of the grid.
It could be used in a tick level to know at which prices there are more ticks located with m1 bars or in longer periods of time for breakouts in daily bars.
I am not sure if it would bring something or not depends on the use or what it comes from it. The clusters zones can be understood as stables nodes in a phase space where the price tends to stay and the zones where there are less number of price quotes can be interpreted as unstable nodes. And well, if the momentum is calculated then one could get a picture of the gradient field around those areas too. So if the price is at the correct distance from the stable node, one could think that the price is going to scape from the node, but if the gradient is weak, then it wont. And ofc maybe pattern recognition would help to detect the current gradient and compare to historical gradients at the same cluster to predict the price movement of the price into that gradient (just brainstorming a bit)

Here is the code:

Quote:
int Cluster(var* Data, int Period, var grid, int position)
{

var high = LL(Period);
var low = HH(Period);
int divi = (high-low)/grid;
static var ArrayPrice[1000]; //to save the prices of each grid limit
static var Counter[1000]; //to count the number of close in each grid
var a;
int c;
int i;

ArrayPrice[0]=low;
for(i=1;i<divi;i++)
{
ArrayPrice[i]=ArrayPrice[i-1]+grid;
}

for(i=0;i<divi;i++)
{
if(Data[0]>=ArrayPrice[i] and Data[0]<ArrayPrice[i+1])
{
Counter[i]=Counter[i]+1;
}
}

return Counter[position]; //I create similar grid in the function run so I know at which position in the grid the //current price is and I return the number of closes at that position

}

Last edited by Nanitek; 05/12/16 12:03.