Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (spacenomad, EvanTJ, Grant, AndrewAMD), 7,226 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Price clusters [Re: danatrader] #481265
08/20/20 09:42
08/20/20 09:42
Joined: Mar 2019
Posts: 357
D
danatrader Offline OP
Senior Member
danatrader  Offline OP
Senior Member
D

Joined: Mar 2019
Posts: 357
Would you be so kind to give some example for "Make a loop and count bins by checking low and high of each bar"?

That would be really great and I am sure others may benefit a lot from it too.

Re: Price clusters [Re: danatrader] #481267
08/20/20 10:27
08/20/20 10:27
Joined: Dec 2019
Posts: 55
ozgur Offline
Junior Member
ozgur  Offline
Junior Member

Joined: Dec 2019
Posts: 55
Sure.

Code
void run()
{
        int arrayHiLoLen = 1000;
        LookBack = 1000;

	var PIP10 = PIP * 10;
	
	var high = ceil(priceHigh(0) / PIP10) * PIP10;
	var low = ceil(priceLow(0) / PIP10) * PIP10;
	
	vars highs = series(high);
	vars lows = series(low);
	
	//
	if(!is(LOOKBACK)) {
		var highest = MaxVal(highs, arrayHiLoLen);
		var lowest = MinVal(lows, arrayHiLoLen);
		
		int arrLen = ((highest - lowest) / PIP10) + 1;
		
		int *binCount = zalloc(arrLen * sizeof(int));
		
		
		//
		int i;
		for (i = 0; i < arrayHiLoLen; i++) {
			int enIdx = (highs[i] - lowest) / PIP10;
			int stIdx = (lows[i] - lowest) / PIP10;
			
			int j;
			for (j = stIdx; j <= enIdx; j++) {
				binCount[j]++;
			}
		}
	

	        if(is(EXITRUN)) {
		    printf("\n");
		
		    int i;
		    for (i = 0; i < arrLen; i++) {
		        printf("%i ", binCount[i]);
		    }
		
		    printf("\n %f %f %i %f \n\n", lowest, highest, arrLen, PIP10);
	        }
        }
}


x-axis starts from "lowest" and increments in 10 pips to "highest". Bins are in binCount array e.g lowest count is in binCount[0], Highest in binCount[arrLen - 1]

Last edited by ozgur; 08/23/20 10:11.
Re: Price clusters [Re: danatrader] #481268
08/20/20 10:36
08/20/20 10:36
Joined: Mar 2019
Posts: 357
D
danatrader Offline OP
Senior Member
danatrader  Offline OP
Senior Member
D

Joined: Mar 2019
Posts: 357
AWESOME, I will check it tonight, thank you so much.

Page 2 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1