Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, aliswee), 835 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Counter of higher highs and lower lows #482147
01/03/21 17:06
01/03/21 17:06
Joined: Aug 2020
Posts: 59
London
Neb Offline OP
Junior Member
Neb  Offline OP
Junior Member

Joined: Aug 2020
Posts: 59
London
Hi,

Not sure if this a right place for this question.
I suppose there is no function which could tell me how many higher highs I have in n period (did not find it) ?
Similar I would need for lower lows.

So, what is in my current level of knowledge is to do with function and loop through series of prices inside.

Is there some faster and more efficient way ?

Thanks,

Neb

Re: Counter of higher highs and lower lows [Re: Neb] #482153
01/03/21 19:54
01/03/21 19:54
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
If you're only using one price series, your custom indicator can be quite efficient. Why not give it a shot?
https://zorro-trader.com/manual/en/tutorial_lowpass.htm
https://zorro-trader.com/manual/en/series.htm
https://zorro-trader.com/manual/en/price.htm

Re: Counter of higher highs and lower lows [Re: AndrewAMD] #482154
01/03/21 22:41
01/03/21 22:41
Joined: Aug 2020
Posts: 59
London
Neb Offline OP
Junior Member
Neb  Offline OP
Junior Member

Joined: Aug 2020
Posts: 59
London
I created something like this:


int countHH(vars Highs, int days)
{
int i=0;
int counter=0;
for(i=0; i<days-1; i++)
{
if (Highs[i]>Highs[i+1])
counter++;
}
// printf("\nHigher highs : %i ",counter );
return counter;
}

int countLL(vars Lows, int days)
{
int i=0;
int counter=0;
for(i=0; i<days-1; i++)
{
if (Lows[i]>Lows[i+1])
counter++;
}
// printf("\nLower lows: %i ",counter );
return counter;
}


And Highs is defined as series inside run() as:

vars Highs = series(priceHigh());


Does it make sense ?

Neb

Re: Counter of higher highs and lower lows [Re: Neb] #482155
01/04/21 00:56
01/04/21 00:56
Joined: Feb 2017
Posts: 1,718
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,718
Chicago
So far so good. At least your code is clear.

First, you have an error in the countLL function - you'll want to change ">" to "<".

Next, what is your definition of highest-highs in a period? Is it when the high is higher than the previous high, or is it when a new record is set? It seems you are doing the former and not the latter.

Re: Counter of higher highs and lower lows [Re: AndrewAMD] #482158
01/04/21 10:52
01/04/21 10:52
Joined: Aug 2020
Posts: 59
London
Neb Offline OP
Junior Member
Neb  Offline OP
Junior Member

Joined: Aug 2020
Posts: 59
London
Originally Posted by AndrewAMD
So far so good. At least your code is clear.


Thanks !

Originally Posted by AndrewAMD

First, you have an error in the countLL function - you'll want to change ">" to "<".


You are so right laugh Not sure how I missed that.

Originally Posted by AndrewAMD

Next, what is your definition of highest-highs in a period? Is it when the high is higher than the previous high, or is it when a new record is set? It seems you are doing the former and not the latter.


Strategy is comparing highs and lows as momentum condition, so don't need record, but just number of higher highs and lower lows in the same period.

if(countHH(Highs,WindowPeriod)>countLL(Lows,WindowPeriod) and ...) enterLong and opposite for short.



Thanks one more time, you are helping me very much !

Best regards,

Neb


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1