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
1 registered members (AndrewAMD), 945 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 1
Page 12 of 25 1 2 10 11 12 13 14 24 25
Re: Lapsa's very own thread [Re: Lapsa] #485076
01/15/22 01:00
01/15/22 01:00
Joined: Aug 2021
Posts: 237
L
Lapsa Offline OP
Member
Lapsa  Offline OP
Member
L

Joined: Aug 2021
Posts: 237
actually, I think Ulser Index (and R2) might be borked

Sharpe Ratio definitely was

after Zorro's update - suddenly started working

Re: Lapsa's very own thread [Re: Lapsa] #485077
01/15/22 02:16
01/15/22 02:16
Joined: Aug 2021
Posts: 237
L
Lapsa Offline OP
Member
Lapsa  Offline OP
Member
L

Joined: Aug 2021
Posts: 237
Ehlers Instantaneous Trend [LazyBear]

Code
var nz(var x, var y) {
	if (x != 0) return x;
	return y;	
}

function run() 
{
	set(PLOTNOW);
	StartDate = 20220114;
	BarPeriod = 1;
	LookBack = 100;
	BarMode = BR_FLAT;

	vars src = series(price());
	var a = .07;
	vars it = series(0, 3);
	it[0] =
		(a-((a*a)/4.0))*src[0]+0.5*a*a*src[1]
		-(a-0.75*a*a)*src[2]+2*(1-a)*nz(it[1], ((src[0]+2*src[1]+src[2])/4.0))
		-(1-a)*(1-a)*nz(it[2], ((src[0]+2*src[1]+src[2])/4.0));
	var lag=2.0*it[0]-it[2];
	plot("trend", it[0], MAIN, RED);
	plot("trigger", lag, MAIN, BLUE);
}


weird crap starts to happen once I try to extract a function

(original code)

Code
//
// @author LazyBear 
// 
// List of my public indicators: http://bit.ly/1LQaPK8 
// List of my app-store indicators: http://blog.tradingview.com/?p=970 
//
study(title="Ehlers Instantaneous Trend [LazyBear]", shorttitle="EIT_LB", overlay=true, precision=3)
src=input(hl2, title="Source")
a= input(0.07, title="Alpha", step=0.01) 
fr=input(false, title="Fill Trend Region")
ebc=input(false, title="Enable barcolors")
hr=input(false, title="Hide Ribbon")
it=(a-((a*a)/4.0))*src+0.5*a*a*src[1]-(a-0.75*a*a)*src[2]+2*(1-a )*nz(it[1], ((src+2*src[1]+src[2])/4.0))-(1-a )*(1-a )*nz(it[2], ((src+2*src[1]+src[2])/4.0))
lag=2.0*it-nz(it[2])
dl=plot(fr and (not hr)?(it>lag?lag:it):na, color=gray, style=circles, linewidth=0, title="Dummy")
itl=plot(hr?na:it, color=fr?gray:red, linewidth=1, title="Trend")
ll=plot(hr?na:lag, color=fr?gray:blue, linewidth=1, title="Trigger")
fill(dl, ll, green, title="UpTrend", transp=70)
fill(dl, itl, red, title="DownTrend", transp=70)
bc=not ebc?na:(it>lag?red:lime)
barcolor(bc)



(proof pictures)

[Linked Image]
[Linked Image]


wanted to try out how hard it is to convert a Pine script

Last edited by Lapsa; 01/15/22 02:21.
Re: Lapsa's very own thread [Re: Lapsa] #485078
01/15/22 13:46
01/15/22 13:46
Joined: Aug 2021
Posts: 237
L
Lapsa Offline OP
Member
Lapsa  Offline OP
Member
L

Joined: Aug 2021
Posts: 237
Ehlers MESA Adaptive Moving Average [LazyBear]

(code)

Code
//
// @author LazyBear 
// 
// List of my public indicators: http://bit.ly/1LQaPK8 
// List of my app-store indicators: http://blog.tradingview.com/?p=970 
//
// study("Ehlers MESA Adaptive Moving Average [LazyBear]", shorttitle="EMAMA_LB", overlay=true, precision=3)
// src=input(hl2, title="Source")
// fl=input(.5, title="Fast Limit")
// sl=input(.05, title="Slow Limit")
// sp = (4*src + 3*src[1] + 2*src[2] + src[3]) / 10.0
// dt = (.0962*sp + .5769*nz(sp[2]) - .5769*nz(sp[4])- .0962*nz(sp[6]))*(.075*nz(p[1]) + .54)
// q1 = (.0962*dt + .5769*nz(dt[2]) - .5769*nz(dt[4])- .0962*nz(dt[6]))*(.075*nz(p[1]) + .54)
// i1 = nz(dt[3])
// jI = (.0962*i1 + .5769*nz(i1[2]) - .5769*nz(i1[4])- .0962*nz(i1[6]))*(.075*nz(p[1]) + .54)
// jq = (.0962*q1 + .5769*nz(q1[2]) - .5769*nz(q1[4])- .0962*nz(q1[6]))*(.075*nz(p[1]) + .54)
// i2_ = i1 - jq
// q2_ = q1 + jI
// i2 = .2*i2_ + .8*nz(i2[1])
// q2 = .2*q2_ + .8*nz(q2[1])
// re_ = i2*nz(i2[1]) + q2*nz(q2[1])
// im_ = i2*nz(q2[1]) - q2*nz(i2[1])
// re = .2*re_ + .8*nz(re[1])
// im = .2*im_ + .8*nz(im[1])
// p1 = iff(im!=0 and re!=0, 360/atan(im/re), nz(p[1]))
// p2 = iff(p1 > 1.5*nz(p1[1]), 1.5*nz(p1[1]), iff(p1 < 0.67*nz(p1[1]), 0.67*nz(p1[1]), p1))
// p3 = iff(p2<6, 6, iff (p2 > 50, 50, p2))
// p = .2*p3 + .8*nz(p3[1])
// spp = .33*p + .67*nz(spp[1])
// phase = atan(q1 / i1)
// dphase_ = nz(phase[1]) - phase
// dphase = iff(dphase_< 1, 1, dphase_)
// alpha_ = fl / dphase
// alpha = iff(alpha_ < sl, sl, iff(alpha_ > fl, fl, alpha_))
// mama = alpha*src + (1 - alpha)*nz(mama[1])
// fama = .5*alpha*mama + (1 - .5*alpha)*nz(fama[1])
// pa=input(false, title="Mark crossover points")
// plotarrow(pa?(cross(mama, fama)?mama<fama?-1:1:na):na, title="Crossover Markers")
// fr=input(false, title="Fill MAMA/FAMA Region")
// duml=plot(fr?(mama>fama?mama:fama):na, style=circles, color=gray, linewidth=0, title="DummyL")
// mamal=plot(mama, title="MAMA", color=red, linewidth=2)
// famal=plot(fama, title="FAMA", color=green, linewidth=2)
// fill(duml, mamal, red, transp=70, title="NegativeFill")
// fill(duml, famal, green, transp=70, title="PositiveFill")
// ebc=input(false, title="Enable Bar colors")
// bc=mama>fama?lime:red
// barcolor(ebc?bc:na)

var nz(var x) {
	return x;	
}

var nz(var x, var y) {
	if (x != 0) return x;
	return y;	
}

function run() 
{
	set(PLOTNOW);
	StartDate = 20220114;
	BarPeriod = 1;
	LookBack = 100;
	BarMode = BR_FLAT;

	vars src = series(price());
	vars dt = series(0, 3);
	vars sp = series(0, 6);
	vars q1 = series(0, 6);
	vars i1 = series(0, 6);
	vars jI = series(0, 6);
	vars jq = series(0, 6);
	vars i2 = series(0, 2);
	vars q2 = series(0, 2);
	vars re = series(0, 2);
	vars im = series(0, 2);
	vars p = series(0, 2);
	vars spp = series(0, 2);
	vars phase = series(0, 2);
	vars mama = series(0, 2);
	vars fama = series(0, 2);
	vars p1 = series(0, 2);
	vars p3 = series(0, 2);
	
	var fl = .5;
	var sl = .05;
	
	sp[0] = (4*src[0] + 3*src[1] + 2*src[2] + src[3]) / 10.0;
	dt[0] = (.0962*sp[0] + .5769*nz(sp[2]) - .5769*nz(sp[4])- .0962*nz(sp[6]))*(.075*nz(p[1]) + .54);
	q1[0] = (.0962*dt[0] + .5769*nz(dt[2]) - .5769*nz(dt[4])- .0962*nz(dt[6]))*(.075*nz(p[1]) + .54);
	i1[0] = nz(dt[3]);
	jI[0] = (.0962*i1[0] + .5769*nz(i1[2]) - .5769*nz(i1[4])- .0962*nz(i1[6]))*(.075*nz(p[1]) + .54);
	jq[0] = (.0962*q1[0] + .5769*nz(q1[2]) - .5769*nz(q1[4])- .0962*nz(q1[6]))*(.075*nz(p[1]) + .54);
	var i2_ = i1[0] - jq[0];
	var q2_ = q1[0] + jI[0];
	i2[0] = .2*i2_ + .8*nz(i2[1]);
	q2[0] = .2*q2_ + .8*nz(q2[1]);
	var re_ = i2[0]*nz(i2[1]) + q2[0]*nz(q2[1]);
	var im_ = i2[0]*nz(q2[1]) - q2[0]*nz(i2[1]);
	re[0] = .2*re_ + .8*nz(re[1]);
	im[0] = .2*im_ + .8*nz(im[1]);
	
	if(im[0]!=0 && re[0]!=0) {
		p1[0] = 360/atan(im[0]/re[0]);
	} else {
		p1[0] = nz(p[1]);
	}
	
	var p2;
	if(p1[0] > 1.5*nz(p1[1])) {
		p2 = 1.5*nz(p1[1]);
	} else {
		if (p1[0] < .67*nz(p1[1])) {
			p2 = .67*nz(p1[1]);
		} else {
			p2 = p1[1];
		}
	}
	
	if (p2<6) {
		p3[0] = 6;
	} else {
		if (p2 > 50) {
			p3[0] = 50;
		} else {
			p3[0] = p2;
		}
	}
	
	p[0] = .2*p3[0]+.8*nz(p3[1]);
	spp[0] = .33*p[0]+.67*nz(spp[1]);
	phase[0] = atan(q1[0] / i1[0]);
	var dphase_ = nz(phase[1]) - phase[0];
	
	var dphase;
	if (dphase_ < 1) {
		dphase = 1;
	} else {
		dphase = dphase_;
	}
	
	var alpha_ = fl / dphase;
	var alpha;
	if (alpha_ < sl) {
		alpha = sl;
	} else {
		if (alpha_ > fl) {
			alpha = fl;
		} else {
			alpha = alpha_;
		}
	}
	
	mama[0] = alpha * src[0] + (1 - alpha)*nz(mama[1]);
	fama[0] = .5*alpha*mama[0]+(1-.5*alpha)*nz(fama[1]);
	
	plot("mama", mama, NEW, RED);
	plot("fama", fama, END, BLUE);
	
	MAMA(src, fl, .5);
	plot("z mama", rMAMA, NEW, RED);
	plot("z fama", rFAMA, END, BLUE);
}



(img)

[Linked Image]

Re: Lapsa's very own thread [Re: Lapsa] #485079
01/15/22 15:00
01/15/22 15:00
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Originally Posted by Lapsa
actually, I think Ulser Index (and R2) might be borked

Sharpe Ratio definitely was

after Zorro's update - suddenly started working


I've made a template in Google Sheets to calculate/compare certain performance stats, based on 'testtrades.csv'. By doing so I can calculate any metric.
This comes in handy now that I realize that 3 out of 5 profitable models have a slightly negative performance on the short side, about 7% performance drop for my multi asset strategy.

From what I remember from the Wine bug forum, was that JCL discussed the SR differences between Zorro in a Linux/Wine vs a Windows environment. It seems that either JCL and/or the Wine devs resolved this issue. This might had effect on Zorro under Windows as well.

Last edited by Grant; 01/15/22 15:01.
Re: Lapsa's very own thread [Re: Lapsa] #485080
01/15/22 23:04
01/15/22 23:04
Joined: Aug 2021
Posts: 237
L
Lapsa Offline OP
Member
Lapsa  Offline OP
Member
L

Joined: Aug 2021
Posts: 237
@Grant

I like Sharpe Ratio. occasionally I do favor higher SR and trade count despite of lower AR

had no luck with Wine - system error`ed out every day

Re: Lapsa's very own thread [Re: Lapsa] #485081
01/15/22 23:08
01/15/22 23:08
Joined: Aug 2021
Posts: 237
L
Lapsa Offline OP
Member
Lapsa  Offline OP
Member
L

Joined: Aug 2021
Posts: 237
week in mild profits

and by "mild" I mean like +20% increase in capital
(which sounds superb if we ignore earlier losses)

part of me is itching again, wanting to scale up

I mean, can afford it and it definitely makes everyday more exciting

should check news. gut feels modest bull run

Re: Lapsa's very own thread [Re: Lapsa] #485083
01/16/22 00:25
01/16/22 00:25
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Originally Posted by Lapsa
@Grant

I like Sharpe Ratio. occasionally I do favor higher SR and trade count despite of lower AR


With fixed lot sizes, a 'low' AR shouldn't be a concern. Once your profit to risk (PF, SR... pick your own flavor) is high, you can boost the AR anyway with more aggressive position sizes.

Originally Posted by Lapsa
week in mild profits

and by "mild" I mean like +20% increase in capital
(which sounds superb if we ignore earlier losses)

part of me is itching again, wanting to scale up

I mean, can afford it and it definitely makes everyday more exciting


What is holding you from not doing so? You should be good to go once you ran some successful back tests with more leverage.

Re: Lapsa's very own thread [Re: Lapsa] #485085
01/16/22 15:42
01/16/22 15:42
Joined: Aug 2021
Posts: 237
L
Lapsa Offline OP
Member
Lapsa  Offline OP
Member
L

Joined: Aug 2021
Posts: 237
timing is important

-1k$ today hurts

and if it's good enough, I will have that +1k in a week or something

I mean - as long as it got enough fuel to snowball, why bother?

Re: Lapsa's very own thread [Re: Lapsa] #485086
01/16/22 15:47
01/16/22 15:47
Joined: Aug 2021
Posts: 237
L
Lapsa Offline OP
Member
Lapsa  Offline OP
Member
L

Joined: Aug 2021
Posts: 237
hey!

do You want to run Laguerre in Bollinger Bands Oscillator?

well...

NOW YOU CAN!

Code
// percentage of a variable within a band
var percent(var a,var l,var h) { 
	if(l == h) return 50.;
	return 100.*(a-l)/(h-l); 
}

// Bollinger Bands Oscillator
var BBOscDeluxe3000(var* Data,int Period,var NbDev)
{
	var basis = Laguerre(Data, .5); // random alpha, no ideas
	var dev = StdDev(Data, Period);
	
	var upper = basis + dev*NbDev;
	var lower = basis - dev*NbDev;
	return percent(Data[0],lower,upper);
}


for only 9.99$ per month or something

ain't saying you should

emm...

anyhow...

just flexing skillz

feels good to slice it up whichever way I want to

Re: Lapsa's very own thread [Re: Lapsa] #485087
01/16/22 16:52
01/16/22 16:52
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline
Member
Grant  Offline
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Can't argue that! Time to get back to the drawing board and look for more consistency.

Page 12 of 25 1 2 10 11 12 13 14 24 25

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