Gamestudio Links
Zorro Links
Newest Posts
A9
by 3run. 07/08/20 18:44
Historical ticks for Lookback backfill
by Zheka. 07/08/20 09:10
Trade Mode without a broker
by jj02520024. 07/08/20 01:20
How to handle algo name in Simulate.c
by happysun. 07/07/20 08:56
Erasing a datapoint in a plot array
by jcl. 07/06/20 09:51
typo
by jcl. 07/06/20 09:44
Video Panel System
by Emre. 07/06/20 09:39
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
7 registered members (3run, Quad, FLD, deus777, Ayumi, jenGs, kvm), 425 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
TraderKevin, deus777, carolthesecond, Roger399, vrindger
18474 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Indicator coding [Re: danatrader] #480427
06/06/20 11:33
06/06/20 11:33
Joined: May 2015
Posts: 267
Czech Republic
G
Grat Offline
Member
Grat  Offline
Member
G

Joined: May 2015
Posts: 267
Czech Republic
Depend on the theory:

Psychological Line is an indicator developed by Ken Muranaka.
The indicator’s values may range from 0 to 100. It is a simple indicator which shows the number of increasing/decreasing prices over a specified period; thereby is a means for deter- mining the overbought/oversold price level. The standard calculation of the indicator is as follows:

PI= n/12 ∗100

where n is the number of days(period) that the price is closed higher than the previous period.
n and the number of comparison days (i.e. 12) in the above calculation are subject to change.

[Linked Image]

Attached Files
Last edited by Grat; 06/06/20 11:37.
Re: Indicator coding [Re: danatrader] #480428
06/06/20 11:35
06/06/20 11:35
Joined: Mar 2019
Posts: 182
D
danatrader Offline OP
Member
danatrader  Offline OP
Member
D

Joined: Mar 2019
Posts: 182
Yes, I was originally thinking that for the Sierra Chart developer too, but a nice effect can be achieved by just switching the length of the comparision period with indicator period.
Then it would be somewhat upside down.

I will try your way, actually it needs to be smoothed, anyway, I will work on it a bit.

it is a nice sample for me to learn more coding and the behaviour of Zorro.

Just I don't get, how I would let the sumDN / sumUP shift, since comparing the complete periods is not so good.
The periods compared should be created by HTDcPeriod / DominantPeriod.

Re: Indicator coding [Re: danatrader] #480429
06/06/20 11:38
06/06/20 11:38
Joined: May 2015
Posts: 267
Czech Republic
G
Grat Offline
Member
Grat  Offline
Member
G

Joined: May 2015
Posts: 267
Czech Republic
Yes, for this I not finish, me code is only draft. Now I work on finish version.

Re: Indicator coding [Re: danatrader] #480430
06/06/20 11:53
06/06/20 11:53
Joined: Mar 2019
Posts: 182
D
danatrader Offline OP
Member
danatrader  Offline OP
Member
D

Joined: Mar 2019
Posts: 182
I promise you, it is so simple logic, but you can pipe anything through and it is really powerful.

E.g. preprocess Data with only candles matching a given ATR condition.

NumWhiteBlack(ATR(24)/3, 0, 1) or the moving average of it.
And so on...

Just my plot looks different from yours, I assume you did already change the code postet before.

Last edited by danatrader; 06/06/20 12:02.
Re: Indicator coding [Re: danatrader] #480440
06/06/20 19:04
06/06/20 19:04
Joined: Mar 2019
Posts: 182
D
danatrader Offline OP
Member
danatrader  Offline OP
Member
D

Joined: Mar 2019
Posts: 182
Grat,

I think there is something not as it should be, look at the plot below.
I did try already to change your code, eventually I will get it done, just if you say yours is not nice, mine will be horrible.... laugh

double idxPL(){
int sumUP = AssetInt[_SUM_PLUS];
int sumDN = AssetInt[_SUM_MINUS];
var pl=0;
if (priceClose() > priceClose(1)){
sumUP++;
sumDN=0;
pl=(sumUP/12.0)*100;
}

if (priceClose() < priceClose(1)){
sumUP=0;
sumDN++;
pl=-(sumDN/12.0)*100;
}
//watch("\n",sumDN,sumUP,pl);
AssetInt[_SUM_PLUS] = sumUP;
AssetInt[_SUM_MINUS]= sumDN;

return pl;

}


I think it goes too sharp down, as far I understand, the code above returns either the minus count or the plus count.
But in case to make your idea work with the down count, ther must be something like sumUP-sumDN if sumUP is bigger than sumDN, and the other way round sumDown - sumUP if sumDN is bigger than sumUP.

Of course only, if the opposite bar / close occurs.



Attached Files
PSL-Plot.png (4 downloads)
Last edited by danatrader; 06/07/20 05:29.
Re: Indicator coding [Re: danatrader] #480450
06/07/20 05:45
06/07/20 05:45
Joined: Mar 2019
Posts: 182
D
danatrader Offline OP
Member
danatrader  Offline OP
Member
D

Joined: Mar 2019
Posts: 182
How would I make it to oscillate between 100 and 0.
For me it is about also about understanding the tool (Zorro functions).

The version of Petra is simple, just it goes beyond 100 as max. value.
So I would just use the Max function?

Re: Indicator coding [Re: danatrader] #480451
06/07/20 06:50
06/07/20 06:50
Joined: May 2015
Posts: 267
Czech Republic
G
Grat Offline
Member
Grat  Offline
Member
G

Joined: May 2015
Posts: 267
Czech Republic
theory:

Quote
where n is the number of days(period) that the price is closed higher than the previous period.


but

zorro fce sumUp - not calculate how many is close Price higher the price older, but sumOfprice if is highers

Code
var vUp, vDn;
var ProfitFactor(var* Data,int Length)
{
	vUp = 0.,vDn = 0.;
	for(int i=1; i<Length; i++) {
		if(Data[i-1] > Data[i])
			vUp += Data[i-1]-Data[i];
		else
			vDn += Data[i]-Data[i-1];
	}
	if(vDn == 0.) 
		return vUp == 0.? 1. : 10.;
	return Clamp(vUp/vDn,0.,9.999);
}

var SumUp(var* Data,int Length)
{
	ProfitFactor(Data,Length);
	return vUp;
}

Re: Indicator coding [Re: danatrader] #480453
06/07/20 06:56
06/07/20 06:56
Joined: Mar 2019
Posts: 182
D
danatrader Offline OP
Member
danatrader  Offline OP
Member
D

Joined: Mar 2019
Posts: 182
That is I assume it would need before the SumUp this

if (priceClose() > priceClose(1)){

still I really need the original version.

Can we get there together?
I can then show you why.

BTW, can you crack the EUR/CAD laugh

Re: Indicator coding [Re: danatrader] #480454
06/07/20 07:28
06/07/20 07:28
Joined: Mar 2019
Posts: 182
D
danatrader Offline OP
Member
danatrader  Offline OP
Member
D

Joined: Mar 2019
Posts: 182
But even using the code from Petra, I don't get it oscillating between 0 and 100.
What would I need to do to get it / any line oscillating between 0 / 100?

Re: Indicator coding [Re: danatrader] #480455
06/07/20 07:35
06/07/20 07:35
Joined: May 2015
Posts: 267
Czech Republic
G
Grat Offline
Member
Grat  Offline
Member
G

Joined: May 2015
Posts: 267
Czech Republic
I don't know, how looking the original idx. Like this?

Attached Files
Page 2 of 3 1 2 3

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