Lapsa's very own thread

Posted By: Lapsa

Lapsa's very own thread - 08/17/21 13:08

I want to document my experiments somewhere.
This seems like a decent place. I like forums.
Feedback is welcome.

------------------------

Cycles

My latest obsession is cycles. Been thinking a lot about what would be good ways to utilize Hilbert's Transform Dominant Cycle.

So today wrote a small script to compare how fixed length SMA looks compared to dc_period long SMA to see if I spot anything meaningful.


Code
#include <profile.c>

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars seriesClose = series(priceClose());

	var sma23 = SMA(seriesClose,23);
	var period = HTDcPeriod(seriesClose);

	plot("SMA 23", sma23, MAIN, RED);
	plot("ASMA", adaptiveSma, MAIN, GREEN);
}


[Linked Image]


Conclusions are kind of obvious:
- lags less when dominant cycle is shorter than fixed one
- lags more when longer

Picked length 23 cause it looked like kind of average of what dominant cycle tends to spin around.

So I thought:
"Ok... but how that visually compares to The Shapeshifter of MA`s aka KAMA"?


Code
	var kama = KAMA(seriesClose, 23);
	var veryAdaptiveKama = KAMA(seriesClose, period);
	plot("KAMA 23", kama, MAIN, SILVER);
	plot("VAKAMA", veryAdaptiveKama, MAIN, GREY);


[Linked Image]


The effect is same although SMA behaves much differently than KAMA.

So really... No huge revelations here.

Lets smash in some trade signals!!!111eleven


Code
#include <profile.c>

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars seriesClose = series(priceClose());
	var period = HTDcPeriod(seriesClose);

	var sma22 = SMA(seriesClose,22);
	var adaptiveSma = SMA(seriesClose,period);
	var kama22 = KAMA(seriesClose, 22);
	var veryAdaptiveKama = KAMA(seriesClose, period);
	
	if (	  
	  price() > veryAdaptiveKama &&
	  veryAdaptiveKama > kama22 &&
	  veryAdaptiveKama > adaptiveSma &&
	  adaptiveSma > sma22 &&
	  rising(series(sma22))
	) {
		exitShort();
		if (ProfitOpen >= 0) enterLong();
	}
	
	if (	  
	  price() < veryAdaptiveKama &&
	  veryAdaptiveKama < kama22 &&
	  veryAdaptiveKama < adaptiveSma &&
	  adaptiveSma < sma22 &&
	  falling(series(sma22))
	) {
		exitLong();
		if (ProfitOpen >= 0) enterShort();
	}
	
	plot("SMA 22", sma22, MAIN, RED);
	plot("ASMA", adaptiveSma, MAIN, GREEN);
	plot("KAMA 22", kama22, MAIN, SILVER);
	plot("VAKAMA", veryAdaptiveKama, MAIN, GREY);	
	plot("Profit Open", ProfitOpen, NEW, RED);
	plot("HT Dc Period", period, NEW, BLACK);
}


[Linked Image]

Quote

Monte Carlo Analysis... Median AR 2509%
Win 9100$ MI 6082$ DD 810$ Capital 2774$
Trades 2485 Win 42.7% Avg +36.6p Bars 67
AR 2631% PF 1.82 SR 0.00 UI 0% R2 1.00


For such randomness - PF of 1.82 ain't total disaster.
Posted By: Lapsa

Re: Lapsa's very own thread - 08/17/21 20:10

Ehler's "Modified Simple Moving Averages"


Code
#include <profile.c>

var ModifiedSMA(var* Data, var* FractionalCoefficients)
{
	var sum=0., coefficientSum=0.;
	int i;
	int period=sizeof(FractionalCoefficients);
	
	for(i=0; i<period; i++) {
		sum += (Data[i] * FractionalCoefficients[i]);
		coefficientSum += FractionalCoefficients[i];
	}

	return sum / coefficientSum;
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars seriesClose = series(priceClose());

	var sma = SMA(seriesClose, 4);
	var coefficients[] = {.5,1,1,1,.5};	
	var modifiedSMA = ModifiedSMA(seriesClose, coefficients);
	
	var weirdCoefficients[] = {.2,1,1.6,1,.2};
	var weirdSMA = ModifiedSMA(seriesClose, weirdCoefficients);
	
	var weirderCoefficients[] = {.1,1,1,1.7,.2};
	var weirderSMA = ModifiedSMA(seriesClose, weirderCoefficients);

	var shouldBeFastestCoefficients[] = {2,.2,1.2,.2,.4};
	var shouldBeFastest = ModifiedSMA(
		seriesClose, shouldBeFastestCoefficients
	);
	
	plot("SMA 4", sma, MAIN, RED);
	plot(".5 1 1 1 .5", modifiedSMA, MAIN, BLUE);
	plot(".2 1 1.6 1 .2", weirdSMA, MAIN, GREEN);
	plot(".1 1 1 1.7 .2", weirderSMA, MAIN, MAGENTA);
	plot("2 .2 1.2 .2 .4", shouldBeFastest, MAIN, CYAN);
}


[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 08/17/21 20:44

EMA Ribbon

So I've been reading that book.
Yesterday it got me wondering - how exactly EMAs with varying alphas look like.


Code
#include <profile.c>

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars closes = series(priceClose());

	var ema1 = EMA(closes,.1);
	var ema2 = EMA(closes,.2);
	var ema3 = EMA(closes,.3);
	var ema4 = EMA(closes,.4);
	var ema5 = EMA(closes,.5);
	var ema6 = EMA(closes,.6);
	var ema7 = EMA(closes,.7);
	var ema8 = EMA(closes,.8);
	var ema9 = EMA(closes,.9);
	var ema10 = EMA(closes,.15);
	
	plot(".1", ema1, MAIN, RED);
	plot(".2", ema2, MAIN, GREEN);
	plot(".3", ema3, MAIN, BLUE);
	plot(".4", ema4, MAIN, ORANGE);
	plot(".5", ema5, MAIN, BLACK);
	plot(".6", ema6, MAIN, MAGENTA);
	plot(".7", ema7, MAIN, OLIVE);
	plot(".8", ema8, MAIN, PURPLE);
	plot(".9", ema9, MAIN, LIGHTBLUE);
	plot(".15", ema10, MAIN, MAROON);
}


[Linked Image]


Looks beautiful.

Can't help but see that graph in 3D.
Reminds me of Sietches from Dune.

Ohkay... Is there an application for bunch of EMAs?

One of the most obvious "Market inefficiencies" for an algo trader to exploit is automation itself.

Got me wondering how would ribbon look like with more commonly used time periods.


Code
#include <profile.c>

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 1500;
	StartDate = 20210703;
	EndDate = 20210816;

	vars closes = series(priceClose());

	var ema2 = EMA(closes,2);
	var ema5 = EMA(closes,5);
	var ema15 = EMA(closes,15);
	var ema30 = EMA(closes,30);
	var ema45 = EMA(closes,45);	
	var ema60 = EMA(closes,60);
	var ema120 = EMA(closes,120);	
	var ema180 = EMA(closes,180);
	var ema240 = EMA(closes,240);
	var ema1440 = EMA(closes,1440);	
	
	plot("2", ema2, MAIN, SILVER + TRANSP);
	plot("5", ema5, MAIN, CYAN + TRANSP);
	plot("15", ema15, MAIN, GREEN + TRANSP);
	plot("30", ema30, MAIN, MAGENTA);
	plot("45", ema45, MAIN, BLUE);
	plot("60", ema60, MAIN, DARKBLUE);
	plot("120", ema120, MAIN, PURPLE);
	plot("180", ema180, MAIN, MAROON);
	plot("240", ema240, MAIN, RED);
	plot("1440", ema1440, MAIN, BLACK);
}


[Linked Image]


Frikin sea waves!

Lets smash in some trade signals!!!111eleven


Code
#include <profile.c>

function run()
{
	set(NFA|PRELOAD|PLOTNOW);
	BarPeriod = 1;
	LookBack = 2000;
	StartDate = 20210703;
	EndDate = 20210716;
	BarMode = BR_FLAT;	
	History = "*.t6";
	Amount = 8;
	Capital = 600;
	// MaxLong = 5;
	// MaxShort = 5;
	// Stop = ATR(100) * 10;

	vars closes = series(priceClose());

	vars ema2 = series(KAMA(closes,2));
	vars ema5 = series(EMA(closes,5));
	vars ema15 = series(EMA(closes,14));
	vars ema30 = series(EMA(closes,27));
	vars ema45 = series(EMA(closes,44));	
	vars ema60 = series(EMA(closes,60));
	vars ema120 = series(EMA(closes,120));	
	vars ema180 = series(EMA(closes,181));
	vars ema240 = series(EMA(closes,235));
	vars ema1440 = series(EMA(closes,1433));	
	
	if (
		rising(ema2)
		&& rising(ema5)
		&& rising(ema15)
		&& rising(ema30)
		&& rising(ema45)
		&& rising(ema60)
		&& rising(ema120)
		&& rising(ema180)
		&& rising(ema240)
		&& rising(ema1440)
		&& ema2[0] > ema15[0]
		&& ema15[0] > ema30[0]
		&& ema30[0] > ema45[0]
		&& ema45[0] > ema60[0]
		&& ema120[0] > ema180[0]
		&& ema180[0] > ema240[0]
		&& ema240[0] < ema1440[0]		
	) enterLong(Amount);
	
	if (
		falling(ema2)
		&& falling(ema5)
		&& falling(ema15)
		&& falling(ema30)
		&& falling(ema45)
		&& falling(ema60)
		&& falling(ema120)
		&& falling(ema180)
		&& falling(ema240)
		&& falling(ema1440)
		&& ema2[0] < ema15[0]
		&& ema15[0] < ema30[0]
		&& ema30[0] < ema45[0]
		&& ema45[0] < ema60[0]
		&& ema120[0] < ema180[0]
		&& ema180[0] < ema240[0]
		&& ema240[0] > ema1440[0]
	) enterLong(Amount);
	
	if (crossUnder(ema5, ema45))
		exitShort();
	
	if (crossOver(ema5, ema45))
		exitLong();
}


[Linked Image]

Quote

Monte Carlo Analysis... Median AR 2070%
Win 10650$ MI 23156$ DD 2952$ Capital 666$
Trades 532 Win 62.6% Avg +25.0p Bars 59
CAGR 163492235397780660000000000000000000.00% PF 2.41 SR 0.00 UI 0% R2 1.00
Chart...


Finetuned af.
Likes to randomly pop up Margin Calls.

Posted By: Lapsa

Re: Lapsa's very own thread - 08/18/21 10:58

Ehler's "Modified Least-Squares Quadratics"


Code
#include <profile.c>

var ModifiedSMA(var* Data, var* FractionalCoefficients)
{
	var sum=0., coefficientSum=0.;
	int i;
	int period=sizeof(FractionalCoefficients);
	
	for(i=0; i<period; i++) {
		sum += (Data[i] * FractionalCoefficients[i]);
		coefficientSum += FractionalCoefficients[i];
	}

	return sum / coefficientSum;
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars seriesClose = series(priceClose());

	var sma = SMA(seriesClose, 5);
	var c1[] = {7,24,34,24,7};
	var c2[] = {1,6,12,14,12,6,1};
	var c3[] = {-1,28,78,108,118,108,78,28,-1};
	var c4[] = {-11,18,88,138,168,178,168,138,88,18,-11};

	var m1 = ModifiedSMA(seriesClose, c1);
	var m2 = ModifiedSMA(seriesClose, c2);
	var m3 = ModifiedSMA(seriesClose, c3);
	var m4 = ModifiedSMA(seriesClose, c4);

	// [7 24 34 24 7] / 96
        // [1 6 12 14 12 6 1] / 52
        // [−1 28 78 108 118 108 78 28 −1] / 544
        // [−11 18 88 138 168 178 168 138 88 18 −11] / 980
	
	plot("SMA 5", sma, MAIN, RED);
	plot("c1", m1, MAIN, BLUE);
	plot("c2", m2, MAIN, GREEN);
	plot("c3", m3, MAIN, MAGENTA);
	plot("c4", m4, MAIN, CYAN);
}


[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 08/18/21 11:26

2 Pole Butterworth filter

Quote

The Butterworth filter is a type of signal processing filter designed to have a frequency response as flat as possible in the passband. It is also referred to as a maximally flat magnitude filter.

Properties of the Butterworth filter are:
- monotonic amplitude response in both passband and stopband
- Quick roll-off around the cutoff frequency, which improves with increasing order
- Considerable overshoot and ringing in step response, which worsens with increasing order
- Slightly non-linear phase response
- Group delay largely frequency-dependent



Code
#include <profile.c>

var Butterworth2Pole(var* Data, int Period)
{
	var a = exp(-1.414*PI/Period);
	var b = 2*a*cos(1.414*1.25*180/Period);
	var c2 = b;
	var c3 = -a*a;
	var c1 = 1-c2-c3;
	
	var* Filt = series(*Data,3);
	// syntax error? TODO: check what happened w/ SETSERIES
	//	SETSERIES(Data,0);
	series(Data[0],0); // is that an equivalent?
	return Filt[0] = c1*Data[0] + c2*Filt[1] + c3*Filt[2];
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars seriesClose = series(priceClose());

	var sma = SMA(seriesClose, 5);
	var butt = Butterworth2Pole(seriesClose, 5);
	var butt3Pole = Butterworth(seriesClose, 5);
		
	plot("SMA 5", sma, MAIN, SILVER);
	plot("2 Pole Butt", butt, MAIN, RED);
	plot("3 Pole Butt", butt3Pole, MAIN, BLUE);
}


[Linked Image]
[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 08/18/21 18:26

Ehler's Decycler Oscillator (fixed)

Quote

Trigonometric functions (Sine, Cosine etc) expect angles in degrees (0..360), while in C and in most other languages angles are in radians (0..2*PI). Log is the logarithm base e as in C.


Seemingly best use:
- set long periods
- 0 crossover for uptrend
- 0 crossunder for downtrend


Code
#include <profile.c>

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) {	return cos(rad(degrees)); }
var rsin(var degrees) {	return sin(rad(degrees)); }

var DecyclerOscillator(var* Close, var HPPeriod1, var HPPeriod2) // 30 60
{	
	var alpha1;
	var alpha2;
	var* hp1 = series(0,3);
	var* hp2 = series(0,3);
	
	alpha1 = 
		(rcos(.707*360/HPPeriod1)+
		rsin(.707*360/HPPeriod1)-1)
		/rcos(.707*360/HPPeriod1);

	alpha2 = 
		(rcos(.707*360/HPPeriod2)+
		rsin(.707*360/HPPeriod2)-1)/
		rcos(.707*360/HPPeriod2);
	
	hp1[0] = (1-alpha1/2)*(1-alpha1/2)*
		(Close[0]-2*Close[1]+Close[2])+
		2*(1-alpha1)*hp1[1]-(1-alpha1)*
		(1-alpha1)*hp1[2];
	
	hp2[0] = (1-alpha2/2)*(1-alpha2/2)*
		(Close[0]-2*Close[1]+Close[2])+
		2*(1-alpha2)*hp2[1]-(1-alpha2)*
		(1-alpha2)*hp2[2];
	 
	return hp2[0] - hp1[0];
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars closes = series(priceClose());
	
	var osc = DecyclerOscillator(closes, 30, 60);
	var zma = ZMA(closes, 30);

	plot("ZMA", zma, MAIN, BLACK);
	plot("Decycler OSC", osc, NEW, BLACK);
}


[Linked Image]

Refactored:

Code
var DecyclerOscillator(var* Close, var HPPeriod1, var HPPeriod2) // 30 60
{
	return HighPass2(Close, HPPeriod2) - HighPass2(Close, HPPeriod1);
}

Posted By: Lapsa

Re: Lapsa's very own thread - 08/18/21 19:25

Quote

One of the amazing characteristics of a band-pass filter is that if the
center period of the filter is tuned to a static sine wave whose period is
the same as the center period of the filter, then there is absolutely no lag
in the output.
Posted By: Lapsa

Re: Lapsa's very own thread - 08/19/21 20:24

Ehler's "Adaptive Stochastic Indicator"

I'm proud and happy I pulled this one through.

Well... Sort of.

Running Tests multiple times produces different results.
Not sure why. Yay!

Something memory, variables, pointers whatnot related.
`MaxPwr` looks like potential troublemaker.

Interestingly, adaptive CCI source code has this:

Code
//Find Maximum Power Level for Normalization
MaxPwr = .991*MaxPwr[1];


Also - overall computation seems notoriously slow.
Like 3 seconds for a single day.
Something I've been doing wrong.

When it works - results look legit.

Haven't finished the book.
Not sure if this one is supposed to be equivalent of Zorro's bundled StochEhlers indicator.
They do look similar although Zorro's one got some of that buttery smoothing.

All in all - fun but unusable.

TODO:
try to identify the issue by replacing snippets with in-built stuff (e.g. center of gravity)


Code
#include <profile.c>

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) { return cos(rad(degrees)); }
var rsin(var degrees) { return sin(rad(degrees)); }

var AdaptiveStochastic(vars Close)
{
	var AvgLength = 3;
	var M;
	var N;
	var X;
	var Y;
	var alpha1;
	var* HP = series(0,3);
	var a1;
	var b1;
	var c1;
	var c2;
	var c3;
	var* Filt = series(0,3);
	var Lag;
	var count;
	var Sx;
	var Sy;
	var Sxx;
	var Syy;
	var Sxy;
	var Period;
	var Sp;
	var Spx;
	var* MaxPwr = series(0,3);
	var DominantCycle;
	
	var* Corr = series(0, 48);
	var* CosinePart = series(0, 48);
	var* SinePart = series(0, 48);
	var* SqSum = series(0, 48);
	var R[48][2];
	var Pwr[48];	
	
	//Highpass filter cyclic components whose periods are shorter than 48 bars
	alpha1 = (rcos(.707*360 / 48) + rsin(.707*360 / 48) - 1) / rcos(.707*360 / 48);
	
	HP[0] = (1 - alpha1 / 2)*(1 - alpha1 / 2)*
		(Close[0] - 2*Close[1] + Close[2]) + 
		2*(1 - alpha1)*HP[1] - 
		(1 - alpha1) * (1 - alpha1)*HP[2];
	
	
	//Smooth with a Super Smoother Filter from equation 3-3
	a1 = exp(-1.414*3.14159 / 10);
	b1 = 2*a1*rcos(1.414*180 / 10);
	c2 = b1;
	c3 = -a1*a1;
	c1 = 1 - c2 - c3;
	Filt[0] = c1*(HP[0] + HP[1]) / 2 + c2*Filt[1] + c3*Filt[2];
		
	//Pearson correlation for each value of lag
	for (Lag = 0; Lag < 48; Lag++) {		
		//Set the averaging length as M
		M = AvgLength;
		if (AvgLength == 0) M = Lag;
		Sx = 0;
		Sy = 0;
		Sxx = 0;
		Syy = 0;
		Sxy = 0;
		
		for (count = 0; count < M - 1; count++) {
			X = Filt[count];
			Y = Filt[Lag + count];
			Sx = Sx + X;
			Sy = Sy + Y;
			Sxx = Sxx + X*X;
			Sxy = Sxy + X*Y;
			Syy = Syy + Y*Y;
		}
		
		if ( (M*Sxx - Sx*Sx)*(M*Syy - Sy*Sy) > 0 ) {
			Corr[Lag] = (M*Sxy - Sx*Sy)/sqrt((M*Sxx-Sx*Sx)*(M*Syy-Sy*Sy));
		}
	}
	
	for (Period = 0; Period < 48; Period++) {
		CosinePart[Period] = 0;
		SinePart[Period] = 0;
		
		for(N = 3; N < 48; N++) {
			CosinePart[Period] = CosinePart[Period] + Corr[N]*rcos(360*N / Period);
			SinePart[Period] = SinePart[Period] + Corr[N]*rsin(360*N / Period);
		}
		SqSum[Period] = CosinePart[Period]*CosinePart[Period] +
		SinePart[Period]*SinePart[Period];
	}
	
	for (Period = 0; Period < 48; Period++) {
		R[Period][2] = R[Period][1];
		R[Period][1] = .2*SqSum[Period]*SqSum[Period] +.8*R[Period][2];
	}
	
	// Find Maximum Power Level for Normalization
	MaxPwr[0] = .995*MaxPwr[1];
	for (Period = 10; Period < 48; Period++) {
		if (R[Period][1] > MaxPwr[0]) MaxPwr[0] = R[Period][1];
	}
	
	for (Period = 3; Period < 48; Period++) {
		Pwr[Period] = R[Period][1] / MaxPwr[0];
	}
	
	//Compute the dominant cycle using the CG of the spectrum
	Spx = 0;
	Sp = 0;
	for(Period = 10; Period < 48; Period++) {
		if (Pwr[Period] >= .5) {
			Spx = Spx + Period*Pwr[Period];
			Sp = Sp + Pwr[Period];
		}
	}
	
	if (Sp != 0) DominantCycle = Spx / Sp;
	if (DominantCycle < 10) DominantCycle = 10;
	if (DominantCycle > 48) DominantCycle = 48;
	
	//Stochastic Computation starts here
	var* HighestC = series(0, 3);
	var* LowestC = series(0, 3);
	var* Stoc = series(0, 3);
	var* SmoothNum = series(0, 3);
	var* SmoothDenom = series(0, 3);
	var* AdaptiveStochastic = series(0, 3);
	
	HighestC[0] = Filt[0];
	LowestC[0] = Filt[0];
	
	for (count = 0; count < DominantCycle - 1; count++ ) {
		if (Filt[count] > HighestC[0]) HighestC[0] = Filt[count];
		if (Filt[count] < LowestC[0]) LowestC[0] = Filt[count];	
	}
	
	Stoc[0] = (Filt[0] - LowestC[0]) / (HighestC[0] - LowestC[0]);
	return AdaptiveStochastic[0] = 
		c1*(Stoc[0] + Stoc[1]) / 2 + c2*AdaptiveStochastic[1] + c3*AdaptiveStochastic[2];
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 500;
	StartDate = 20210809;
	EndDate = 20210810;

	vars closes = series(priceClose(), 48);
	var astoch = AdaptiveStochastic(closes);
	
	var original = StochEhlers(closes, 48, 10, 48);
	
	plot("ASTOCH", astoch, NEW, RED);
        plot("Zorro`s EStoch", original, NEW, BLUE);
}


[Linked Image]
[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 08/20/21 17:25

Ehler's "Even Better Sinewave"

Looks usable.



Code
#include <profile.c>

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) {	return cos(rad(degrees)); }
var rsin(var degrees) {	return sin(rad(degrees)); }

var EvenBetterSinewave(vars Close, var Duration)
{
	var alpha1;
	var* HP = series(1,2);
	var a1;
	var b1;
	var c1;
	var c2;
	var c3;
	var* Filt = series(1,3);
	var count;
	var Wave;
	var Pwr;
	
	// HighPass filter cyclic components whose periods are shorter than Duration input
	alpha1 = (1 - rsin(360 / Duration)) / rcos(360 / Duration);
	HP[0] = .5*(1 + alpha1)*(Close[0] - Close[1]) + alpha1*HP[1];
	
	// Smooth with a Super Smoother Filter from equation 3-3
	a1 = exp(-1.414*3.14159 / Duration);
	b1 = 2*a1*rcos(1.414*180 / Duration);
	c2 = b1;
	c3 = -a1*a1;
	c1 = 1 - c2 - c3;
	Filt[0] = c1*(HP[0] + HP[1]) / 2 + c2*Filt[1] + c3*Filt[2];
	
	// 3 Bar average of Wave amplitude and power
	Wave = (Filt[0] + Filt[1] + Filt[2]) / 3;
	Pwr = (Filt[0]*Filt[0] + Filt[1]*Filt[1] + Filt[2]*Filt[2]) / 3;
	
	// Normalize the Average Wave to Square Root of the Average Power
	return Wave / sqrt(Pwr);
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars close = series(priceClose());
		
	var evenBetterSinewave = EvenBetterSinewave(close, 10);
	
	plot("EBSW", evenBetterSinewave, NEW, BLACK);
}


[Linked Image]

Refucktored version:

Code
#include <profile.c>

var EvenBetterSinewave(vars Close, var Duration)
{
	var Wave;
	var Pwr;
		
	var* HP = series(HighPass1(Close, Duration), 2);
	if (HP[0] == 0) HP[0] = 1;
	
	var* Filt = series(Smooth(HP, Duration), 3);	
	Wave = SMA(Filt, 3);
	Pwr = (Filt[0]*Filt[0] + Filt[1]*Filt[1] + Filt[2]*Filt[2]) / 3;
	
	return Wave / sqrt(Pwr);
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars close = series(priceClose());
		
	var evenBetterSinewave = EvenBetterSinewave(close, 10);
	
	plot("EBSW", evenBetterSinewave, NEW, BLACK);
}


Comparison with [CC] EBSW indicator on TradingView:

[Linked Image]


Interestingly - that one allows setting HighPass length separately from SuperSmoothFilter length.

Like this:

Code
var EvenBetterSinewave(vars Close, var HPLength, SSFLength)
{
	var Wave;
	var Pwr;
		
	var* HP = series(HighPass1(Close, HPLength), 2);
	if (HP[0] == 0) HP[0] = 1;
	
	var* Filt = series(Smooth(HP, SSFLength), 3);	
	Wave = SMA(Filt, 3);
	Pwr = (Filt[0]*Filt[0] + Filt[1]*Filt[1] + Filt[2]*Filt[2]) / 3;
	
	return Wave / sqrt(Pwr);
}


Lets smash in some trade signals!!!111eleven


Code
#include <profile.c>

var EvenBetterSinewave(vars Close, var Duration)
{
	var Wave;
	var Pwr;
		
	var* HP = series(HighPass1(Close, Duration), 2);
	if (HP[0] == 0) HP[0] = 1;
	
	var* Filt = series(Smooth(HP, Duration), 3);	
	Wave = SMA(Filt, 3);
	Pwr = (Filt[0]*Filt[0] + Filt[1]*Filt[1] + Filt[2]*Filt[2]) / 3;
	
	return Wave / sqrt(Pwr);
}

function run()
{
	set(PLOTNOW|PARAMETERS);
	BarPeriod = 1;
	LookBack = 250;
	StartDate = 20210702;
	EndDate = 20210816;

	vars close = series(priceClose());

	var* ebsw = series(EvenBetterSinewave(close, 225));
	
	if (crossOver(ebsw, -.99)) enterLong();	
	if (crossUnder(ebsw, .99)) enterShort();

	plot("EBSW", ebsw, NEW, BLACK);
}


[Linked Image]

Quote

Monte Carlo Analysis... Median AR 805%
Win 732$ MI 489$ DD 144$ Capital 448$
Trades 245 Win 38.8% Avg +29.9p Bars 181
AR 1311% PF 1.44 SR 0.00 UI 0% R2 1.00


Gotta fit that curve!
Posted By: Lapsa

Re: Lapsa's very own thread - 08/21/21 13:46

Ehler's "Band-Pass Filter"


Code
#include <profile.c>

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) {	return cos(rad(degrees)); }
var rsin(var degrees) {	return sin(rad(degrees)); }

var BPSignal;
var BPTrigger;

var BandPassFilter(var* Close, var Period, var Bandwidth)
{
	var alpha2;
	var* HP = series(0, 3);
	var gamma1;
	var alpha1;
	var beta1;
	var* BP = series(0, 3);
	var* Peak = series(0, 2);
	var* Signal = series(0, 2);
	var* Trigger = series(0, 2);
	
	alpha2 = (
		rcos(.25*Bandwidth*360 / Period) + 
		rsin(.25*Bandwidth*360 / Period) - 1
	  )  / rcos(.25*Bandwidth*360 / Period);

	HP[0] = (1 + alpha2 / 2)*(Close[0] - Close[1]) + 
		(1- alpha2)*HP[1];
		
	beta1 = rcos(360 / Period);
	
	gamma1 = 1 / rcos(360*Bandwidth / Period);
	alpha1 = gamma1 - sqrt(gamma1*gamma1 - 1);
	
	BP[0] = .5*(1 - alpha1)*(HP[0] - HP[2]) + 
		beta1*(1 + alpha1)*BP[1] - alpha1*BP[2];

	Peak[0] = .991*Peak[1];
	
	if (abs(BP[0]) > Peak[0]) Peak[0] = abs(BP[0]);
	
	if (Peak[0] != 0) Signal[0] = BP[0] / Peak[0];
	
	alpha2 = (rcos(1.5*Bandwidth*360 / Period) + 
		rsin(1.5*Bandwidth*360 / Period) - 1) / 
		rcos(1.5*Bandwidth*360 / Period);

	Trigger[0] = 
		(1 + alpha2 / 2)*(Signal[0] - Signal[1]) +
		(1- alpha2)*Trigger[1];
		
	BPSignal = Signal[0];
	BPTrigger = Trigger[0];
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210702;
	EndDate = 20210816;

	vars closes = series(priceClose());
	BandPassFilter(closes, 20, .3);
	
	plot("Signal", BPSignal, NEW, BLACK);
	plot("Trigger", BPTrigger, END, RED);
}


[Linked Image]

Lets smash in some trade signals!!!111eleven

Code
#include <profile.c>

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) {	return cos(rad(degrees)); }
var rsin(var degrees) {	return sin(rad(degrees)); }

var BPSignal;
var BPTrigger;

var BandPassFilter(var* Close, var Period, var Bandwidth)
{
	var alpha2;
	var* HP = series(0, 3);
	var gamma1;
	var alpha1;
	var beta1;
	var* BP = series(0, 3);
	var* Peak = series(0, 2);
	var* Signal = series(0, 2);
	var* Trigger = series(0, 2);
	
	alpha2 = (
			rcos(.25*Bandwidth*360 / Period) + 
			rsin(.25*Bandwidth*360 / Period) - 1
		) / rcos(.25*Bandwidth*360 / Period);

	HP[0] = (1 + alpha2 / 2)*(Close[0] - Close[1]) + 
		(1- alpha2)*HP[1];
		
	beta1 = rcos(360 / Period);
	
	gamma1 = 1 / rcos(360*Bandwidth / Period);
	alpha1 = gamma1 - sqrt(gamma1*gamma1 - 1);
	
	BP[0] = .5*(1 - alpha1)*(HP[0] - HP[2]) + 
		beta1*(1 + alpha1)*BP[1] - alpha1*BP[2];

	Peak[0] = .991*Peak[1];
	
	if (abs(BP[0]) > Peak[0]) Peak[0] = abs(BP[0]);
	
	if (Peak[0] != 0) Signal[0] = BP[0] / Peak[0];
	
	alpha2 = (rcos(1.5*Bandwidth*360 / Period) + 
		rsin(1.5*Bandwidth*360 / Period) - 1) / 
		rcos(1.5*Bandwidth*360 / Period);

	Trigger[0] = 
		(1 + alpha2 / 2)*(Signal[0] - Signal[1]) +
		(1- alpha2)*Trigger[1];
		
	BPSignal = Signal[0];
	BPTrigger = Trigger[0];
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 300;
	StartDate = 20210810;
	EndDate = 20210816;
	//Capital = 500;

	vars closes = series(priceClose());
	BandPassFilter(closes, 23, .05821);
	
	var* signalSeries = series(BPSignal);
	var* triggerSeries = series(BPTrigger);	

	MaxLong = 1;
	MaxShort = 1;
	
	if (
		BPTrigger < BPSignal
		//&& BPSignal > -0.3
	) {
		if (ProfitOpen >= 0) enterLong();
		else exitShort();
	}
	if (
		BPTrigger > BPSignal
		//&& BPSignal < 0.3
	) {
		if (ProfitOpen >= 0)	enterShort();
		else exitLong();
	}
	
	plot("Signal", BPSignal, NEW, BLACK);
	plot("Trigger", BPTrigger, END, RED);
}


[Linked Image]

Quote

Monte Carlo Analysis... Median AR 4054%
Win 318$ MI 1481$ DD 134$ Capital 409$
Trades 424 Win 50.9% Avg +7.5p Bars 13
AR 4350% PF 1.22 SR 0.00 UI 0% R2 1.00


High signal count.

Only Period of 23 works seemingly well in combination with that weird bandwidth of .05821.

Fails to perform month before.

Posted By: Lapsa

Re: Lapsa's very own thread - 08/21/21 14:58

Ehler's "Dominant Cycle Measured by Zero Crossings of the Band-Pass Filter"

Not 100% sure I got it right. Might be, might be not.

Looks believable.


Code

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) {	return cos(rad(degrees)); }
var rsin(var degrees) {	return sin(rad(degrees)); }

var DCBandPass(var* Close, var Period, var Bandwidth)
{
	var alpha2;
	var* HP = series(0, 3);
	var gamma1;
	var alpha1;
	var beta1;
	var* BP = series(0, 3);
	var* Peak = series(0, 2);
	var* Real = series(0, 3);
	var* counter = series(0, 2);
	var* DC = series(0, 2);
	
	alpha2 = (
			rcos(.25*Bandwidth*360 / Period) + 
			rsin(.25*Bandwidth*360 / Period) - 1
		) / rcos(.25*Bandwidth*360 / Period);

	HP[0] = (1 + alpha2 / 2)*(Close[0] - Close[1]) + 
		(1- alpha2)*HP[1];
		
	beta1 = rcos(360 / Period);
	
	gamma1 = 1 / rcos(360*Bandwidth / Period);
	alpha1 = gamma1 - sqrt(gamma1*gamma1 - 1);
	
	BP[0] = .5*(1 - alpha1)*(HP[0] - HP[2]) + 
		beta1*(1 + alpha1)*BP[1] - alpha1*BP[2];

	Peak[0] = .991*Peak[1];
	
	if (abs(BP[0]) > Peak[0]) Peak[0] = abs(BP[0]);
	
	if (Peak[0] != 0) Real[0] = BP[0] / Peak[0];
	
	DC[0] = DC[1];
	if (DC[0] < 6) DC[0] = 6;
	counter[0] = counter[1] + 1;
	
	if (crossOver(Real, 0) || crossUnder(Real, 0)) {
		DC[0] = 2*counter[0];					
		if (2*counter[0] > 1.25*DC[1]) {

			DC[0] = 1.25*DC[1];
		}
		if (2*counter[0] < .8*DC[1]) {
			DC[0] = .8*DC[1];
		}
		counter[0] = 0;
	}
	
	return DC[0];
}


function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 300;
	StartDate = 20210810;
	EndDate = 20210816;

	vars closes = series(priceClose());

	var dc = DCBandPass(closes, 20, .7);
	var ht_dc = HTDcPeriod(closes);
	
	var sma = SMA(closes, dc);
	var ht_sma = SMA(closes, ht_dc);
	
	plot("BPDC SMA", sma, MAIN, RED);
	plot("HTDC SMA", ht_sma, MAIN, BLACK);
	
	plot("BP DC", dc, NEW, RED);
	plot("HT DC", ht_dc, END, BLACK);
}

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 08/23/21 03:32

I like this one:


Code
#include <profile.c>

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) {	return cos(rad(degrees)); }
var rsin(var degrees) {	return sin(rad(degrees)); }

var DecyclerOscillator(var* Close, var HPPeriod1, var HPPeriod2)
{
	return HighPass2(Close, HPPeriod2) - HighPass2(Close, HPPeriod1);
}

var EvenBetterSinewave(vars Close, var HPLength, SSFLength)
{
	var Wave;
	var Pwr;
		
	var* HP = series(HighPass1(Close, HPLength), 2);
	if (HP[0] == 0) HP[0] = 1;
	
	var* Filt = series(Smooth(HP, SSFLength), 3);	
	Wave = SMA(Filt, 3);
	Pwr = (Filt[0]*Filt[0] + Filt[1]*Filt[1] + Filt[2]*Filt[2]) / 3;
	
	return Wave / sqrt(Pwr);
}

function run()
{
	set(PLOTNOW|PARAMETERS|PRELOAD);
	BarPeriod = 1;
	LookBack = 2000;
	StartDate = 20210701;
	EndDate = 20210816;

	Capital = 2000;
	Lots = 1;
	LotAmount = 5;
	Amount = 0;
	MaxLong = 5;
	MaxShort = 5;
	
	vars closes = series(priceClose());
	var close = closes[0];
	
	//var* smooth = series(Smooth(closes, 8));
	//var zma = ZMA(closes, 9);
	//var szma = ZMA(smooth, 6);
	
	//var osc = DecyclerOscillator(closes, 5, 9);
	//var ebsw = EvenBetterSinewave(closes, 4, 8);
	
	var ebsw = EvenBetterSinewave(closes, 4, 7);
	var stoch = StochEhlers(closes, 22, 152, 11);
	var* stochS = series(stoch);
	
	if (
		ebsw > .02
		&& stoch < .8
		&& rising(stochS)
	) enterLong();
	
	if (
		ebsw < -.91
		&& stoch > .2
		&& falling(stochS)
	) enterShort();

	//if (osc < 0) exitLong();	
	//if (osc > 0) exitShort();	
		
	
	// plot("ZMA", zma, MAIN, DARKBLUE);
	// plot("SZMA", szma, MAIN, CYAN);
	
	
	//if (osc > 0) osc = .5; else osc = -.5;
	
	plot("EBSW", ebsw, NEW, CYAN);
	plot("Stoch", stoch, NEW, MAGENTA);
	
	//plot("Decycler", osc, NEW, ORANGE);
	
	
	// plot("EBSW", ebsw, NEW, BLACK);	
}


Quote

Monte Carlo Analysis... Median AR 381%
Win 1800$ MI 1213$ DD 1573$ Capital 2504$
Trades 3236 Win 47.3% Avg +5.6p Bars 60
CAGR 17866.37% PF 1.12 SR 0.00 UI 0% R2 1.00


[Linked Image]



Simple setup.
Plenty of room for improvements.
High signal count.
Almost manageable drawdown.
Scalable.
Fast feedback.
Reasonably consistent.
Magical numbers ain't that magical.
Posted By: Lapsa

Re: Lapsa's very own thread - 08/24/21 00:22

Quote

If the commission is a percentage of the trade value, enter the negative percent value, f.i. -0.25 for 0.25%.
The commission is then automatically calculated from the percentage using the formula Commission = -Percent/100 * Price / LotAmount * PIPCost / PIP.
Posted By: Lapsa

Re: Lapsa's very own thread - 08/25/21 23:04

44 HP & 120 SSF on EBSW.

22 HP sort of workable.

I have given up on lower periods.

Unsure about upper bound.
Perhaps something at days & weeks scale.

Ain't interested - screws up feedback cycle too much.

P.s. Tether printer goes brrrrrrrrr
Posted By: Lapsa

Re: Lapsa's very own thread - 08/26/21 23:44

Incremental strategy development per month.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/02/21 09:51

Quote

the angle is a mostly useless parameter, although held in high esteem by Gann believers.


^_^
Posted By: AndrewAMD

Re: Lapsa's very own thread - 09/02/21 13:40

Read this, especially "Gann Magic":
https://financial-hacker.com/seventeen-popular-trade-strategies-that-i-dont-really-understand/

William Gallacher had a few words to say about Gann in Winner Take All as well.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/02/21 19:29

Already enjoyed that article. Sharing similar sentiment.

`Winner takes all` seems like a good read.
Have seen that title before.

Thanks.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/04/21 01:08

Think I've given up on thoroughly understanding what Sharpe ratio means, how it's affected and why should I care.

Quote

Sharpe Ratio = (r_x — R_f)/stdDev(r_x)


aka big numbers good, small numbers bad

That's about it.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/04/21 01:28

Perceptron experiments were fun although not quite the direction I would like to take.

I don't find:

Quote

Sig[0]*723 - Sig[1]*123 - Sig[2]*542 > your_mom


meaningful.

It's justified, even useful - but not particularly meaningful.

For me - such loss of clarity is unacceptable.

Similarly - I find Deep Learning repulsive.

Someday, maybe, likely I will change my mind. Who knows...
Posted By: Lapsa

Re: Lapsa's very own thread - 09/04/21 09:08

Just a reminder that winning trades is possible.


[Linked Image]

[Linked Image]

I wonder how will it land.

[Linked Image]

Hmm... That's quite a bump ignored.

[Linked Image]

As Ben Finegold would say: "Frankly ridiculous!"

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 09/07/21 00:48

Day4 - still in profits.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/07/21 09:39

Some more green numbers.


[Linked Image]


Can't say it's optimal.
Quite a spike ignored.

But hey - it's fully automatic!
Posted By: Lapsa

Re: Lapsa's very own thread - 09/07/21 23:03

Autocorrelation Periodogram Dominant Cycle

I think I fixed bugs. At least most of them.


Spikes looks suspicious.

And I still don't understand what's that MaxPwr decay line is supposed to do.
Perhaps some odd EasyLanguage behavior?

I mean - decay doesn't get applied. MaxPwr will always get initialized as zero.

Some room for refactoring: Correlation, EMA, AGC should be able to replace some lines.

Still a bit sluggish but might be actually usable.

Seems to be more accurate than calculating dominant period via Hilbert transform (assuming that it works correctly).
Combined with BandPass, some curve fitting and decreased smoothing - it seems like a reasonable strategy foundation.

Code
#include <profile.c>

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) { return cos(rad(degrees)); }
var rsin(var degrees) { return sin(rad(degrees)); }

var AutocorrelationPeriodogramCycle(vars Close)
{
	var AvgLength = 3;
	var M;
	var N;
	var X;
	var Y;
	var* HP = series(0, 3);
	var* Filt = series(0, 48);
	var Lag;
	var count;
	var Sx;
	var Sy;
	var Sxx;
	var Syy;
	var Sxy;
	var Period;
	var Sp;
	var Spx;
	var* MaxPwr = series(0,2);
	var DominantCycle;

	var Corr[48];
	var CosinePart[48];
	var SinePart[48];
	var SqSum[48];
	var R[48][2];
	var Pwr[48];

	// Highpass filter cyclic components whose periods are shorter than 48 bars
	HP = series(HighPass2(Close, 48), 3);
	
	//Smooth with a Super Smoother Filter from equation 3-3	
	//Filt = series(Smooth(HP, 10), 50); // original
	Filt = series(Smooth(HP, 8), 50);

	//Pearson correlation for each value of lag
	for (Lag = 0; Lag < 48; Lag++) {		
		//Set the averaging length as M
		M = AvgLength;
		if (AvgLength == 0) M = Lag;
		Sx = 0;
		Sy = 0;
		Sxx = 0;
		Syy = 0;
		Sxy = 0;
		
		for (count = 0; count < M - 1; count++) {
			X = Filt[count];
			Y = Filt[Lag + count];
			Sx = Sx + X;
			Sy = Sy + Y;
			Sxx = Sxx + X*X;
			Sxy = Sxy + X*Y;
			Syy = Syy + Y*Y;
		}
		
		if ( (M*Sxx - Sx*Sx)*(M*Syy - Sy*Sy) > 0 ) {
			Corr[Lag] = (M*Sxy - Sx*Sy)/sqrt((M*Sxx-Sx*Sx)*(M*Syy-Sy*Sy));
		}
	}
	
	for (Period = 10; Period < 48; Period++) {
		CosinePart[Period] = 0;
		SinePart[Period] = 0;
		
		for(N = 3; N < 48; N++) {
			CosinePart[Period] = CosinePart[Period] +	Corr[N]*rcos(370*N / Period);
			SinePart[Period] = SinePart[Period] + Corr[N]*rsin(370*N / Period);
		}
		SqSum[Period] = CosinePart[Period]*CosinePart[Period] +
		SinePart[Period]*SinePart[Period];
	}
	
	for (Period = 10; Period < 48; Period++) {
		R[Period][2] = R[Period][1];
		R[Period][1] = .2*SqSum[Period]*SqSum[Period] +.8*R[Period][2];
	}	
	
	// Find Maximum Power Level for Normalization
	MaxPwr[0] = .995*MaxPwr[0]; // huh? wtf?!
	for (Period = 10; Period < 48; Period++) {
		if (R[Period][1] > MaxPwr[0]) MaxPwr[0] = R[Period][1];
	}
	
	for (Period = 3; Period < 48; Period++) {
		Pwr[Period] = R[Period][1] / MaxPwr[0];
	}
	
	//Compute the dominant cycle using the CG of the spectrum
	Spx = 0;
	Sp = 0;
	for(Period = 10; Period < 48; Period++) {
		if (Pwr[Period] >= .5) {
			Spx = Spx + Period*Pwr[Period];
			Sp = Sp + Pwr[Period];
		}
	}
	
	if (Sp != 0) DominantCycle = Spx / Sp;
	if (DominantCycle < 10) DominantCycle = 10;
	if (DominantCycle > 48) DominantCycle = 48;
	
	return DominantCycle;
}

function run()
{
	set(PLOTNOW);
	BarPeriod = 1;
	LookBack = 100;
	StartDate = 20210815;
	EndDate = 20210825;

	vars Close = series(priceClose());
	var dc = AutocorrelationPeriodogramCycle(Close);
	var ht_dc = DominantPeriod(Close, 25);
	
	var* bp = series(BandPass(Close, dc*2, .0542)); // TEH BIG PLAYZ
	// var* bp_ht = series(BandPass(Close, ht_dc, .06));
	
	// if (valley(bp)) enterLong();
	// if (peak(bp)) enterShort();
	
	if (crossOver(bp, 0)) enterLong();
	if (crossUnder(bp, 0)) enterShort();
	
	plot("BP", bp, NEW, MAGENTA);
	// plot("BP HT", bp_ht, END, CYAN);
	plot("DC", dc, NEW, RED);
	plot("HT DC", ht_dc, END, BLUE);
}


[Linked Image]

Quote

Monte Carlo Analysis... Median AR 435%
Win 0.23$ MI 0.69$ DD 0.15$ Capital 1.61$
Trades 394 Win 47.5% Avg +5.8p Bars 28
AR 512% PF 1.12 SR 0.00 UI 0% R2 1.00


^ 10 days



no moar spikey:


Code
	for (Period = 10; Period < 48; Period++) {
		R[Period][2] = R[Period][1];
		// original
		// R[Period][1] = .2*SqSum[Period]*SqSum[Period] +.8*R[Period][2];
		
		// https://quantstrattrader.com/2017/02/15/ehlerss-autocorrelation-periodogram/
		// R[period, ] <- EMA(sqSum[period, ] ^ 2, ratio = 0.2)
		
		// Lapsa`s adaptation
		R[Period][1] = EMA(pow(SqSum[Period], 2), .2);
	}


Code

var rad(var degrees) { return degrees*PI/180; }
var rcos(var degrees) {	return cos(rad(degrees)); }
var rsin(var degrees) {	return sin(rad(degrees)); }

var AutocorrelationPeriodogramCycle(var* Close)
{
	var AvgLength = 3;
	var M;
	var N;
	var X;
	var Y;
	var* HP = series(0, 3);
	var* Filt = series(0, 48);
	var Lag;
	var count;
	var Sx;
	var Sy;
	var Sxx;
	var Syy;
	var Sxy;
	var Period;
	var Sp;
	var Spx;
	var* MaxPwr = series(0,2);
	var DominantCycle;

	var Corr[48];
	var CosinePart[48];
	var SinePart[48];
	var SqSum[48];
	var R[48][2];
	var Pwr[48];

	// Highpass filter cyclic components whose periods are shorter than 48 bars
	HP = series(HighPass2(Close, 48), 3);
	
	//Smooth with a Super Smoother Filter from equation 3-3	
	//Filt = series(Smooth(HP, 10), 50);
	Filt = series(Smooth(HP, 10), 50);

	//Pearson correlation for each value of lag
	for (Lag = 0; Lag < 48; Lag++) {		
		//Set the averaging length as M
		if (AvgLength == 0) M = Lag;
		else M = AvgLength;
		
		Sx = 0;
		Sy = 0;
		Sxx = 0;
		Syy = 0;
		Sxy = 0;
		
		for (count = 0; count < M - 1; count++) {
			X = Filt[count];
			Y = Filt[Lag + count];
			Sx = Sx + X;
			Sy = Sy + Y;
			Sxx = Sxx + X*X;
			Sxy = Sxy + X*Y;
			Syy = Syy + Y*Y;
		}
		
		if ( (M*Sxx - Sx*Sx)*(M*Syy - Sy*Sy) > 0 ) {
			Corr[Lag] = (M*Sxy - Sx*Sy)/sqrt((M*Sxx-Sx*Sx)*(M*Syy-Sy*Sy));
		}
	}
	
	for (Period = 10; Period < 48; Period++) {
		CosinePart[Period] = 0;
		SinePart[Period] = 0;
		
		for(N = 3; N < 48; N++) {
			CosinePart[Period] = CosinePart[Period] +	Corr[N]*rcos(370*N / Period);
			SinePart[Period] = SinePart[Period] + Corr[N]*rsin(370*N / Period);
		}
		SqSum[Period] = CosinePart[Period]*CosinePart[Period] +
		SinePart[Period]*SinePart[Period];
	}
	
	for (Period = 10; Period < 48; Period++) {
		R[Period][2] = R[Period][1];
		// original
		// R[Period][1] = .2*SqSum[Period]*SqSum[Period] +.8*R[Period][2];
		
		// https://quantstrattrader.com/2017/02/15/ehlerss-autocorrelation-periodogram/
		// R[period, ] <- EMA(sqSum[period, ] ^ 2, ratio = 0.2)
		
		// Lapsa`s adaptation
		R[Period][1] = EMA(pow(SqSum[Period], 2), .2);
	}
	
	// Find Maximum Power Level for Normalization
	
	MaxPwr[0] = .995*MaxPwr[0]; // huh? wtf?!
	for (Period = 10; Period < 48; Period++) {
		if (R[Period][1] > MaxPwr[0]) MaxPwr[0] = R[Period][1];
	}
	
	for (Period = 3; Period < 48; Period++) {
		Pwr[Period] = R[Period][1] / MaxPwr[0];
	}
	
	//Compute the dominant cycle using the CG of the spectrum
	Spx = 0;
	Sp = 0;
	for(Period = 10; Period < 48; Period++) {
		if (Pwr[Period] >= .5) {
			Spx = Spx + Period*Pwr[Period];
			Sp = Sp + Pwr[Period];
		}
	}
	
	if (Sp != 0) DominantCycle = Spx / Sp;
	if (DominantCycle < 10) DominantCycle = 10;
	if (DominantCycle > 48) DominantCycle = 48;
	
	return DominantCycle;
}


[Linked Image]

Failed to use Correlation function successfully.
I mean - I can pinpoint what should be replaced yet failing to do that cause of LiteC and my stupidity.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/09/21 11:12

((38 * 45) * 1440) * 90 = 221616000

Lots of looping even for Lite C.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/09/21 22:45

Well... This is actually kind of impressive.

Autocorrelation periodogram approach calculated dominant cycle long bandpass filtering <----- try reading that to someone

With some slight tinkering (e.g. removed smoothing, adjusted peak decay & whatnot).


[Linked Image]

Quote

Monte Carlo Analysis... Median AR 3932%
Win 0.73$ MI 22.12$ DD 0.24$ Capital 6.58$
Trades 166 Win 51.2% Avg +8.7p Bars 8
AR 4036% PF 1.37 SR 0.00 UI 0% R2 1.00


166 trades on a single (!) day with 1.37 PF (fees included)

[Linked Image]


Think I won't take a look how miserably it fails on other days.
Too much hopelessness already.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/09/21 22:55

^ 3 Trades, Win 100%, Avg 558.2p, PF 10.00 on 45 BarPeriod

grin
Posted By: Lapsa

Re: Lapsa's very own thread - 09/14/21 11:49

For the memes - played around with idea of adapting Ichimoku Cloud.

Think there's some tangible benefit floating Kijun a bit.
Maaaaaaaaybe Tenkan too.

This is what happens when you mess with Senkou and Displacement bit too much:


[Linked Image]


Japanese cloud becomes a crack addict.

Anyhow... As much as I like Ichimoku system esthetically, just as much I find it useless.

Also - annoyed that I couldn't find a way to alter cloud color.
Also - it's unclear how to figure out "future" cloud.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/14/21 19:57

hmm... might be up to something

Quote

Monte Carlo Analysis... Median AR 2319%
Win 0.99$ MI 2.60$ DD 0.16$ Capital 1.64$
Trades 44 Win 70.5% Avg +224.6p Bars 377
AR 1901% PF 3.71 SR 0.00 UI 0% R2 1.00


^ 12 days period

----

PF 1.30 since May 1st


[Linked Image]


----

PF 1.50 since May 1st

Not much room left for improvements.
Trying to land 1.70 (failed)
Posted By: Lapsa

Re: Lapsa's very own thread - 09/16/21 19:18

current run


[Linked Image]


boringly good so far

more interested how it behaves when things go wrong
Posted By: Lapsa

Re: Lapsa's very own thread - 09/18/21 18:18

some turbulence

didn't take profit but to be fair - I would have kept it open too

did expect a dump

[Linked Image]

so far so good
Posted By: Lapsa

Re: Lapsa's very own thread - 09/20/21 06:59

and the wish has been granted. back to square #1

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 09/20/21 23:07

hurrr durrr evergrande
Posted By: Lapsa

Re: Lapsa's very own thread - 09/21/21 20:53

Found an equivalent of Ehler's Pearson correlation calculation to Zorro's in built Correlation.

Mental model is still quite muddy but as it seems - this may be kind of huge.

If Ehler is wrong (or my translation thereof) - this might trim whole bar of lag.

Code
for (count = 0; count < M - 1; count++) {


It's unclear to me why original script has `count < M - 1` instead of just `count < M`.



Code
#include <profile.c>

var Corr(var* Close)
{
	var AvgLength = 0;
	var M;
	var X;
	var Y;
	var Lag;
	var count;
	var Sx;
	var Sy;
	var Sxx;
	var Syy;
	var Sxy;

	var Corr[48];

	var* HP = series(HighPass2(Close, 48), 50);
	var* Filt = series(Smooth(HP, 10), 50);

	//Pearson correlation for each value of lag
	for (Lag = 0; Lag < 48; Lag++) {		
		//Set the averaging length as M
		M = AvgLength;
		if (AvgLength == 0) M = Lag;
		Sx = 0;
		Sy = 0;
		Sxx = 0;
		Syy = 0;
		Sxy = 0;
		
		for (count = 0; count < M; count++) {
			X = Filt[count];
			Y = Filt[Lag + count];
			Sx = Sx + X;
			Sy = Sy + Y;
			Sxx = Sxx + X*X;
			Sxy = Sxy + X*Y;
			Syy = Syy + Y*Y;
		}
		
		if ( (M*Sxx - Sx*Sx)*(M*Syy - Sy*Sy) > 0 ) {
			Corr[Lag] = (M*Sxy - Sx*Sy)/sqrt((M*Sxx-Sx*Sx)*(M*Syy-Sy*Sy));
		}

	}
	return Corr[3];
}
function run()
{
	set(NFA|PLOTNOW);
	StartDate = 20210903;
	EndDate = 20210903;
	Outlier = 0;
	BarPeriod = 1;
	LookBack = 100;
	BarMode = BR_FLAT;

	Verbose = 2;
	
	var* Close = series(priceClose());

	var* x = series(Corr(Close));
	
	var* HP = series(HighPass2(Close, 48), 50);
	var* Filt = series(Smooth(HP, 10), 50);
	
	var y = Correlation(Filt, Filt+3, 3);

	plot("x", x, NEW, RED);
	plot("y", y, END, BLUE);
}


[Linked Image]



Feeling too dumb to figure it out.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/22/21 00:28

Please, stay above the water.

I'm not even asking gazillion profits.

Quote

Monte Carlo Analysis... Median AR 436%
Win 32.16$ MI 6.80$ DD 5.22$ Capital 22.59$
Trades 319 Win 55.8% Avg +144.0p Bars 648
AR 361% PF 1.84 SR 0.00 UI 0% R2 1.00


------------

yeah but no...319 trades only...
curve fitting too stronk
Posted By: Lapsa

Re: Lapsa's very own thread - 09/24/21 09:52

[Linked Image]

for a change - I'm on a right side
Posted By: Lapsa

Re: Lapsa's very own thread - 09/26/21 21:08

newest strategy name: "usyk"

has to be a winner
Posted By: Lapsa

Re: Lapsa's very own thread - 09/27/21 21:38

smooth price close on 6 periods

pull out 3 period long RSIS out of it

do nothing unless rsis[0] != rsis[1]

boom! 172% -> 453%

makes no sense whatsoever
Posted By: AndrewAMD

Re: Lapsa's very own thread - 09/27/21 23:28

Originally Posted by Lapsa
makes no sense whatsoever
Usually a red flag.
Posted By: Lapsa

Re: Lapsa's very own thread - 09/28/21 06:37

Originally Posted by AndrewAMD
Originally Posted by Lapsa
makes no sense whatsoever
Usually a red flag.


yes and no

I mean - what such mechanism does is sort of understandable

it helps to follow trend

x3 difference it makes is what I find... err... quite peculiar

and it's not like there's 10 lucky trades.
think it was like 3k trades over 5 month period or something
Posted By: Lapsa

Re: Lapsa's very own thread - 09/28/21 23:07

got an old Toshiba laptop with an Arch Linux running on top of it

took awhile but I've managed to run Zorro via Wine on it successfully

fails to play those lovely sound notifications though

https://freesound.org/people/andrewweathers/sounds/25423/
https://freesound.org/people/dpren/sounds/248143/
https://freesound.org/people/phatcorns/sounds/250104/

---------------

weirdly requires manual creation of Cache folder

and sadly - eventually stops working in an hour or so

but it did open and close a (successful!) trade
Posted By: Lapsa

Re: Lapsa's very own thread - 09/29/21 01:39

with all-in compounding $5k

Quote

Monte Carlo Analysis... Median AR 233%
Win 47545$ MI 12061$ DD 9470$ Capital 7335$
Trades 1791 Win 60.1% Avg +19.8p Bars 88
CAGR 128676.60% PF 1.23 SR 0.00 UI 0% R2 1.00


sometimes worth taking a look at those cute numbers
Posted By: Lapsa

Re: Lapsa's very own thread - 10/01/21 00:25

some probably quite useless thoughts...

when it comes to crypto, I think the best strategy is to work on really short periods of time

what I mean is - most of the indicators should be very short sighted

like 3m, 5m, 9m even 2m. perhaps some high pass filtering on 20m, 30m

1. spam confirmations. as indicators are shortsighted - they are likely to align.
indicator combinations yield much more precise control over entries / exits

2. use something trend following like Ehler's even better sinewave to avoid whipsaws.
alternatively - some form of "throttling". like RSIS trick I described.
falling MMI on (!) 4m also qualifies

3. rely on trailing stops and do set a (quite loose) stop loss

4. favor priceClose() over price(). do test both though.
some indicators tend to be more strategic than tactical by their intrinsic nature

5. occasionally - some roofing, filtering, windowing, smoothing can be a game changer

6. favor steadily raising equity curve over flat one with spikes during black swans.
do make sure algo would have survived those in past

7. any change affects everything. rules can become obsolete, hindering, improvable.
parameter optimization can be helpful but it can also lead you astray
Posted By: Lapsa

Re: Lapsa's very own thread - 10/01/21 00:29

in other news:

did notice that Zorro via Wine suddenly shows up (surprisingly high) Sharpe Ratio on test runs

not sure what's up with that

always damn zero on Win10
Posted By: Lapsa

Re: Lapsa's very own thread - 10/17/21 10:58

still around, tuning my indicator soup, slowly scaling up

zero to hero porn:

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 10/18/21 21:09

day in profits
Posted By: Lapsa

Re: Lapsa's very own thread - 10/21/21 06:01

day in losses
Posted By: Lapsa

Re: Lapsa's very own thread - 10/21/21 14:52

upgraded to Zorro v2.42

Sharpe Ratio is alive!!!111 woohoooooo!
Posted By: Lapsa

Re: Lapsa's very own thread - 10/22/21 15:35

I wonder why backtest differs from actual trades.

Zorro just skipped 2 trades in last couple hours.

Makes whole thing sort of useless.
Posted By: Grant

Re: Lapsa's very own thread - 10/22/21 19:10

Are you still running Zorro in a Wine environment? This could be a problem.
So far, I only noticed some visual issues (like minimizing and then maximizing the Zorro window results in an unreadable screen and the current performance gets replaced by the bar counter when not being in a trade in test mode)

I would suggest to create a trade log with relevant variable values & broker calls (i.e. brokerCommand calls).
Posted By: Lapsa

Re: Lapsa's very own thread - 10/22/21 19:52

@Grant

Nope... Specifically installed Win7 on laptop.

Currently seems to be running fine.

Need to collect more data indeed.
Posted By: Lapsa

Re: Lapsa's very own thread - 10/22/21 20:02

This is what I'm running live (scaled up).

I do expect it to at least break even.

Quote

Lots=10;
StartDate = 20210501;
EndDate = 20211231;


Quote

Test: foxer MATICUSDT 2021
Monte Carlo Analysis... Median AR 825%
Win 103$ MI 18.03$ DD 4.44$ Capital 22.82$
Trades 2135 Win 59.6% Avg +48.5p Bars 102
AR 949% PF 1.50 SR 7.76 UI 1% R2 0.00


And I sort of like this bit:

Quote

divergence != 8


It's possible to enable hedge mode on Binance.
Although unsure if I want to.
Posted By: Lapsa

Re: Lapsa's very own thread - 10/23/21 09:06

Guess I panicked too fast.

Whole thing is sensitive to starting point.

Max trades 1, reliance on trailing stops, perhaps some internet lags.

Whole thing is kind of bound to differ.

I guess it syncs up eventually? Will keep an eye.

Anyhow... Here's actual trade results:

[Linked Image]

That 6 in a row looks sweet.

Here's backtest:

[Linked Image]

Still doing cent trades...
Could pour in, but first - want an actual success not just paper trades and backtests.
Posted By: Grant

Re: Lapsa's very own thread - 10/23/21 17:34

This is interesting to observe. It just shows how hard it is to simulate trades in a realistic way, esp in an intraday scenario.
Not a knock on Zorro, because this is a true challenge that all platforms are dealing with.
Posted By: Lapsa

Re: Lapsa's very own thread - 10/23/21 18:31

broke 1k % barrier

Quote

Test: foxer MATICUSDT 2021
Monte Carlo Analysis... Median AR 909%
Win 109$ MI 18.95$ DD 4.12$ Capital 22.01$
Trades 2144 Win 59.6% Avg +50.9p Bars 102
AR 1033% PF 1.53 SR 8.16 UI 1% R2 0.00


day likely to end in profits
Posted By: Lapsa

Re: Lapsa's very own thread - 10/24/21 08:43

I mean - if it would consistently pull out days like these:

[Linked Image]

could afford to buy a house in couple months
Posted By: Lapsa

Re: Lapsa's very own thread - 10/24/21 18:06

more squeezing

Quote

foxer compiling................
Test: foxer MATICUSDT 2021
Monte Carlo Analysis... Median AR 1049%
Win 122$ MI 20.93$ DD 4.12$ Capital 21.97$
Trades 2127 Win 59.6% Avg +57.1p Bars 105
AR 1143% PF 1.61 SR 9.02 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 10/26/21 07:39

scaled up, took losses

what's the point of such PF if it's unstable

anyhow... got some revelations

algo gonna get some major reconstructions
Posted By: Lapsa

Re: Lapsa's very own thread - 10/27/21 20:54

did attempt to reconstruct. found some new observations

equity curve looked worse - can't argue with data.
ended up improving existing one

broke even from weekend losses and got into new ones cause of own mistake.
there's a disaster waiting if you try to trade close to margin

still learning...
Posted By: Lapsa

Re: Lapsa's very own thread - 10/28/21 01:35

Quote

Test: foxer MATICUSDT 2021
Monte Carlo Analysis... Median AR 1130%
Win 133$ MI 22.45$ DD 4.12$ Capital 21.88$
Trades 2084 Win 60.3% Avg +63.7p Bars 109
AR 1232% PF 1.68 SR 9.68 UI 1% R2 0.00



with silly `Lots = max(50, Balance);`

Quote

Test: foxer MATICUSDT 2021
Monte Carlo Analysis... Median AR 124%
Win 1515868$ MI 256543$ DD 378716$ Capital 2856496$
Trades 2084 Win 60.3% Avg +63.7p Bars 109
AR 108% PF 1.19 SR 2.65 UI 7% R2 0.58

Posted By: Lapsa

Re: Lapsa's very own thread - 10/29/21 07:50

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 10/29/21 10:00

Falling MMI 4

Quote

Thus, when we know that MMI is rising, we assume that the market is becoming more efficient,
more random, more cyclic, more reversing or whatever, but in any case bad for trend trading.

However when MMI is falling, chances are good that the next beginning trend will last longer than normal.

jcl


Figured I should visualize this falling MMI 4 trick I've been using.

And it sort of works just as I imagined - as a smart throttler.

A means to recognize start of the trend and follow it.


Code
function run() 
{
	set(LOGFILE|PLOTNOW);
	BarPeriod = 60;
        MaxBars = 200;
	asset(""); // dummy asset
	ColorUp = ColorDn = 0; // don't plot a price curve
	vars Sine = series(genSine(60,30));
	var mmi = MMI(Sine, 4);
	plot("Sine",Sine[0]-0.5,MAIN,BLUE);
	plot("MMI 4", mmi, NEW, RED);
	plot("MMI Falling", falling(series(mmi)), NEW, GREEN);
}


[Linked Image]

On 2 bars it (logically) refuses to speak.
On 3 bars it skips.
On 5+ bars it lags.

I mean - indicator itself is definitely useful on longer periods.
It's just not how I've built my algo.

Here's numbehs to show crucial role this single rule is playing:

Quote

Trades 4069 Win 59.8% Avg +6.7p Bars 59
AR 117% PF 1.08 SR 1.90 UI 10% R2 0.00

Trades 2096 Win 60.2% Avg +62.8p Bars 109
AR 1217% PF 1.66 SR 9.53 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 10/29/21 12:11

I hate trailing stops, I really do

so deceiving

I mean - I'm pulling my hair fine tuning entries yet somehow such simple mechanic as trailing stop is supposed to be helpful
Posted By: Lapsa

Re: Lapsa's very own thread - 10/30/21 07:40

squeezing squeezing!

Quote

Monte Carlo Analysis... Median AR 1255%
Win 146$ MI 24.36$ DD 4.12$ Capital 21.81$
Trades 2074 Win 60.7% Avg +70.3p Bars 111
AR 1340% PF 1.75 SR 10.38 UI 1% R2 0.00


broken milestones:
- 1300%
- PF 1.7
- SR 10
Posted By: Lapsa

Re: Lapsa's very own thread - 11/01/21 17:08

need to figure out how to compound it correctly
Posted By: Lapsa

Re: Lapsa's very own thread - 11/03/21 04:27

losses only

to the point I'm willing to drop the ball

burn it all down or reborn like a phoenix!
Posted By: Lapsa

Re: Lapsa's very own thread - 11/03/21 19:26

[Linked Image]

oh well... it's not that bad
Posted By: Lapsa

Re: Lapsa's very own thread - 11/06/21 12:11

Code
setf(PlotMode,PL_ALL+PL_FINE+PL_ALLTRADES+PL_BENCHMARK);
Posted By: Lapsa

Re: Lapsa's very own thread - 11/06/21 19:07

Quote

Test: foxer SOLUSDT 2021
Monte Carlo Analysis... Median AR 529%
Win 65.80$ MI 11.25$ DD 5.57$ Capital 25.51$
Trades 1413 Win 62.1% Avg +32.8p Bars 181
AR 529% PF 1.57 SR 6.95 UI 2% R2 0.77


won't trade this one yet - numbahs unsatisfying

but I do have in mind adding another asset/s
Posted By: Lapsa

Re: Lapsa's very own thread - 11/09/21 07:07

Quote

Monte Carlo Analysis... Median AR 784%
Win 128$ MI 21.94$ DD 9.02$ Capital 34.09$
Trades 1747 Win 63.2% Avg +73.5p Bars 146
AR 772% PF 1.80 SR 8.35 UI 1% R2 0.00


breaking PF 1.80

Sharpe unhappy cause I took off stop losses while tweaking
Posted By: Lapsa

Re: Lapsa's very own thread - 11/10/21 22:30

Quote

Channeling and Elliott Waves

Channeling an impulse wave can frequently help predict the approximate ending locations of various waves.


wtf o_0

anyhow - algo doing bit badly. an ugly, prolonged drawdown

tweaked a bit, slightly lowered the bet

lo and behold - half way there to breaking even with a single trade

[Linked Image]

bugcoin doing funny moves
Posted By: Lapsa

Re: Lapsa's very own thread - 11/11/21 06:58

this is beautiful

I love Wednesdays

[Linked Image]

should finally do something about those pesky weekends

sort of bummer knowing they almost always red

------

1-2 weeks
scale up if breaks even / in profits

------

backtests makes zero sense

[Linked Image]

what the hell is going on?
Posted By: Lapsa

Re: Lapsa's very own thread - 11/15/21 21:05

yet to see a good use for windowing

I guess my approach just isn't compatible
Posted By: MegaTanker

Re: Lapsa's very own thread - 11/20/21 20:18

What's the deal with these insane backtests? 1000+% annual return, but it sounds like the live results don't live up to this, if I read that correctly?
Posted By: Grant

Re: Lapsa's very own thread - 11/20/21 22:43

I think that's the issue with cryptocurrencies. Their extreme volatility makes it pretty much impossible to create reliable backtests.
Posted By: Lapsa

Re: Lapsa's very own thread - 11/20/21 23:15

Originally Posted by MegaTanker
What's the deal with these insane backtests? 1000+% annual return, but it sounds like the live results don't live up to this, if I read that correctly?


Well... That's the thing with backtests. Past doesn't repeat itself.

Green backtest is just a small step to trade effectively.
Markets aren't simple - there's a lot of stuff going on.

Trading fully automatically while basing decisions purely on TA (with no access to volume) is quite ambitious.

About 600% from those ~1200% are from May crypto crash which is a black swan and doesn't repeat monthly.
I do think it's important to include ability to surf such waves.

Out of those 600% - I would say 50% to 200% *might be* sort of actually realistic.

One issue with measuring performance is that I'm constantly tinkering with it.
However - I do believe in such approach. If you keep bashing squares into circled holes - eventually they become circles.
Backtest shows PF1.7 (on a flat bet) but I see PF0.9, maybe PF1.2

October was in slight profits. But there were like at least 10 iterations of algo updates (starting from about AR 300%).
And mostly on fixed $10 trades.
November is red so far.
Markets retesting all time highs, stuck in indecisiveness. Probably not for long.

Quote

from $5k

Monte Carlo Analysis... Median AR 83%
Win 555327679$ MI 83282622$ DD 278602844$ Capital 1614994560$
Trades 2087 Win 59.7% Avg +70.8p Bars 121
AR 62% PF 1.18 SR 2.09 UI 7% R2 0.45


Even if history did repeat - soon enough it wouldn't.
Pulling out 5% of total market cap can't go unnoticed.

But you never know unless you live trade.
Posted By: Lapsa

Re: Lapsa's very own thread - 11/20/21 23:19

Also - it's important to understand that 0% -> 10% is not the same as 1000% -> 1010% on a simulated compounding system.

Those numbers get ridiculous really fast.
Posted By: MegaTanker

Re: Lapsa's very own thread - 11/21/21 07:09

Originally Posted by Lapsa

One issue with measuring performance is that I'm constantly tinkering with it.
However - I do believe in such approach. If you keep bashing squares into circled holes - eventually they become circles.
Backtest shows PF1.7 (on a flat bet) but I see PF0.9, maybe PF1.2


I don't know what your strategies and workflow look like but "tinkering" here sounds a lot like overfitting, doesn't it? If you're adjusting parameters or adding new mechanisms that increase the AR in the backtest, you can introduce all sorts of biases into it even with OOS testing.

Originally Posted by Lapsa


About 600% from those ~1200% are from May crypto crash which is a black swan and doesn't repeat monthly.
I do think it's important to include ability to surf such waves.


You have to be confident that your strategy wins this black swan event not by chance though. I've also played around with the MATIC coin some time and the backtests were often defined by that burst of volatility in may. But if there are 2-3 trades happening that capture these insane price jumps, I just don't know how I can know if that is random luck or if the script can actually be on the right side of these reliably. And since I'm pessimistic, I rather exclude those times from the backtest personally. Though I also don't include any mechanism in the scripts so far that specifically react to these moments.
Posted By: Lapsa

Re: Lapsa's very own thread - 11/21/21 09:43

Originally Posted by MegaTanker

I don't know what your strategies and workflow look like but "tinkering" here sounds a lot like overfitting, doesn't it?
If you're adjusting parameters or adding new mechanisms that increase the AR in the backtest, you can introduce all sorts of biases into it even with OOS testing.


Yes and no.

I mean - I would gladly have PF0 algo that somehow magically is vastly profitable.
Question is - how do you know?

How do you determine this mythical boundary at which improvements suddenly becomes overfitting?

5 successes out of 10 are much less meaningful than 500 out of 1000.
One of my rules is to strive for relatively high trade count (>2000).

I have removed couple weird rules despite losing %.
I still have some of them.

Trade and see. Adapt. Think deeply about every rule you adjust.
It's not random.

You can enter a long, see a dip and think - it's over.
Or you can see it as a temporary sweep, wait a bit longer and be in profits.

Originally Posted by MegaTanker

You have to be confident that your strategy wins this black swan event not by chance though. I've also played around with the MATIC coin some time and the backtests were often defined by that burst of volatility in may. But if there are 2-3 trades happening that capture these insane price jumps, I just don't know how I can know if that is random luck or if the script can actually be on the right side of these reliably. And since I'm pessimistic, I rather exclude those times from the backtest personally. Though I also don't include any mechanism in the scripts so far that specifically react to these moments.


[Linked Image]

I am reasonably confident. It's not just 2-3 trades. There's like hundred in May.
Would say - it's actually algo's strong suit to handle such times.

Marked other bursts of volatility.
Either it rides it or gets stopped out and stays relatively flat.

Originally Posted by MegaTanker

I rather exclude those times from the backtest personally


Mentally - I do that.
Practically - I would rather have them just to keep some sort of assurance whole thing won't go bankrupt in seconds.

Keeping such ability seemingly hinders algo, removes a lot of room during "normal times".
But on grand scale of things - I think it actually rises the bar and increases adaptivity.

Originally Posted by MegaTanker

or adding new mechanisms


It's important to think about synergy.

I try to build it from "you don't want to flip here" standpoint instead of "this is the time you trade".

Instead of SMA 50-200 cross or perhaps valley/peak like rule - I favor rise & fall.
It's careful filtering instead of catching glaringly obvious tells (in fact - I might include such layer in future).

When you build it such way - rules seem to indicate same thing yet do that differently.
Once you get to combinations of rules - they start to cover up each others weaknesses.

If we take that same SMA 50-200 cross and combine it with (imo shitty) UO - there's a good chance you can change it to 49-199 cross.
Posted By: MegaTanker

Re: Lapsa's very own thread - 11/22/21 10:25

Well, I think we have very different styles to be sure grin

Like, if your strategy actually works the way it appears in the backtest, then you will be filthy rich quickly. But if it doesn't, if you don't know to what extent it is biased/fitted, if you don't know to what extent it represents reality, I wouldn't use it at all to judge my strategy.
Posted By: Lapsa

Re: Lapsa's very own thread - 11/22/21 18:43

@MegaTanker

I don't think it works just as good as in backtest.

But the past is reality.

If your algo captures every movement in complete asset's history - there is no better bet.
Unless you are talking to time travelers.

Sure - some rules that worked in past might hinder in future.
Which is why I'm pro-tinkering.

I find it similar to software development - if your code is scary to touch, contradictory to your feelings, you want to bash it more until it isn't.

Every bias, every fitting is an improvement at particular point in time.
Trick is to align them so they don't interfere.

Speaking of ridiculous numbers - those are rookie numbers.

Once wrote a script that iterates backwards in time, captures everything in generated code.
Theoretically speaking - you can get to gazillion in couple days starting from couple bucks.
Slightly less as I didn't include fees that time but you get the idea.

Can't align those rules.
Posted By: Lapsa

Re: Lapsa's very own thread - 11/22/21 18:57

Quote
price(int offset) : var

Returns the mean price of the selected asset, by averaging all price ticks of the given bar or time frame (TWAP, time-weighted average price).


I suspect this is the main reason live differs from backtest.
Got no ticks.

Perhaps can be fixed by using MedPrice() but I'm unsure if that's desirable.
Posted By: Lapsa

Re: Lapsa's very own thread - 11/22/21 19:58

[Linked Image]

oh my... that's a new one
Posted By: Lapsa

Re: Lapsa's very own thread - 11/29/21 00:32

@MegaTanker

Here's an example of "my workflow" and tinkering.

Algo has a nasty draw down on November.
(or perhaps - more accurate picture of an actual performance)

Anyhow...

Copied algo into a new file, called it foxer_black_friday.c
Placed start date 2 weeks ago.
Killed all rules I found vaguely superficial.
Tweaked all rules till I reached ~1.5k% (from red abyss of -300% something).

And then - carefully incorporated only the best parts back into original.

2 week period retest went down to "only" +50%.

[Linked Image]
[Linked Image]

In ROFLcopter numbehs:

Quote

May 1st, $180 start =>

Test: foxer MATICUSDT 2021
Monte Carlo Analysis... Median AR 96%
Win 6169001$ MI 886650$ DD 2514043$ Capital 14074158$
Trades 2345 Win 60.7% Avg +62.4p Bars 114
AR 76% PF 1.15 SR 2.03 UI 6% R2 0.68
Posted By: Lapsa

Re: Lapsa's very own thread - 11/29/21 00:56

Why MATIC?

As it's futures algo trading - I don't really care much about the underlying asset.

But... There are some considerations.

First and foremost - the fees!

.5% movement in BTC will show up as 2% movement in MATIC

Given fees on Binance are percentage based - you end up wasting less.

Second - the nature of asset.

MATIC is pretty much a tech lubricant with a promise of providing less transaction fees for Ethereum.
(haven't even read up on details)

That causes an entanglement. I find it unlikely for MATIC to "moon" or dump completely unless it follows ETH.

I believe this intrinsic entanglement also causes pattern repetition. Some sort of similar swings around ETH.

It's not a glaringly obvious pump & dump scam scheme.
It's not completely hype based (well... sort of. whole crypto thing can be seen as such).

And that pretty much sums it up.
Posted By: Lapsa

Re: Lapsa's very own thread - 12/08/21 08:10

more tweaks

Quote

Monte Carlo Analysis... Median AR 1109%
Win 153$ MI 21.15$ DD 5.61$ Capital 24.22$
Trades 2524 Win 60.4% Avg +60.7p Bars 110
AR 1048% PF 1.62 SR 9.21 UI 1% R2 0.00


all time high numbers were PF 1.70 SR 10

about 2 months of new data since start

fact that it's still going 24/7 is already an achievement

------------------------------------

in ROFLcopter numbehs and land of sunshine - even Zorro refuses to take it seriously

[Linked Image]

^ $5k start capital
Posted By: Lapsa

Re: Lapsa's very own thread - 12/09/21 22:37

during Tuesday -> Wednesday, doubled up whole capital

I mean, it's trading - could disappear just as fast

good news is that compounding setup seems to be satisfactory so far

tuned up tradingview - OHLC/4, Ichimoku, MESA, Volume. nice & clean


[Linked Image]
Posted By: Grant

Re: Lapsa's very own thread - 12/10/21 15:20

I assume you're still paper trading or are you running a live account?
Posted By: Lapsa

Re: Lapsa's very own thread - 12/10/21 17:16

@Grant

no. I'm running live account, 24/7. about 10-20 trades per day

backtests are in period May 1st until now (see specific post creation date)
Posted By: Grant

Re: Lapsa's very own thread - 12/10/21 17:35

Being profitable in the volatile crypto space is no joke, so congratulations with that!

Was there a specific statistical edge during your testing phase that gave you enough confidence to go live?
I'm asking this because I'm in the process to make this step in the near future.
Posted By: Lapsa

Re: Lapsa's very own thread - 12/10/21 18:25

@Grant

too soon

combined with all the failures of early experimentation - I am NOT a profitable trader yet.
given algo stays stable - hoping to be in couple weeks, perhaps a month

if I'm a lucky bastard - filthy rich in half a year. gut feels ~ 3% chance

> Was there a specific statistical edge during your testing phase that gave you enough confidence to go live?

well...

after fiddling for hours - seeing profit factor of 1.5 over six months period was enough to pull the trigger.
relatively high trade count is also reassuring.
and I already had experimented before so had some thoughts of what to expect

as I see it - you want to go live as soon as possible.
and threshold of doing that should be sustainability

when trading lowest possible bets - I'm basically buying insight for couple bucks.
aim is a stable system with an actual track record as opposed to couple miracle trades
Posted By: Grant

Re: Lapsa's very own thread - 12/10/21 21:03

With a daily average of 10-20 trades/day it shouldn't take too long to draw conclusions. Hopefully, your relative drawdown is within an acceptable range.

Yeah, things can go fast once you have enough confidence to raise your leverage (do not forget to post a pic of your Malibu residence).

An out-of-sample p.f. of >1.5 is definitely impressive for a long period. I have similar results for the EURUSD, but those are still offline ones. I will start paper trading on a demo once I have similar stats on 4 other pairs as well.

Mind you, I'm very cautious given my formal live experience with MT4. It went great for 2-3 months, but at some point a couple of poor trades with too much leverage turned my system into a nightmare.
So yeah, your suggestion to be conservative with leverage in the early stage is a good one.
Posted By: Lapsa

Re: Lapsa's very own thread - 12/11/21 11:21

moar tweaks

Quote

Monte Carlo Analysis... Median AR 1150%
Win 164$ MI 22.24$ DD 5.56$ Capital 23.98$
Trades 2590 Win 60.6% Avg +63.3p Bars 109
AR 1113% PF 1.65 SR 9.56 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 12/13/21 05:01

it's going suspiciously well lately

think every day past week got into green zone (!) including the weekend

lets see if it flops this week.
at such rate - beating job salary income ain't far away
Posted By: Lapsa

Re: Lapsa's very own thread - 12/18/21 12:52

break even -ish week. which is fine

Saturday's number crunching

Quote

Test: foxer_prev MATICUSDT 2021
Monte Carlo Analysis... Median AR 1015%
Win 167$ MI 22.03$ DD 5.56$ Capital 23.79$
Trades 2691 Win 60.5% Avg +62.2p Bars 108
AR 1111% PF 1.63 SR 9.46 UI 1% R2 0.00

Test: foxer MATICUSDT 2021
Monte Carlo Analysis... Median AR 1191%
Win 170$ MI 22.36$ DD 5.51$ Capital 23.70$
Trades 2656 Win 60.5% Avg +64.0p Bars 109
AR 1132% PF 1.64 SR 9.62 UI 1% R2 0.00


$500 -> $18M in 7 months
Posted By: Lapsa

Re: Lapsa's very own thread - 12/26/21 10:25

🎉 I'm a Profitable Trader 🎉
Posted By: Grant

Re: Lapsa's very own thread - 12/27/21 19:34

Good to hear this, congratulations! Given all the posted code concepts/prototypes, It's obvious that you've put a lot of effort in this.

I saw that most of your recent performance updates involved the MATICUSDT currency. Is this the only currency you trade in an algo trade fashion?

Also, are you confident enough to increase/optimize your leverage?
Posted By: Lapsa

Re: Lapsa's very own thread - 12/27/21 22:04

Ultimately - any trading system is just 2 big IFs:

Code
if price low?
  then buy
if price high?
  then sell


Mine is no different.

December numbers...

Quote

Trades 334 Win 60.2% Avg +72.7p Bars 101
AR 1181% PF 1.48 SR 9.48 UI 6% R2 0.95


By removing couple rules:

Quote

Trades 385 Win 60.5% Avg +72.0p Bars 89
AR 1563% PF 1.50 SR 10.79 UI 5% R2 0.90


Sadly - hinders overall performance since May too much.
Hits like -500%.

But I have identified them, can tweak numbers, nudge data, think about the system!
Posted By: Lapsa

Re: Lapsa's very own thread - 12/27/21 23:08

Originally Posted by Grant
Good to hear this, congratulations! Given all the posted code concepts/prototypes, It's obvious that you've put a lot of effort in this.

I saw that most of your recent performance updates involved the MATICUSDT currency. Is this the only currency you trade in an algo trade fashion?

Also, are you confident enough to increase/optimize your leverage?


Yes. I don't really believe in universal systems.
Or at least - find them too slow.
Or too hard and confusing to maintain.

Anyhow - requires totally different basis, principles, mental model than what I got.

Was thinking about twin trading another pair but scratched idea.
Somehow I fail to see point in trading multiple assets unless that's a core of your competitive advantage (e.g. triangular trading system or whatever it's called).

---------

When it comes to leverage - systems can flop real fast.

My current money management is a total trash.
(advice? literature suggestions?)

Code
Lots = max(floor_amount, Balance * .75)


Depending on price, guess that's around 2x leverage or something. Maybe not. Who cares.

What's important:
- it has good enough potential to skyrocket ($100 -> $6689891 in 7 months sounds alright)
- it's tested and can survive about 2-3 real shitty weeks and still come back
- it's stupidly simple hence predictable and controllable

Gut feels max lev it *might* survive is about 8x (with a splendid launch)

x15 for degenerates
x20 for actual scalpers? maybe? perhaps?
x69 keif
x100 gambler's choice
x125 blink your eyes and it's gone
Posted By: Grant

Re: Lapsa's very own thread - 12/28/21 13:22

I strongly believe that the portfolio composition (i.e. number of assets and their individual risk profiles) and the leverage are intertwined.

You express confidence in your system (which is good!) by suggesting a reinvestment rate of 75%, but I believe this arbitrary number is probably way too high for a crypto currency (no need to explain their extreme volatilities *wink) in a single asset portfolio.
With your profile (and yes, I've read your 3 pointers as well) I would suggest a conservative approach like the optimalF, or in case you want to go YOLO, the Kelly criterion. There's an excellent paper (page 21) (I love my bookmarks) about the differences between these two.

As for 'universal systems'. In case you mean the exact same set of rules applied to multiple assets, I don't believe in that either. Just like you, I believe in simplicity, but with small variations for each asset.
I see two main advantages in a multi asset portfolio, a more smooth equity curve (and better night sleeps, LOL) and the ability to go a little more aggressive with leverage.

As for pairs trading, I recently saw this interesting keynote on pairs trading, using a Kalman filter as a spread basis. My current project takes too much time, but it was an insightful one.
Posted By: Lapsa

Re: Lapsa's very own thread - 12/28/21 21:55

>but I believe this arbitrary number is probably way too high for a crypto currency

Well...

There definitely is a risk to burn it all down.
It's still a small capital. I would rather risk it.
Ain't my day job, just a hobby.

And I don't think that's actually the case.
I mean - running this for couple months already.

Aim isn't steady income.
Aim is to snowball to absurd numbers.
That requires quite drastic measures.

Somehow disliked optimalF.
I guess there were some certain rationale behind the formula, but to me it felt akin to Fibonacci levels or Elliot waves.
Weird.

Haven't heard of Kelly criterion.
Thanks for hooking me up - literature looks sort of promising.
Should hold something useful.

>but with small variations for each asset

Not quite. I think the biggest gains comes from very asset-specific tweaks.
Base ideas for similar assets do remain same though.
Posted By: Lapsa

Re: Lapsa's very own thread - 12/28/21 22:09

2 red days

quite substantial losses

more useful data

-----

algo surely hates slow and gradual price decline
Posted By: Lapsa

Re: Lapsa's very own thread - 01/07/22 03:32

if server time is out of sync - that introduces interesting shift in price action

(bit weirdly as exchange is supposed to reject out of sync requests or something)

doji candles on backtest becomes a part of previous / next candles on actual performance graph

whole thing becomes a mess and I think is a culprit for the drawdown algo experienced

changed `price()` to `MedPrice()`, backtest results unchanged, synced time

still not a perfect 1:1 to backtests, but at least now I see an actual resemblance

-------

trading business ain't doing well lately
Posted By: Grant

Re: Lapsa's very own thread - 01/07/22 16:47

-IMO- you've picked one of (if not THE) hardest market(s) to trade successfully.
Have you tried your approach (or a similar one) on the regular forex markets?
In my experience, it's already a challenge to be successful in that market, especially on the long haul.
Posted By: Lapsa

Re: Lapsa's very own thread - 01/09/22 15:33

It's around full month of hard work to build something similar for forex.

Bit too much to just "take a look".
Posted By: Lapsa

Re: Lapsa's very own thread - 01/09/22 22:35

Quote

Monte Carlo Analysis... Median AR 1151%
Win 184$ MI 22.06$ DD 4.65$ Capital 21.36$
Trades 2819 Win 60.6% Avg +65.3p Bars 113
AR 1239% PF 1.64 SR 9.58 UI 1% R2 0.00


hopefully next week prints a bit so there's more breathing room

reluctant to feed the beast
Posted By: Lapsa

Re: Lapsa's very own thread - 01/12/22 18:21

Originally Posted by Grant

As for pairs trading, I recently saw this interesting keynote on pairs trading, using a Kalman filter as a spread basis. My current project takes too much time, but it was an insightful one.


tried watching. got bored. learned nothing

will check out wtf is Kalman filter though
Posted By: Grant

Re: Lapsa's very own thread - 01/12/22 22:23

Originally Posted by Lapsa
Originally Posted by Grant

As for pairs trading, I recently saw this interesting keynote on pairs trading, using a Kalman filter as a spread basis. My current project takes too much time, but it was an insightful one.


tried watching. got bored. learned nothing

will check out wtf is Kalman filter though


That Kalman part was the only part I was interested in.
Maybe you've already found it, but there's also a Zorro / R implementation on https://robotwealth.com/kalman-filter-pairs-trading-with-zorro-and-r/
Posted By: Lapsa

Re: Lapsa's very own thread - 01/13/22 12:04

some more creativity

Quote

Monte Carlo Analysis... Median AR 1208%
Win 187$ MI 22.12$ DD 4.38$ Capital 20.74$
Trades 2861 Win 60.6% Avg +65.4p Bars 113
AR 1280% PF 1.64 SR 9.62 UI 1% R2 0.00


I mean - just couple days ago it was 1130%.
thought it would be impossible to squeeze out more

data keeps piling

I will catch that dragon
Posted By: Grant

Re: Lapsa's very own thread - 01/14/22 16:27

Given the number of trades, you have an impressive profit factor and ulser index. Those are the 3 main stats I'm looking for when evaluating a strategy.
Posted By: Lapsa

Re: Lapsa's very own thread - 01/15/22 01:00

actually, I think Ulser Index (and R2) might be borked

Sharpe Ratio definitely was

after Zorro's update - suddenly started working
Posted By: Lapsa

Re: Lapsa's very own thread - 01/15/22 02:16

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
Posted By: Lapsa

Re: Lapsa's very own thread - 01/15/22 13:46

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]
Posted By: Grant

Re: Lapsa's very own thread - 01/15/22 15:00

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.
Posted By: Lapsa

Re: Lapsa's very own thread - 01/15/22 23:04

@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
Posted By: Lapsa

Re: Lapsa's very own thread - 01/15/22 23:08

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
Posted By: Grant

Re: Lapsa's very own thread - 01/16/22 00:25

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.
Posted By: Lapsa

Re: Lapsa's very own thread - 01/16/22 15:42

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?
Posted By: Lapsa

Re: Lapsa's very own thread - 01/16/22 15:47

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
Posted By: Grant

Re: Lapsa's very own thread - 01/16/22 16:52

Can't argue that! Time to get back to the drawing board and look for more consistency.
Posted By: Lapsa

Re: Lapsa's very own thread - 01/18/22 07:30

found out the rule that caused losses in January

it's sitting around -113%

removing it turns into +100%

in overall backtest, that's a drop from ~1260% to ~1157%

tweaking it a bit makes January go to +500% but screws up overall way more

------

what it does is basically gives a green light when volatility increases

but the market in January is stagnating

so what previously meant increase in volatility, nowadays means already peaking

------

no actions taken. give me moar of those losses, please
Posted By: Lapsa

Re: Lapsa's very own thread - 01/19/22 22:07

Quote

Trade foxer MATICUSDT (TICKS), Zorro 2.440

Bar period 1 min (avg 1 min)
Trade period 2022-01-17..2022-01-19
Spread 2.0 pips (roll 0.00/0.00)
Commission -0.10
Contracts per lot 1.0

Gross win/loss 222$-116$, +1821.3p
Average profit 18320$/year, 1527$/month, 70.46$/day
Max drawdown -43.38$ 41.2% (MAE -57.51$ 54.6%)
Max down time 4 hours from Jan 2022
Max open margin 748$
Max open risk 1.17$
Trade volume 27686$ (4812174$/year)
Transaction costs -1.41$ spr, -0.32$ slp, 0$ rol, -27.71$ com
Capital required 878$

Number of trades 22 (3824/year, 74/week, 15/day)
Percent winning 68.2%
Max win/loss 30.12$ / -26.45$
Avg trade profit 4.79$ 82.8p (+255.5p / -287.3p)
Avg trade slippage -0.0145$ -0.3p (+4.7p / -10.8p)
Avg trade bars 129 (+120 / -147)
Max trade bars 565 (9 hours)
Max open trades 1
Max loss streak 2

Annual return 2087%
Profit factor 1.91 (PRR 1.03)
Scholz tax 28 EUR

Portfolio analysis OptF ProF Win/Loss Result

MATICUSDT .1000 1.91 15/7 +105
MATICUSDT:L .1000 0.70 6/5 -31
MATICUSDT:S .1000 10.74 9/2 +136


writing it down before it evaporates
Posted By: Lapsa

Re: Lapsa's very own thread - 01/21/22 05:20

and it's gone

bugcoin goin to zero
Posted By: Lapsa

Re: Lapsa's very own thread - 01/21/22 08:23

every draw down is a chance to improve my algo
Posted By: Lapsa

Re: Lapsa's very own thread - 01/23/22 12:38

bunch of changes

Quote

Monte Carlo Analysis... Median AR 1147%
Win 185$ MI 21.11$ DD 4.31$ Capital 20.42$
Trades 2965 Win 60.7% Avg +62.4p Bars 112
AR 1240% PF 1.60 SR 9.23 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 01/23/22 13:26

and some more

Quote

Monte Carlo Analysis... Median AR 1153%
Win 186$ MI 21.20$ DD 4.31$ Capital 20.42$
Trades 2961 Win 60.7% Avg +62.8p Bars 113
AR 1245% PF 1.60 SR 9.26 UI 1% R2 0.00


now start printing some dough you piece of shit
Posted By: Lapsa

Re: Lapsa's very own thread - 01/23/22 13:49

crypto sheldon said it's going to 200k in January (Elliot waves my ass)

I thought 80k by the end of year is realistic

[Linked Image]

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 01/24/22 12:29

healthy market behavior

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 01/24/22 12:55

losses after losses after losses

yay
Posted By: Lapsa

Re: Lapsa's very own thread - 01/24/22 13:16

all those fib retracements eating dust

inflation through the roof, great war prospects in Europe

now we just need usdt & usdc collapse

WYCKOFFF STRUCTURE!!1111ELEVEN
Posted By: Lapsa

Re: Lapsa's very own thread - 01/24/22 14:17

percents go down, I push them back

Quote

Monte Carlo Analysis... Median AR 1137%
Win 184$ MI 20.90$ DD 4.31$ Capital 20.40$
Trades 3010 Win 60.5% Avg +61.3p Bars 111
AR 1230% PF 1.59 SR 9.14 UI 1% R2 0.00


print some money already...
Posted By: Lapsa

Re: Lapsa's very own thread - 01/24/22 14:36

Quote

Separately, it is worth taking note of the Chart Pattern Elliott Wave indicator.
This indicator compares the price movement with the most common Elliott Wave theory models — impulse and zigzag, and if it finds a match, it displays the best of them on the chart.


tradingview adding new indicators

ironically - Chart Pattern Elliot Wave indicator fails to draw anything
Posted By: Lapsa

Re: Lapsa's very own thread - 01/24/22 23:30

[Linked Image]

some life
Posted By: Lapsa

Re: Lapsa's very own thread - 01/25/22 07:23

Quote

Monte Carlo Analysis... Median AR 1175%
Win 189$ MI 21.31$ DD 4.31$ Capital 20.39$
Trades 2998 Win 60.4% Avg +62.9p Bars 112
AR 1255% PF 1.60 SR 9.32 UI 1% R2 0.00


laptop gets about 1 second delay per day

bit ludicrous

should automate time sync

QLSMA banned, ALMA in, some decycler love for longs, trix stuff spliced per side, some additional lag here and there

and with all the updates - January doesn't look half bad

retrospectively... -_-
Posted By: Lapsa

Re: Lapsa's very own thread - 01/25/22 21:47

[Linked Image]

[Linked Image]

10 / 14 calls

clock out of sync by a second again

hacks here and there

sync per week -> per 7 minutes

let's see how it behaves
Posted By: Lapsa

Re: Lapsa's very own thread - 01/25/22 23:42

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 01/30/22 20:09

clock syncing up nicely (have achieved 0 maintenance)

week in red

whole thing looks kinda pointless
Posted By: Lapsa

Re: Lapsa's very own thread - 01/31/22 10:56

numbehs go down, I push them back

Quote

Monte Carlo Analysis... Median AR 1205%
Win 196$ MI 21.66$ DD 4.31$ Capital 20.29$
Trades 3035 Win 60.4% Avg +64.6p Bars 113
AR 1281% PF 1.62 SR 9.52 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/01/22 08:06

Quote

Monte Carlo Analysis... Median AR 1225%
Win 198$ MI 21.84$ DD 4.31$ Capital 20.27$
Trades 3010 Win 60.3% Avg +65.9p Bars 114
AR 1293% PF 1.63 SR 9.62 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/02/22 01:33

UI and R2 are not broken

works fine when I plug in compounding

on Balance*.25 it's UI 2% and R2 .8

even looks reasonably sane

[Linked Image]

but that's not quite what I'm looking for

I want that snowball

Quote

Monte Carlo Analysis... Median AR 1227%
Win 200$ MI 21.96$ DD 4.31$ Capital 20.26$
Trades 3009 Win 60.3% Avg +66.4p Bars 114
AR 1300% PF 1.63 SR 9.68 UI 1% R2 0.00


pushed even further

9 months of data
Posted By: Grant

Re: Lapsa's very own thread - 02/02/22 11:40

I believe that 25% is a fair rate, which is prob similar to an Optimal F output.
Posted By: Lapsa

Re: Lapsa's very own thread - 02/02/22 15:48

@Grant yeah, got similar thinking. which is why I played around those values

but that's late game. I want that snowball

----------------

looks like markets gonna struggle down further

bunch of fake optimism without an actual rebound

US debt records, Russian drama, SPY falling again

but at least that's a movement!

enough of that 1% channel sideways bullshit
Posted By: Lapsa

Re: Lapsa's very own thread - 02/03/22 08:28

stuff that I dislike:

AC
ADO
ADX
ADXR
Alligator
BOP
CCI
CMO
Coral
DPO
DX
FractalHigh
HMA
MinusDI
NumWhiteBlack
PlusDI
QLSMA
ROC
RSI
SAR
SentimentLW
SentimentG
SIROC
StochRSI
T3
UltOsc
VolatilityC
VolatilityMM
WCLPrice
WillR
WMA
Posted By: Lapsa

Re: Lapsa's very own thread - 02/03/22 09:05

Quote

Monte Carlo Analysis... Median AR 1210%
Win 202$ MI 22.14$ DD 4.31$ Capital 20.24$
Trades 3018 Win 60.5% Avg +67.1p Bars 114
AR 1312% PF 1.64 SR 9.78 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/03/22 20:37

Quote

Monte Carlo Analysis... Median AR 1218%
Win 204$ MI 22.28$ DD 4.31$ Capital 20.24$
Trades 3016 Win 60.5% Avg +67.5p Bars 114
AR 1320% PF 1.65 SR 9.85 UI 1% R2 0.00
Posted By: 1ND1G0

Re: Lapsa's very own thread - 02/04/22 08:59

Out of interest, what is strategy performance like when you backtest with WFO?

While some of the metrics you post look good, I do wonder how robust the logic actually is, and whether you are massively overfitting entry / exit criteria just to generate good number on paper.
Posted By: Lapsa

Re: Lapsa's very own thread - 02/04/22 20:43

man... where do I even start...

WFO ain't some kind of magic bullet

you do realize those numbers are over 9 months period of time, right?

to put it in perspective - January performance shows AR of 64%

yes, I am massively overfitting

that's the whole idea - THE strategy

what you call overfitting - I call strategy development

there are tricks so arcane Mr. Ehler himself would start crying

it's not "just to generate good number on paper" but gradually, over time - filter out good stuff until it starts behaving live

that's all there is - a backtest. somewhat close approximation of what would have happened in past

that is the ONLY weapon you get unless you are into moon phases or insider trading
Posted By: Grant

Re: Lapsa's very own thread - 02/05/22 00:34

I try to understand your thought process, but I don't.

Why would you develop a system, knowing on beforehand that it will clearly over-fit on your in-sample data?
Knowing how your system behaves on out-of-sample data should be key before going live.
Posted By: Lapsa

Re: Lapsa's very own thread - 02/05/22 05:01

because you don't consider that my in-sample data is all the meaningful data there is

my out-of-sample data is tomorrow's failure

what else you want me to test it on?

different asset? generated white noise? Mozart's 40th symphony?

----------

WFO moves the starting point and tries to find best optional parameters

I run it on full history and don't parameterize strategy apart from stuff that controls position size

(although occasionally I do slice it up and analyze particular week or month to gain insight about most conflicting parts)
Posted By: Lapsa

Re: Lapsa's very own thread - 02/05/22 05:31

With `EndDate = 20220202;`

Quote

Monte Carlo Analysis... Median AR 1244%
Win 204$ MI 22.29$ DD 4.31$ Capital 20.25$
Trades 3015 Win 60.5% Avg +67.5p Bars 114
AR 1321% PF 1.65 SR 9.85 UI 1% R2 0.00


Without `EndDate = 20220202;`

Quote

Monte Carlo Analysis... Median AR 1081%
Win 202$ MI 21.89$ DD 5.57$ Capital 22.71$
Trades 3030 Win 60.4% Avg +66.5p Bars 115
AR 1157% PF 1.64 SR 9.70 UI 1% R2 0.00


With `StartDate = 20220201`

Quote

Loss -2.51$ MI -18.11$ DD 2.71$ Capital 19.83$
Trades 43 Win 46.5% Avg -58.4p Bars 109
AR -1096% PF 0.44 SR -16.88 UI 100% R2 0.00
Posted By: 1ND1G0

Re: Lapsa's very own thread - 02/05/22 06:42

Yep, I'm with Grant and don't really understand what your approach is here.

Are you looking for feedback by posting here, or are you just using the forum as a place to dump your notes? I think most of the rest of us just use a document on our local machines for some of the observations you are making.

But each to their own. To clarify - are you live with any of these strategies or do you have a method you are following that is taking you closer to going live with these? It sometimes seems like you are generating metrics just for the sake of generating them, however big numbers are meaningless (at least to most readers here I would suspect) if they are not robust.

Have a read of this (if you haven't done so already): https://financial-hacker.com/build-better-strategies-part-3-the-development-process/ and see if this can help focus the mind.
Posted By: Lapsa

Re: Lapsa's very own thread - 02/05/22 06:59

I welcome feedback, but mostly second

I don't generate them. those are actual backtest results. all of them

meaningless?

monthly income of 34196129$ doesn't spark your interest?

live since October

define robustness!

mine is simple - it's robust if you became filthy rich.
after the fact only

have read all of that blog
Posted By: Lapsa

Re: Lapsa's very own thread - 02/05/22 07:36

[Linked Image]

sure looks bad. but it's useful
Posted By: 1ND1G0

Re: Lapsa's very own thread - 02/05/22 07:43

I'm sure JCL or one of the many other experts here could better define robustness, but I suppose I generally look to see how similar my backtest performance was when compared to forward testing or live trading. This will show how sensitive the indicative results during the backtest are to parameter settings / period of test / market conditions / asset etc...

Are you seeing annualised returns of 1000%+ during live trading in line with some of the recent results you are posting here? Does your win rate / drawdown etc. align with your expectations from the development process?
Posted By: Lapsa

Re: Lapsa's very own thread - 02/05/22 08:10

Quote

but I suppose I generally look to see how similar my backtest performance was when compared to forward testing or live trading


and what do you think I do?

Quote

Are you seeing annualised returns of 1000%+ during live trading in line with some of the recent results you are posting here?


are you from the past?

it's the worst crash since March 2020


[Linked Image]


either way equity curve goes - high linearity is the least likeable attribute of it

yes, they do align. but only because my expectations are sane

Posted By: Lapsa

Re: Lapsa's very own thread - 02/05/22 08:20

Quote

Monte Carlo Analysis... Median AR 1092%
Win 202$ MI 21.91$ DD 5.48$ Capital 22.54$
Trades 3037 Win 60.4% Avg +66.4p Bars 114
AR 1167% PF 1.64 SR 9.72 UI 1% R2 0.00
Posted By: Grant

Re: Lapsa's very own thread - 02/05/22 09:39

Originally Posted by Lapsa
because you don't consider that my in-sample data is all the meaningful data there is

my out-of-sample data is tomorrow's failure

what else you want me to test it on?

different asset? generated white noise? Mozart's 40th symphony?



I will answer that by explaining what I did (without implying to be mr know it all!).

I've picked February & March 2020 as my in-sample period (1M data). Why? Because February had a relative low volatility, but March was sky high. So this short period contained at lot of valuable information. Then I ran a ton of backtests from February 2020 till May 2021, just to see how my models (I use ML, hence 'models') behave in- and out-of-sample. By doing so, you see exactly how easy it is to over-fit a model.

In- and out-of-sample
[Linked Image]

Out-of-sample
[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 02/06/22 11:00

@Grant

I'm missing your point

it feels like you are stating obvious

---------

also - there is a bit of difference when working with machine learning

the idea being - when you over fit ML model,
you can't go back and cherry pick out the good parts out of trained model cause it's gibberish

at the very least - not as easy

---------

about mr know it all

well... excuse my tone - I deliberately try to be dense, direct and open

I think that's just the fastest way to knowledge

you have made me think about things that would otherwise fly by unnoticed, so thanks
Posted By: Grant

Re: Lapsa's very own thread - 02/06/22 12:49

I appreciate that 'tone' sir, so no problem! I find the different approaches on this forum and financial-hacker refreshing to read.

Yes, there's nothing magical about my approach in general, but why would you not out-of-sample test your strategy first on recent historical data, and once it behaves stable, test it on a demo account? By skipping the first part, the uncertainty is even higher and so will be your failure rate, so you're wasting more time in your development process.

As for ML, I'm well aware of the bias-variance tradeoff. I apply techniques like cross-validation and regularisation to control this issue as much as possible, but granted, it's tough, esp with financial market data.
Posted By: Lapsa

Re: Lapsa's very own thread - 02/07/22 06:22

most problematic period of time

conflicting rules identified

curve looks reasonably nice if we throw them out

[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 02/07/22 09:05

numbehs go down, I push them back

Quote

Monte Carlo Analysis... Median AR 1185%
Win 203$ MI 21.91$ DD 4.42$ Capital 20.41$
Trades 3030 Win 60.4% Avg +67.1p Bars 115
AR 1288% PF 1.64 SR 9.52 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/09/22 08:49

finally some green. about 6.5% / day

that's a house in half a year

if things were so simple...
Posted By: Lapsa

Re: Lapsa's very own thread - 02/09/22 09:05

speaking of Kelly Criterion
Posted By: Lapsa

Re: Lapsa's very own thread - 02/09/22 17:12

numbehs go up themselves

Quote

Monte Carlo Analysis... Median AR 1206%
Win 210$ MI 22.47$ DD 4.42$ Capital 20.38$
Trades 3065 Win 60.7% Avg +68.6p Bars 115
AR 1324% PF 1.66 SR 9.77 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/09/22 19:41

woah... marked that channel right when it started at 20:00

[Linked Image]

resistance at high volume short wall built ~15min ago

support at 1h Tenkan
Posted By: Lapsa

Re: Lapsa's very own thread - 02/11/22 00:05

I feel bearish for the weekend - there's gonna be blood

way above MESA

daily gonna re-test Kumo

42k again it is

not that I'm good at predictions

funky week
Posted By: Lapsa

Re: Lapsa's very own thread - 02/11/22 11:48

PF 1.7 has been breached!

Quote

Monte Carlo Analysis... Median AR 1227%
Win 220$ MI 23.42$ DD 4.77$ Capital 21.03$
Trades 2969 Win 60.7% Avg +74.2p Bars 119
AR 1336% PF 1.71 SR 10.20 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/12/22 08:20

Quote

daily gonna re-test Kumo

42k again it is


[Linked Image]
Posted By: Lapsa

Re: Lapsa's very own thread - 02/12/22 14:50

Quote

Monte Carlo Analysis... Median AR 1265%
Win 222$ MI 23.56$ DD 4.74$ Capital 20.96$
Trades 2919 Win 60.3% Avg +76.2p Bars 121
AR 1349% PF 1.72 SR 10.28 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/12/22 20:30

Quote

Monte Carlo Analysis... Median AR 1285%
Win 223$ MI 23.60$ DD 4.37$ Capital 20.23$
Trades 2910 Win 60.2% Avg +76.7p Bars 122
AR 1400% PF 1.72 SR 10.30 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/13/22 03:51

Quote

Monte Carlo Analysis... Median AR 1333%
Win 223$ MI 23.59$ DD 4.27$ Capital 20.03$
Trades 2904 Win 60.2% Avg +76.9p Bars 122
AR 1413% PF 1.73 SR 10.30 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/14/22 10:13

Quote

Monte Carlo Analysis... Median AR 1327%
Win 228$ MI 23.96$ DD 4.27$ Capital 20.01$
Trades 2902 Win 60.2% Avg +78.5p Bars 123
AR 1437% PF 1.75 SR 10.48 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/16/22 14:11

Quote

Don't skip series calls with if statements


sad panda

makes sense though
Posted By: Lapsa

Re: Lapsa's very own thread - 02/16/22 15:38

Quote

Monte Carlo Analysis... Median AR 1370%
Win 231$ MI 24.19$ DD 4.27$ Capital 19.99$
Trades 2898 Win 60.1% Avg +79.8p Bars 123
AR 1452% PF 1.76 SR 10.60 UI 1% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 02/28/22 12:46

Quote

Monte Carlo Analysis... Median AR 1415%
Win 244$ MI 24.48$ DD 4.09$ Capital 19.47$
Trades 3020 Win 60.1% Avg +80.8p Bars 124
AR 1509% PF 1.78 SR 10.85 UI 1% R2 0.03


$100 start roflnumbehs

Quote

Monte Carlo Analysis... Median AR 113%
Win 495459134$ MI 49692053$ DD 112745680$ Capital 661451776$
Trades 3020 Win 60.1% Avg +80.8p Bars 124
AR 90% PF 1.27 SR 2.96 UI 4% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 03/05/22 17:06

Quote

Monte Carlo Analysis... Median AR 1443%
Win 250$ MI 24.64$ DD 4.08$ Capital 19.38$
Trades 2999 Win 60.0% Avg +83.2p Bars 126
AR 1525% PF 1.80 SR 10.97 UI 0% R2 0.09
Posted By: Lapsa

Re: Lapsa's very own thread - 03/07/22 15:03

trading is stupid

slowly giving up
Posted By: Grant

Re: Lapsa's very own thread - 03/07/22 19:02

No. You're a very good coder, but you're also very stubborn in your approach.
Posted By: Lapsa

Re: Lapsa's very own thread - 03/07/22 21:54

cause it makes sense

and thanks for the kind words....
Posted By: Lapsa

Re: Lapsa's very own thread - 03/07/22 21:59

backtest shows .7 billion dollars from $100 in 10 months

yet system ain't profitable
Posted By: Grant

Re: Lapsa's very own thread - 03/07/22 22:15

But that's in-sample (right?), which makes this return completely irrelevant. Why not reserve some history for out-of-sample testing? This will speed up your dev process.
Posted By: Lapsa

Re: Lapsa's very own thread - 03/08/22 06:31

What do you mean by in-sample?

That's the whole history there is. MATIC is around for couple years.
I'm just ignoring the very initial stage when it had no traction at all.

What's the point of keeping out-of-sample history if I'm gonna test it anyway?
Doesn't that sort of make it in-sample too?

I don't get your point.

----

> But that's in-sample (right?)

I didn't fine tune it for a single week and then extrapolated expected returns.
I fine tuned it for the (!) whole meaningful history I got.
And those are the numbers that come up.
Posted By: Grant

Re: Lapsa's very own thread - 03/08/22 13:37

Let's compare strategy development cycles in a nut shell..

Yours: take the full data set (in-sample) for tuning > skip out-of-sample testing > test it right away on live market data > weeks go on and now you realize that it performs poorly (most cases) or you have an unicorn.

The traditional way: take 75-90% from your data for tuning > test it out-of-sample on the rest of your data set > you realize almost right away that it performs poorly (most cases) or you have an unicorn > once you have that unicorn, you run it on live market data for a final test ride (better safe than sorry).

Advantages of the traditional method: you save much time and you can compare out-of-sample results from multiple strategies / tune-settings (very important).

Your strategy has much potential when I look at the in-sample results, but your tuning method leads to over-fitting. That's the main weakness that you need to fix.
Posted By: Lapsa

Re: Lapsa's very own thread - 03/08/22 16:24

Yeah, but you wait a month, test it again and you got your 10-25% out-of-sample data.

I really don't see a benefit.

What if we pick January 2022 as our out-of-sample data?
Why such data should be allowed to trump everything else just because it got ignored while fine-tuning?
Posted By: Grant

Re: Lapsa's very own thread - 03/08/22 16:58

Once your OOS results are good (which is far from easy), you only need another month or so once. Sure, you can skip that second test phase, but that would be foolish.

It's not about 'trump everything', it's about finding out right away how robust your strategy is. In most cases there's over-fitting, so you need to OOS test, adapt, OOS test, adapt, etc. over and over again before your strategy is tradeable.
Posted By: Lapsa

Re: Lapsa's very own thread - 03/08/22 18:12

I just fail to see it.

I mean, I do see some benefit in such approach.
Some rules indeed work only temporarily.

But I also feel it raises bunch of new concerns and uncertainties.

Just wanted to highlight one of them - actually picking OOS data.
No matter what's your approach on picking up robustness measurements - they would be based in OOS data.

I think my biggest problem is with the definition of over-fitting itself.
I don't know how to measure it (!) precisely.

Have seen and made algos that are obviously over-fitted and fail immediately on any different data.

But when it's such heaps of data and thousands of trades - I don't really believe it's that easy to over-fit.
More and more the results legitimizes themselves as The Unicorn.

--------

Btw, on actual performance - you might argue it's not half bad.
Sort of break even-ish month. 1 week was great (dunno, +30% or something) - flattened out by others.

Given the circumstances we currently live in - it's not really that much out of the line.
In 2021 - it shows about 3 flat months in a row. Ulcer's might not like it, but hey - that's the path I chose!

--------

Much of the frustration comes from the fact how hard it actually is to live trade.

You need bravery - sending out bunch of money and putting it on the line isn't exactly that easy.
Foolishness can help too (and backstab you later on).

You need resilience - even after hitting stop loss like 5 times in a row, that may or may not tell anything.

You need patience - those hours go by slowly. Even worse when you get bad gut feel predictions for days / weeks.

And then the stuff automagically happens and you are TOO LATE.
Either it failed or you are left with constant reminders that success ain't given freely and may very well disappear next week.

Ridiculous of me initially thinking that sound alerts are a good idea.
Posted By: Grant

Re: Lapsa's very own thread - 03/08/22 18:47

I can appreciate your honesty. Setting up successful algo trading isn't like just baking a cake laugh

There's no golden standard for robustness/over-fitting (both are -IMO- pretty much the same), so I can only speak for myself.
I look for decent OOS statistics, enough trades (say 50+), combined with a decent PF (say 1.25+).
More precise would be to look at the performance offsets between your in- and out-of-sample stats.

To read it from a different perspective, check this interesting blog article https://quantlane.com/blog/avoid-overfitting-trading-strategies/

Believe me, even with 10 years of data with 1000+ trades you can have over-fitting, so a large in-sample set is not a guarantee for robustness.
This largely depends on the complexity of your approach, the more complex, the higher the likelihood of over-fitting.
Posted By: Lapsa

Re: Lapsa's very own thread - 03/08/22 20:00

sadly - I find that blog article empty.
nicely written, good theory overview, near zero practical value

> enough trades (say 50+)

that's like couple days

to my mind - tells nothing

> not a guarantee for robustness

I don't believe there is any

> This largely depends on the complexity of your approach, the more complex, the higher the likelihood of over-fitting.

already mentioned - think it's much more important when working with machine learning

> Believe me, even with 10 years of data with 1000+ trades you can have over-fitting

I know it's there. just don't think it's that easy to pick it out by delaying tests on some particular data
Posted By: Grant

Re: Lapsa's very own thread - 03/08/22 22:24

Originally Posted by Lapsa
sadly - I find that blog article empty.
nicely written, good theory overview, near zero practical value

It provides basic guidelines. Don't expect effective 'recipes' in this secretive area.

Quote

> enough trades (say 50+)

that's like couple days

to my mind - tells nothing



That's just a number to give an indication, just like reserving 10-25% from your data set for OOS testing.

Quote

> not a guarantee for robustness

I don't believe there is any


True, but I provide you some guidelines to increase the likelihood. Up to you what do with that, it's your broker account.

Quote

> This largely depends on the complexity of your approach, the more complex, the higher the likelihood of over-fitting.

already mentioned - think it's much more important when working with machine learning

> Believe me, even with 10 years of data with 1000+ trades you can have over-fitting

I know it's there. just don't think it's that easy to pick it out by delaying tests on some particular data


Yes, this is esp true with ML, but you can basically over-fit any method. I don't know about the complexity of your approach, but those in-sample stats are way too optimistic.
Posted By: Lapsa

Re: Lapsa's very own thread - 03/09/22 06:02

Originally Posted by Grant

but those in-sample stats are way too optimistic.


well... those are just numbers

my expectations are slightly lower - I expect it to be profitable and that's all
Posted By: Lapsa

Re: Lapsa's very own thread - 03/09/22 09:35

> This largely depends on the complexity of your approach, the more complex, the higher the likelihood of over-fitting.

likelihood - perhaps...

although would like to state that you can have whatever complexity you want as long as the rules work together in symphony
Posted By: Grant

Re: Lapsa's very own thread - 03/09/22 13:13

Originally Posted by Lapsa
[quote=Grant]
my expectations are slightly lower - I expect it to be profitable and that's all


expectations <-> reality

When your actual returns were only slightly lower, then we wouldn't had this conversation.
Sorry, but you need to face the reality, which is that your strategy is over-fitting big time.
Posted By: Lapsa

Re: Lapsa's very own thread - 03/09/22 13:21

yeah whatever
Posted By: Lapsa

Re: Lapsa's very own thread - 03/17/22 11:46

.88 billion $
Posted By: Lapsa

Re: Lapsa's very own thread - 03/17/22 12:34

same data, same configuration, same code

new version

>300 millions of imaginary dollahs gone

[Linked Image]

Quote
Why do I get a different backtest result? Because of updated price histories, updated asset lists, or changes listed below. Find out by comparing both logs.


has to be changes listed below

I mean - perhaps it is more accurate and what not

but surely does reinforce feeling how stupid and pointless whole thing is
Posted By: Lapsa

Re: Lapsa's very own thread - 03/17/22 13:27

Quote

[18455: Sat 21-05-01 02:16] 0.30 +0.18 2/0 (0.834370)
[MATICUSDT::L36084] Reverse 10@0.833370: +0.17 at 02:16:00
[MATICUSDT::S45585] Short 10@0.833369 Risk 0 t at 02:16:00

[18456: Sat 21-05-01 02:17] 0.27 -0.0131 2/1 (0.833850)


Quote

[18455: Sat 21-05-01 02:16] 0.30 +0.18 2/0 (0.834370)
[MATICUSDT::L36084] Reverse 10@0.834370: +0.18 at 02:16:00
[MATICUSDT::S45585] Short 10@0.834370 Risk 0 t at 02:16:00

[18456: Sat 21-05-01 02:17] 0.29 -0.0031 2/1 (0.833850)


well... the algo seems to be working same

so that's the good news

with `Slippage = 0` - results are same and the mystery is solved

probably some cheese got moved with the introduction of `Penalty` parameter

in fact - 2.44 version indeed looks bit more suspicious.
~ price falls from 100 @ minute1 to 50 @ minute2, yet reversal in between happens at price 25.
surely realistic and possible yet unknown how Zorro comes up with that

anyhow - should read that help file a bit more
Posted By: Lapsa

Re: Lapsa's very own thread - 03/29/22 06:23

finally some life in markets
Posted By: Lapsa

Re: Lapsa's very own thread - 03/30/22 14:50

my friend bought a hunting rifle, I bought a Zorro license

I like MFI

at least for a quick glance on how volume affects the price

Code
function MFI(var Period, var High, var Low, var Close, var Volume) {
	vars vol = series(Volume);	
	vars hlc = series((High + Low + Close) / 3);	
	var pos=.0;
	var neg=.0;
	var i = 0;
	for(i=0;i<Period;i++) {
		if (hlc[i] > hlc[i+1]) pos = pos + vol[i];
		if (hlc[i] < hlc[i+1]) neg = neg + vol[i];
	}
	var mfr = pos / neg;		
	var mfi = 0;
	if (1+mfr != 0) mfi = 100 - 100 / (1 + mfr);	
	return mfi;
}
Posted By: Grant

Re: Lapsa's very own thread - 03/30/22 17:54

You actually bought a special sword with potential superpowers, a great investment.
Posted By: Lapsa

Re: Lapsa's very own thread - 04/02/22 20:55

green week (ain't over yet...)
~15% capital gains

Quote

Monte Carlo Analysis... Median AR 1445%
Win 257$ MI 23.18$ DD 3.91$ Capital 18.76$
Trades 3216 Win 60.5% Avg +79.8p Bars 128
AR 1483% PF 1.81 SR 10.73 UI 0% R2 0.15


some more crap:

Code
function CMF(var Period, var High, var Low, var Close, var Volume) {
	var ad = ((2*Close-Low-High)/(High-Low))*Volume;
	return Sum(series(ad), Period) / Sum(series(Volume), Period)*100;
}

function VPT(var Volume, vars Close) {
	vars vpt = series(0, 2);
	vpt[0] = vpt[1] + Volume * ((Close[0] - Close[1])/Close[1]);
	return vpt[0];
}

function EOM(var Length, vars High, vars Low, var Volume) {
	var div = 10000000000; // improvised :D
	var eom = SMA(
		series(
			div * (
				(High[0]+Low[0])/2 - (High[1]+Low[1])/2
			) * (High[0] - Low[0]) / Volume
		),	Length
	);
	return eom*1000; // also improvised
}


aka Chaikin's money flow, volume price trend (or something) and ease of movement
Posted By: Lapsa

Re: Lapsa's very own thread - 04/04/22 00:40

re-reading a bit

Originally Posted by Lapsa
smooth price close on 6 periods

pull out 3 period long RSIS out of it

do nothing unless rsis[0] != rsis[1]

boom! 172% -> 453%

makes no sense whatsoever


Code
vars smoothed = series(Smooth(series(Close), 6));
vars smoothRSIS = series(RSIS(smoothed, 3));
if (smoothRSIS[0] == smoothRSIS[1]) return;


as usual, Andrew is correct

1478% -> 704%

at the very least - trick's applicability ain't general whatsoever

although I don't remember what made me drop the idea
Posted By: Lapsa

Re: Lapsa's very own thread - 04/05/22 15:15

Quote

Monte Carlo Analysis... Median AR 1468%
Win 262$ MI 23.47$ DD 3.90$ Capital 18.70$
Trades 3166 Win 60.6% Avg +82.7p Bars 131
AR 1506% PF 1.84 SR 10.90 UI 0% R2 0.18


Code
function VO(int ShortPeriod, int LongPeriod, vars VolumeSeries) {
	var s = EMA(VolumeSeries, ShortPeriod);
	var l = EMA(VolumeSeries, LongPeriod);
	return ((s - l) / l) * 100;
}
Posted By: Lapsa

Re: Lapsa's very own thread - 04/06/22 04:31

Quote

Monte Carlo Analysis... Median AR 1479%
Win 265$ MI 23.70$ DD 3.90$ Capital 18.70$
Trades 3124 Win 60.7% Avg +84.8p Bars 133
AR 1521% PF 1.86 SR 11.02 UI 0% R2 0.18


Code
function ACDI(var Close, var High, var Low, var Volume){
	vars ad = series(0, 2);
	var clv = ((Close - Low) - (High - Close)) / (High - Low);
	var cmfv = clv * Volume;
	ad[0] = ad[1] + cmfv;
	return ad[0];
}


accumulation / distribution
Posted By: Lapsa

Re: Lapsa's very own thread - 04/08/22 20:46

Code
function KVO(var High, var Low, var Close, var Volume){
	vars hlc = series((High + Low + Close) / 3);	
	vars cumVol = series(0, 2);
	cumVol[0] = cumVol[1] + Volume;
	var hlcChange = hlc[0] - hlc[1];
	var sv = 0;
	if (hlcChange >= 0) sv = Volume;
	else sv = -Volume;
	
	var kvo = EMA(sv, 34) - EMA(sv, 55);
	//var sig = EMA(kvo, 13);
	return kvo;
}


Klinger's volume oscillator
Posted By: Lapsa

Re: Lapsa's very own thread - 04/09/22 20:06

week in profits, red Wednesday

something something 5-10% capital gains or whatnot
Posted By: Lapsa

Re: Lapsa's very own thread - 04/11/22 15:19

sure, why not...

Quote

Number of trades 11 (4659/year, 90/week, 18/day)
Percent winning 72.7%
Annual return 2788%
Profit factor 4.32 (PRR 1.77)


gonna lose it tomorrow anyway

perhaps faster
Posted By: Lapsa

Re: Lapsa's very own thread - 04/14/22 00:08

Quote

Monte Carlo Analysis... Median AR 1492%
Win 270$ MI 23.58$ DD 3.90$ Capital 18.62$
Trades 3128 Win 61.0% Avg +86.2p Bars 137
AR 1520% PF 1.87 SR 11.03 UI 0% R2 0.19


Code
function EFI(int Period, var Close, var Volume) {
  vars CloseSeries = series(Close);
  var change = CloseSeries[0] - CloseSeries[1];
  var efi = EMA(change * Volume, Period);
  return efi;
}


Elder's force index
Posted By: Lapsa

Re: Lapsa's very own thread - 04/14/22 09:25

Quote

Monte Carlo Analysis... Median AR 1509%
Win 272$ MI 23.78$ DD 3.90$ Capital 18.62$
Trades 3126 Win 61.1% Avg +87.0p Bars 138
AR 1533% PF 1.88 SR 11.12 UI 0% R2 0.22


Code
// default Length = 20, FilterLength = 48
function EhlersStochMESA(int Length, var* Price, int FilterLength){	
	var pi = 2 * asin(1);
	var* HP = series(HighPass2(Price, FilterLength));
	var a1 = exp(-1.414 * 3.14159 / 10);
	var b1 = 2 * a1 * cos(1.414 * pi / 10);
	var c2 = b1;
	var c3 = -a1 * a1;
	var c1 = 1 - c2 - c3;
	
	var* Filt = series(0);
	Filt[0] = c1 * (HP[0] + HP[1]) / 2 + c2 * Filt[1] + c3 * Filt[2];
	var HighestC = Filt[0];
	var LowestC = Filt[0];

	var i;
	for(i = 0; i < Length-1; i++) {
		if (Filt[i] > HighestC) HighestC = Filt[i];
		if (Filt[i] < LowestC) LowestC = Filt[i];
	}

	var* Stoc = series(0);
	
	if ((HighestC - LowestC) != 0) {
		Stoc[0] = (Filt[0] - LowestC) / (HighestC - LowestC);
	}
	
	var* MESAStochastic = series(0);
	MESAStochastic[0] = c1 * (Stoc[0] + Stoc[1]) / 2 + c2 * MESAStochastic[1] + c3 * MESAStochastic[2];
	
	return MESAStochastic[0]*100;
}


Ehler's MESA Stoch
Posted By: Lapsa

Re: Lapsa's very own thread - 04/15/22 17:11

fuck trading
Posted By: Grant

Re: Lapsa's very own thread - 04/15/22 21:34

Don't give up, you have plenty of good ideas.
Posted By: Lapsa

Re: Lapsa's very own thread - 04/16/22 09:15

Quote

Max loss streak 9


same as on backtest for almost a year

ridiculously stupid price action this week

goes nowhere, just hunts the stop losses
Posted By: Lapsa

Re: Lapsa's very own thread - 04/16/22 10:06

well... there's one obvious low hanging fruit

Zorro occasionally becomes unresponsive for causes unknown
(e.g. for 10-20 minutes per day once or twice)

turned on full blown logging
Posted By: Lapsa

Re: Lapsa's very own thread - 04/16/22 16:31

Max loss streak 11
Posted By: Lapsa

Re: Lapsa's very own thread - 04/16/22 16:36

[Linked Image]

Quote
Account
BrokerAccount:
HTTP: https://fapi.binance.com/fapi/v2/balance?recvWindow=10000000&timestamp=1650126319685&signature=yadayada,(null),X-MBX-APIKEY: yadayada: 1 481.444809 ms
2022-04-16 16:25:20 1.37010
Messages
UTC 44667.68426 (04-16 16:25:20)


1481 / 60 = 24.6 (minutes I think)

TODO:
decrease recvWindow to 3000 or something
Posted By: Lapsa

Re: Lapsa's very own thread - 04/16/22 17:20

easier said than done. might end up asking support if that's even possible

but first - checking out mioxtw`s plugin
(same algo but w/ trade enters commented out)

at least it recognizes SET_DIAGNOSTICS setting (sort of?)
Posted By: Lapsa

Re: Lapsa's very own thread - 04/16/22 17:49

nope... it doesn't update balance. I need that
Posted By: Lapsa

Re: Lapsa's very own thread - 04/16/22 18:06

kay... original plugin + `brokerCommand(SET_DELAY, 150)`

lets see how that one goes
Posted By: Lapsa

Re: Lapsa's very own thread - 04/16/22 21:54

fail analysis.... that's really just 1.5 seconds

I don't know what's going on....

now it went 3-4 hours smooth

again "Not responding" yet logs seem fine
Posted By: Lapsa

Re: Lapsa's very own thread - 04/17/22 13:01

Quote

!Re-launching socket (scheduled)...
HTTP: https://fapi.binance.com/fapi/v1/exchangeInfo,(null),(null)
HTTP: https://fapi.binance.com/fapi/v1/listenKey?recvWindow=10000000&timestamp=1650199698388&signature=REDACTED,#POST,X-MBX-APIKEY: REDACTED
!Connecting to websocket...
!Websocket connected.
!Restoring subscriptions...
!Done.: 2022-04-17 12:11:47: 2 2193417.381810 ms
UpdatePrices
BrokerAsset MATICUSDT 0 => 1 (1.3759 0.138775 ms) 5
HandleTrades
Handle: 26610020 2
BrokerTrade 2: -999997 0.006247 ms (0.0000 0.0000 0.0000 => $0.00) limits stop tick - ok
TradeValue
Account
BrokerAccount:
HTTP: https://fapi.binance.com/fapi/v2/balance?recvWindow=10000000&timestamp=1650199700838&signature=REDACTED,(null),X-MBX-APIKEY: REDACTED: 1 487.828441 ms
2022-04-17 12:11:47 1.37330
Messages
UTC 44668.53358 (04-17 12:48:22)

BrokerTime: 2022-04-17 12:48:22: 2 3.728173 ms
Server 44668.53358 current 44668.53358 next 44668.50833 bar 0
BrokerAsset MATICUSDT 0 => 1 (1.3760 0.144129 ms)
Gaps - ok
Msg: [§s§s§s§s]
Msg: §s §s §i/§i
Msg: §s/§s\§s/§s
Msg: -§s


37 minutes here and there - sure not gonna affect anything, right?
Posted By: Lapsa

Re: Lapsa's very own thread - 04/24/22 09:37

Quote

Monte Carlo Analysis... Median AR 1514%
Win 279$ MI 23.72$ DD 3.90$ Capital 18.52$
Trades 3181 Win 60.7% Avg +87.8p Bars 138
AR 1537% PF 1.90 SR 11.24 UI 0% R2 0.20
Posted By: Lapsa

Re: Lapsa's very own thread - 04/24/22 21:23

Quote

Monte Carlo Analysis... Median AR 1528%
Win 281$ MI 23.84$ DD 3.90$ Capital 18.52$
Trades 3191 Win 60.8% Avg +88.0p Bars 138
AR 1545% PF 1.90 SR 11.28 UI 0% R2 0.20
Posted By: Lapsa

Re: Lapsa's very own thread - 04/30/22 19:46

Quote

Monte Carlo Analysis... Median AR 1520%
Win 286$ MI 23.92$ DD 3.90$ Capital 18.46$
Trades 3207 Win 61.0% Avg +89.3p Bars 139
AR 1555% PF 1.92 SR 11.45 UI 0% R2 0.24
Posted By: Lapsa

Re: Lapsa's very own thread - 05/08/22 21:41

fuck trading

beyond stupid and lame
Posted By: Lapsa

Re: Lapsa's very own thread - 05/14/22 22:51

Code
// Ehlers Leading
// alpha1 .25
// alpha2 .33
// src hl2
float ELI(var alpha1, var alpha2, vars src) {
	vars lead = series(.0);
	lead[0] = 2 * src[0] + (alpha1 - 2) * src[1] + (1 - alpha1) * lead[1];
	
	vars leadingIndicator = series(.0);
	leadingIndicator[0] = 
		alpha2 * lead[0] + 
		(1 - alpha2) * leadingIndicator[1];
	
	return leadingIndicator[0];
}
Posted By: Lapsa

Re: Lapsa's very own thread - 05/14/22 22:59

https://stackoverflow.com/questions/4584349/returning-a-float-type-from-function-in-c
Posted By: Lapsa

Re: Lapsa's very own thread - 06/07/22 11:47

quick & dirty (don't judge) status in tab title

Code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Zorro Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="30">
<link href="zorro.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script>
$(document).ready(function(){
  document.title = $("body").text().split("System State:  ")[1].split("\n")[0];
})
</script>
</head>
<body>
<br>
<table border="0">
  <tr>
    <td><strong>Trade</strong></td>
    <td><strong>ID</strong></td>
    <td><strong>Lots</strong></td>
    <td><strong>Entry Time</strong></td>
    <td><strong>Entry</strong></td>
    <td><strong>Price</strong></td>
    <td><strong>Stop</strong></td>
    <td><strong>Trail</strong></td>
    <td><strong>Target</strong></td>
    <td><strong>Risk</strong></td>
    <td><strong>Profit</strong></td>
    <td><strong>Pips</strong></td>
  </tr>
</table>
</body>
</html>
Posted By: Lapsa

Re: Lapsa's very own thread - 08/02/22 21:26

Code
// default Dampen = .5
float LaguerreRSI(var Dampen, var Close){
	vars L0 = series(0);
	vars L1 = series(0);
	vars L2 = series(0);
	vars L3 = series(0);
	vars CU = series(0);
	vars CD = series(0);
	var rsi = 0;

	L0[0]=(1-Dampen)*Close+Dampen*L0[1];
	L1[0]=-Dampen*L0[0]+L0[1]+Dampen*L1[1];
	L2[0]=-Dampen*L1[0]+L1[1]+Dampen*L2[1];
	L3[0]=-Dampen*L2[0]+L2[1]+Dampen*L3[1];
	CU[0]=0; CD[0]=0;

	if (L0[0]>L1[0]) {
		CU[0]=L0[0]-L1[0];
	}else{
		CD[0]=L1[0]-L0[0];
	}

	if (L1[0]>L2[0]) {
		CU[0]=CU[0]+L1[0]-L2[0];
	}else{
		CD[0]=CD[0]+L2[0]-L1[0];
	}

	if (L2[0]>L3[0]) {
		CU[0]=CU[0]+L2[0]-L3[0];
	}else{
		CD[0]=CD[0]+L3[0]-L2[0];
	}

	if (CU[0]+CD[0]>0||CU[0]+CD[0]<0) {
		rsi=CU[0]/(CU[0]+CD[0]);
	}

	return rsi;
}
Posted By: Lapsa

Re: Lapsa's very own thread - 08/04/22 13:46

Code
#include <rad_trig.c>

float CycleMeasure(vars Price){
	var Imult = .635;
	var Qmult = .338;
	vars InPhase = series(0);
	vars Quadrature = series(0);
	vars Phase = series(0);
	vars DeltaPhase = series(0);
	vars InstPeriod = series(0);
	vars Period = series(0);
	vars Value3 = series(0);


	if (Bar > 5) {
		Value3[0] = Price[0] - Price[7]; // 7 ?
		InPhase[0] = 1.25*(Value3[4] - Imult*Value3[2]) + Imult*InPhase[3];
		Quadrature[0] = Value3[2] - Qmult*Value3[0] + Qmult*Quadrature[2];

		if (abs(InPhase[0]+InPhase[1]) > 0){
			Phase[0] = ratan(
				abs(
					(Quadrature[0]+Quadrature[1]) / 
					(InPhase[0]+InPhase[1])
				)
			);
		}

		if (InPhase[0] < 0 && Quadrature[0] > 0) {
			Phase[0] = 180 - Phase[0];
		}

		if (InPhase[0] < 0 && Quadrature[0] < 0) {
			Phase[0] = 180 + Phase[0];
		}

		if (InPhase[0] > 0 && Quadrature[0] < 0) {
			Phase[0] = 360 - Phase[0];
		}

		DeltaPhase[0] = Phase[1] - Phase[0];

		if (Phase[1] < 90 && Phase[0] > 270) {
			DeltaPhase[0] = 360 + Phase[1] - Phase[0];
		}

		if (DeltaPhase[0] < 1) {
			DeltaPhase[0] = 1;
		}

		if (DeltaPhase[0] > 60) {
			DeltaPhase[0] = 60;
		}

		InstPeriod[0] = 0;
		var Value4 = 0;

		int count = 0;
		for (count = 0; count < 50; count++) {
			Value4 = Value4 + DeltaPhase[count];
			if (Value4 > 360 && InstPeriod[0] == 0) {
				InstPeriod[0] = count;
			}
		}
	}

	if (InstPeriod[0] == 0) {
		InstPeriod[0] = InstPeriod[1];
	}

	Period[0] = .25*(InstPeriod[0]) + .75*Period[1];
	return Period[0];
}
Posted By: kwyx

Re: Lapsa's very own thread - 08/15/22 04:54

So did you take it live eventually?
Posted By: Lapsa

Re: Lapsa's very own thread - 08/23/22 15:16

yes. and lost money
Posted By: anissyo

Re: Lapsa's very own thread - 08/24/22 12:08

Hello Lapsa I just want to know ONE thing, are you making money if you are not I will stop all of this right now and just live unmotivated and wait for my death LOL
Posted By: Lapsa

Re: Lapsa's very own thread - 08/29/22 08:42

no, I am not making money. cannot recommend trading

but...

for the most part algo is capable of breaking even,
losses have been somewhat irrelevant

algo gets improved

and there's still an enormous potential

------------

"I'm gonna make fat stacks of money with this" is a wrong mindset. it's quite likely you won't. at least not fast, without failing

"I wonder what if..." is the correct one

[Linked Image]
Posted By: anissyo

Re: Lapsa's very own thread - 08/30/22 19:22

Nice thanks for the explanation, I think the same way about trading it's all about trying/falling then trying again, forgive my indiscretion but how much time have you spent researching to reach this stage ??
Posted By: anissyo

Re: Lapsa's very own thread - 08/30/22 19:27

is it true that btcusdt is free on Binance ?? absolutely no fees except that 0.01 spread? it should be great news for you as a crypto trader I believe, in the past I come up very quickly with some solid strategies when used on 1-minute charts with 0 spread on eurusd, It should be the same in the BTC pairs if not easier, I will research that very soon, but can you confirm that 0% commission fee is still valid on Binance when trading BTC / stablecoins pairs?

On the website they say it's the case but there is some weird stuff that pushes me to believe that the post is outdated and not yet removed like for example there is another post where they say that makers can make 0.01% on any given trade without any capital requirement when trading all busd futures (it's just unbelievable) because if the comission is negative (meaning I will receive money when making the market) I will just put some orders in the delta neutral way and collect that 0.01% each time, and using max leverage each time, it's just toooooo easy to be true but again can you confirm ?^^
Posted By: alun

Re: Lapsa's very own thread - 08/31/22 08:31

Hey Lapsa,

I'm just wondering if you tried to trade with one of the Z strategies?

I can suggest you looking at ETF buy/hold/go-in-cash type of strategies also known as TAA (tactical assets allocation)

One of such strategies in Zorro - Z9: Long-term momentum based sector ETF portfolio rotation.

Another one I have manually tested and use for the last year live (and it works quite well) is called Stoken ACA

Here is my own backtest (made in Python, not Zorro) - https://katlex.com/stoken/ - you can find a link there with in detail strategy description.

Results: 12.5 CAGR, 20% max drawdown for the last 14 years - I failed to find more history since I'm testing on ETFs.
This is trading without leverage.

Also here is an article to learn more: https://alf.katlex.com/blog/why-tactical-asset-allocation

I hope this could at least give you hope that algo trading or quantitative investing could be profitable over a long run.

You only need -
1) realistic goals
2) large enough capital
3) carefully back testes strategy
4) patience and time
Posted By: Lapsa

Re: Lapsa's very own thread - 08/31/22 10:57

Quote
how much time have you spent researching to reach this stage ??


hard to say

not enough by the looks

Quote
is it true that btcusdt is free on Binance ??


that's on spot only. I'm on futures

it's more like ~.1% for open+close

Quote
but again can you confirm ?^^


errr.... probably not? did experiment with maker orders, could drive down fees to .04% for open+close

too unreliable

but that's not the free money recipe you suggest

Quote
tried to trade with one of the Z strategies?


nope. somewhat uninterested as it's closed source

Quote
Results: 12.5 CAGR ....
This is trading without leverage.


my backtest shows $100->$3M a ~year
CAGR 222581%

so what...
Posted By: alun

Re: Lapsa's very own thread - 08/31/22 14:33

Quote


my backtest shows $100->$3M a ~year
CAGR 222581%

so what...


considering you're saying "no, I am not making money. cannot recommend trading" and "fuck trading" many times - that is just the curve fitting that you're doing.

the main difference with the strategy I mentioned - it is real - my backtest for the last year 100% matches live trading results on real money for the same period.

but sounds like you didn't ask for an advise, and keep following your own way, which is great, so I disappear laugh

Posted By: anissyo

Re: Lapsa's very own thread - 08/31/22 16:40

ah, nice, but even if it's spot only I still think that with the volatility I think there is some potential if it's free especially and if the bid/ask difference is as tight as I remember, 0.01 to 0.02 spread.

By the way, btc/usdt Spot trading means No leverage and No shorting, right?

thanks for the valuable feedback.
Posted By: anissyo

Re: Lapsa's very own thread - 08/31/22 16:57

Alun, check your private messages bro
Posted By: Lapsa

Re: Lapsa's very own thread - 09/01/22 06:02

Quote
By the way, btc/usdt Spot trading means No leverage and No shorting, right?


true

Quote

considering you're saying "no, I am not making money. cannot recommend trading" and "fuck trading" many times - that is just the curve fitting that you're doing.

the main difference with the strategy I mentioned - it is real - my backtest for the last year 100% matches live trading results on real money for the same period.


lol
Posted By: Lapsa

Re: Lapsa's very own thread - 01/06/23 14:45

Quote

Monte Carlo Analysis... Median AR 1551%
Win 34.40$ MI 1.70$ DD 0.76$ Capital 1.30$
Trades 3641 Win 63.0% Avg +94.5p Bars 242
AR 1575% PF 2.26 SR 9.29 UI 0% R2 0.00
Posted By: Lapsa

Re: Lapsa's very own thread - 04/03/23 21:34

porn

[Linked Image]
Posted By: rki

Re: Lapsa's very own thread - 04/10/23 11:44

Anyone has the C code for BandPass Filter
Posted By: Lapsa

Re: Lapsa's very own thread - 04/29/23 22:45

Originally Posted by rki
Anyone has the C code for BandPass Filter


yes
Posted By: Lapsa

Re: Lapsa's very own thread - 09/10/23 19:38

tools are wrong, reliant on "crypto timings", will fail live

but the idea of dominant period crossovers yields surprising amount of signals

think it's a viable option for an algorithm chassis if done right

and feels stop loss friendly

Code
function main()
{
	set(PRELOAD|PLOTNOW);
	setf(PlotMode,PL_ALL+PL_FINE+PL_ALLTRADES+PL_BENCHMARK);
	MonteCarlo = 0;
	BarPeriod = 1;
	PlotPeriod = 1;
	Outlier = 0;
	BarMode = BR_FLAT;
	StartDate = ?;
}

function run()
{
	vars s_p = series(price());
	vars s_c = series(priceC());
	var dp = DominantPeriod(s_p, 50);
	var dp_s = EMA(series(dp), 50);
	vars s_dp_s = series(dp_s);
	var dp_l = EMA(series(dp), 100);
	vars s_dp_l = series(dp_l);
	var dp_d = EMA(series(dp), 1440);
	var mmi = MMI(s_p, 50);
	vars s_mmi = series(mmi);
	
	if(
		dp_s > dp_d
		&& crossOver(s_dp_s, s_dp_l)
		&& falling(s_mmi)
	) {
		enterLong();
	} 

	if	(
		dp_s < dp_d
		&& crossUnder(s_dp_s, s_dp_l)
		&& falling(s_mmi)
	) {
		enterShort();
	}
	
	plot("s", dp_s, NEW , SILVER);
	plot("l", dp_l, LINE , GREY);
	plot("d", dp_d, LINE, GREY);
	plot("mmi", mmi, NEW, BLACK);
}
Posted By: M_D

Re: Lapsa's very own thread - 09/26/23 15:47

Hi Lapsa,

I´m (still) a beginner Zorro user (since 2016 crazy ) have stumbled over your very own thread, have read it all and enjoyed all your posts. Even learned two or more lessons. Thanks for that.
Currently was curious about some of your replicatet indicators, in this case EvenBetterSineWave.
Experimented a little with it. Portfolio (from zorro manual) and Timeframe loops (from financial-hacker. i used 5, 15, 30, 60, 240).
Since my history data is not up to date, i used mid to end 2021 for training parameters (only 1 parameter: var Duration of your EBSW, start from 100 up to 300) and generating Factors to the assets. With my "average" Laptop (8GB RAM) it took about 2 hours to train half a year with 33 Assets x 5 Timeframes x 13 Parameter Steps = 2145 loops.
Testrun after training was of course overwhelming. OptimalF picked the positive perfomers and generatet beauuuuutiful backtest results.


The modified script:
Code
//Zorro Version 2.40
//Lapsa´s EvenBetterSineWave used with Portfolio and Timeframe Loops

#include <profile.c>
#include <legacy.h>

var EvenBetterSinewave(vars Close, var Duration)
{
	var Wave;
	var Pwr;
		
	var* HP = series(HighPass1(Close, Duration), 2);
	if (HP[0] == 0) HP[0] = 1;
	
	var* Filt = series(Smooth(HP, Duration), 3);	
	Wave = SMA(Filt, 3);
	Pwr = (Filt[0]*Filt[0] + Filt[1]*Filt[1] + Filt[2]*Filt[2]) / 3;
	
	return Wave / sqrt(Pwr);
}

function EBSW_Strategy()
{
	vars close = series(priceClose());
	var* ebsw = series(EvenBetterSinewave(close,optimize(200,100,300))); //225 original value
	
	if (crossOver(ebsw, -.99)) enterLong();	
	if (crossUnder(ebsw, .99)) enterShort();

	plot("EBSW", ebsw, NEW, BLACK);
}

function main()
{
	set(PRELOAD|LOGFILE|PARAMETERS|FACTORS|TESTNOW|PLOTNOW); 
	
	BarPeriod = 1;
	StartDate = 20210601;
	EndDate = 20211230;
	
	Capital = 2000;
}

function run()
{
	
	LookBack = 4*250;
	
	
	// portfolio loop
	while(asset(loop(
	"AUD/CAD","AUD/CHF","AUD/JPY","AUD/NZD","AUD/USD",
	"CAD/CHF","CAD/JPY","CHF/JPY",
	"EUR/AUD","EUR/CAD","EUR/CHF","EUR/GBP","EUR/JPY","EUR/NZD","EUR/USD",
	"GBP/AUD","GBP/CAD","GBP/CHF","GBP/JPY","GBP/NZD","GBP/USD",
	"NZD/CAD","NZD/CHF","NZD/JPY","NZD/USD",
	"USD/CAD","USD/CHF","USD/JPY",
	"XAU/USD",
	"GER30","US30","NAS100","SPX500"
	)))
	//TimeFrame Loop
	while(algo(loop("5","15","30","60","240")))
	{
	//only 1 trade per asset and per algo allowed
	MaxLong = MaxShort = -1;
	//since many assets, had to reduce optimalf, otherwise margin call
	Margin = 0.06125 * OptimalF * Capital * sqrt(1 + ProfitClosed/Capital); 
	
	if(Algo == "5"){
		TimeFrame = 5;
	EBSW_Strategy();}
	
	else if(Algo == "15"){
		TimeFrame = 15;
	EBSW_Strategy();}
	
	else if(Algo == "30"){
		TimeFrame = 30;
	EBSW_Strategy();}
	
	else if(Algo == "60"){
		TimeFrame = 60;
	EBSW_Strategy();}
	
	else if(Algo == "240"){
		TimeFrame = 240;
	EBSW_Strategy();}
	
	
	}
}



I added the generated .par and .fac files. (.par was not allowed to upload, so just renamed to .txt, you have to rename it back to .par). In case someone wants to test same conditions, i also added my AssetsFix.csv, which represents my brokers conditions (Roboforex, meanwhile outdated).
Price History is from Zorro website.

Test Results from TRAINED period (No WFO Cycles, no Whites Reality Check, no exit strategy, no whatever):


[Linked Image]
Quote

Test 0_Lapsa_EvenBetterSineWave , Zorro 2.409

Simulated account AssetsFix
Bar period 1 min (avg 1 min)
Total processed 318041 bars
Test period 2021-06-01..2021-12-30 (212776 bars)
Lookback period 1000 bars (23 hours)
Montecarlo cycles 200
Simulation mode Realistic (slippage 5.0 sec)
Capital invested 2000$

Gross win/loss 62512$-28578$, +202900.7p, lr 36922$
Average profit 58189$/year, 4849$/month, 224$/day
Max drawdown -2838$ 8.4% (MAE -9772$ 28.8%)
Total down time 2% (TAE 99%)
Max down time 5 days from Dec 2021
Max open margin 981$
Max open risk 5348$
Trade volume 19016966$ (32610185$/year)
Transaction costs -2276$ spr, -13.60$ slp, -634$ rol, -105$ com
Capital required 413$

Number of trades 7727 (13251/year, 255/week, 53/day)
Percent winning 37.8%
Max win/loss 3438$ / -104$
Avg trade profit 4.39$ 26.3p (+127.9p / -35.6p)
Avg trade slippage -0.0018$ -0.0p (+2.2p / -1.3p)
Avg trade bars 2695 (+4701 / -1475)
Max trade bars 97358 (19 weeks)
Time in market 9789%
Max open trades 101
Max loss streak 33 (uncorrelated 20)

Annual growth rate 14063.20%
Profit factor 2.19 (PRR 2.12)
Sharpe ratio 3.96 (Sortino 4.12)
R2 coefficient 0.932
Ulcer index 7.4%
Scholz tax 13850 EUR

Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Total
2021 137 59 101 38 35 28 2 +1749

Portfolio analysis OptF ProF Win/Loss Wgt%

AUD/CAD avg ---- 2.69 38/46 2.1
AUD/CHF avg ---- 1.80 57/81 3.2
AUD/JPY avg ---- 2.47 153/225 8.9
AUD/NZD avg ---- 1.86 40/35 1.3
AUD/USD avg ---- 3.28 202/292 8.0
CAD/CHF avg ---- 1.03 64/128 0.0
CAD/JPY avg ---- 1.58 170/290 3.6
CHF/JPY avg ---- 3.67 43/86 2.8
EUR/AUD avg ---- 1.61 66/80 2.1
EUR/CAD avg ---- 1.20 85/114 0.4
EUR/CHF avg ---- 1.07 191/320 0.3
EUR/GBP avg ---- 1.10 54/74 0.1
EUR/JPY avg ---- 1.94 35/43 1.2
EUR/NZD avg ---- 1.29 62/105 0.6
EUR/USD avg ---- 24.59 32/139 19.3
GBP/AUD avg ---- 1.65 67/94 1.8
GBP/CAD avg ---- 0.99 15/21 -0.0
GBP/CHF avg ---- 1.28 13/19 0.2
GBP/JPY avg ---- 1.33 169/290 1.7
GBP/NZD avg ---- 1.91 11/15 0.6
GBP/USD avg ---- 1.81 194/312 2.2
GER30 avg ---- 1.03 89/175 0.0
NAS100 avg ---- 1.43 177/282 1.4
NZD/CAD avg ---- 1.35 73/100 0.8
NZD/CHF avg ---- 1.39 80/98 1.1
NZD/JPY avg ---- 1.49 162/267 2.8
NZD/USD avg ---- 1.88 50/74 1.1
SPX500 avg ---- ---- 0/0 0.0
US30 avg ---- 5.41 129/209 29.8
USD/CAD avg ---- 1.26 163/268 1.0
USD/CHF avg ---- 1.01 55/91 0.0
USD/JPY avg ---- 1.05 113/316 0.1
XAU/USD avg ---- 1.43 71/115 1.4

15 avg ---- 1.27 891/1439 6.9
240 avg ---- 10.11 102/68 48.9
30 avg ---- 2.42 465/760 26.2
5 avg ---- 1.15 1219/2236 3.5
60 avg ---- 2.18 246/301 14.5

AUD/CAD:240 ---- 8.43 7/1 2.0
AUD/CAD:240:L ---- 3.72 3/1 0.7
AUD/CAD:240:S ---- ++++ 4/0 1.3
AUD/CAD:30 ---- 0.97 24/38 -0.0
AUD/CAD:30:L ---- 0.88 11/20 -0.0
AUD/CAD:30:S ---- 1.10 13/18 0.0
AUD/CAD:60 ---- 1.25 7/7 0.1
AUD/CAD:60:L ---- 0.91 3/4 -0.0
AUD/CAD:60:S ---- 2.05 4/3 0.2
AUD/CHF:15 ---- 1.59 25/37 1.1
AUD/CHF:15:L ---- 1.22 13/18 0.2
AUD/CHF:15:S ---- 1.97 12/19 0.9
AUD/CHF:240 ---- 2.46 2/4 0.4
AUD/CHF:240:L ---- 0.00 0/3 -0.2
AUD/CHF:240:S ---- 11.20 2/1 0.6
AUD/CHF:30 ---- 1.76 22/32 1.0
AUD/CHF:30:L ---- 1.30 11/16 0.2
AUD/CHF:30:S ---- 2.28 11/16 0.8
AUD/CHF:60 ---- 2.30 8/8 0.7
AUD/CHF:60:L ---- 1.13 3/5 0.0
AUD/CHF:60:S ---- 5.42 5/3 0.6
AUD/JPY:15 ---- 1.36 50/78 0.5
AUD/JPY:15:L ---- 1.33 24/40 0.2
AUD/JPY:15:S ---- 1.39 26/38 0.3
AUD/JPY:240 ---- 8.68 4/4 3.5
AUD/JPY:240:L ---- 7.26 2/2 1.6
AUD/JPY:240:S ---- 10.54 2/2 1.9
AUD/JPY:30 ---- 2.22 17/23 1.5
AUD/JPY:30:L ---- 2.02 6/14 0.7
AUD/JPY:30:S ---- 2.47 11/9 0.8
AUD/JPY:5 ---- 1.27 74/118 0.7
AUD/JPY:5:L ---- 1.22 39/57 0.3
AUD/JPY:5:S ---- 1.32 35/61 0.4
AUD/JPY:60 ---- 6.94 8/2 2.8
AUD/JPY:60:L ---- 3.72 3/2 1.3
AUD/JPY:60:S ---- ++++ 5/0 1.5
AUD/NZD:240 ---- 2.43 5/2 0.3
AUD/NZD:240:L ---- 2.29 2/1 0.1
AUD/NZD:240:S ---- 2.49 3/1 0.2
AUD/NZD:30 ---- 1.44 16/17 0.3
AUD/NZD:30:L ---- 1.24 8/8 0.1
AUD/NZD:30:S ---- 1.64 8/9 0.2
AUD/NZD:60 ---- 2.01 19/16 0.8
AUD/NZD:60:L ---- 1.78 9/8 0.3
AUD/NZD:60:S ---- 2.32 10/8 0.4
AUD/USD:240 ---- 17.28 7/1 4.6
AUD/USD:240:L ---- 5.22 3/1 1.2
AUD/USD:240:S ---- ++++ 4/0 3.4
AUD/USD:30 ---- 1.51 15/22 0.4
AUD/USD:30:L ---- 0.91 5/13 -0.0
AUD/USD:30:S ---- 2.42 10/9 0.5
AUD/USD:5 ---- 1.09 172/265 0.2
AUD/USD:5:L ---- 0.94 87/131 -0.0
AUD/USD:5:S ---- 1.26 85/134 0.2
AUD/USD:60 ---- 5.29 8/4 2.9
AUD/USD:60:L ---- 2.79 3/3 0.6
AUD/USD:60:S ---- 8.22 5/1 2.2
CAD/CHF:15 ---- 0.96 49/105 -0.0
CAD/CHF:15:L ---- 0.85 25/52 -0.0
CAD/CHF:15:S ---- 1.10 24/53 0.0
CAD/CHF:240 ---- 1.55 3/2 0.1
CAD/CHF:240:L ---- 0.50 1/1 -0.0
CAD/CHF:240:S ---- 5.51 2/1 0.1
CAD/CHF:60 ---- 0.98 12/21 -0.0
CAD/CHF:60:L ---- 0.64 5/11 -0.1
CAD/CHF:60:S ---- 1.47 7/10 0.1
CAD/JPY:15 ---- 1.35 46/77 0.8
CAD/JPY:15:L ---- 1.31 23/39 0.4
CAD/JPY:15:S ---- 1.40 23/38 0.4
CAD/JPY:240 ---- ++++ 3/0 1.4
CAD/JPY:240:L ---- ++++ 1/0 0.8
CAD/JPY:240:S ---- ++++ 2/0 0.6
CAD/JPY:30 ---- 1.55 30/38 1.0
CAD/JPY:30:L ---- 1.44 14/20 0.5
CAD/JPY:30:S ---- 1.74 16/18 0.5
CAD/JPY:5 ---- 1.20 91/175 0.4
CAD/JPY:5:L ---- 1.19 48/85 0.2
CAD/JPY:5:S ---- 1.21 43/90 0.2
CHF/JPY:240 ---- 7.00 3/5 2.8
CHF/JPY:240:L ---- 10.87 2/2 2.6
CHF/JPY:240:S ---- 1.72 1/3 0.1
CHF/JPY:30 ---- 1.06 30/57 0.0
CHF/JPY:30:L ---- 1.34 16/27 0.1
CHF/JPY:30:S ---- 0.83 14/30 -0.0
CHF/JPY:60 ---- 1.02 10/24 0.0
CHF/JPY:60:L ---- 1.40 6/11 0.0
CHF/JPY:60:S ---- 0.72 4/13 -0.0
EUR/AUD:15 ---- 1.55 42/57 1.2
EUR/AUD:15:L ---- 1.49 19/30 0.5
EUR/AUD:15:S ---- 1.60 23/27 0.7
EUR/AUD:30 ---- 1.74 24/23 0.8
EUR/AUD:30:L ---- 1.56 10/13 0.4
EUR/AUD:30:S ---- 1.98 14/10 0.5
EUR/CAD:15 ---- 1.21 57/75 0.3
EUR/CAD:15:L ---- 1.07 26/40 0.1
EUR/CAD:15:S ---- 1.35 31/35 0.3
EUR/CAD:30 ---- 1.14 28/39 0.1
EUR/CAD:30:L ---- 0.98 16/17 -0.0
EUR/CAD:30:S ---- 1.32 12/22 0.1
EUR/CHF:15 ---- 0.99 59/85 -0.0
EUR/CHF:15:L ---- 0.56 24/48 -0.5
EUR/CHF:15:S ---- 1.58 35/37 0.5
EUR/CHF:240 ---- 1.54 3/4 0.1
EUR/CHF:240:L ---- 0.18 1/2 -0.1
EUR/CHF:240:S ---- 3.37 2/2 0.1
EUR/CHF:30 ---- 1.07 13/26 0.0
EUR/CHF:30:L ---- 0.39 3/16 -0.1
EUR/CHF:30:S ---- 2.40 10/10 0.1
EUR/CHF:5 ---- 1.00 105/183 -0.0
EUR/CHF:5:L ---- 0.66 50/94 -0.1
EUR/CHF:5:S ---- 1.40 55/89 0.1
EUR/CHF:60 ---- 1.32 11/22 0.2
EUR/CHF:60:L ---- 0.42 3/13 -0.3
EUR/CHF:60:S ---- 3.08 8/9 0.5
EUR/GBP:15 ---- 1.00 46/69 -0.0
EUR/GBP:15:L ---- 0.82 21/36 -0.1
EUR/GBP:15:S ---- 1.16 25/33 0.1
EUR/GBP:60 ---- 1.42 8/5 0.1
EUR/GBP:60:L ---- 0.64 3/3 -0.1
EUR/GBP:60:S ---- 2.63 5/2 0.2
EUR/JPY:240 ---- 2.56 6/4 0.5
EUR/JPY:240:L ---- 2.07 3/2 0.1
EUR/JPY:240:S ---- 2.87 3/2 0.4
EUR/JPY:30 ---- 1.42 22/34 0.2
EUR/JPY:30:L ---- 1.14 9/19 0.1
EUR/JPY:30:S ---- 1.90 13/15 0.2
EUR/JPY:60 ---- 2.16 7/5 0.4
EUR/JPY:60:L ---- 1.54 3/3 0.1
EUR/JPY:60:S ---- 2.81 4/2 0.3
EUR/NZD:15 ---- 1.36 38/53 0.6
EUR/NZD:15:L ---- 1.25 16/29 0.2
EUR/NZD:15:S ---- 1.48 22/24 0.4
EUR/NZD:30 ---- 1.05 24/52 0.0
EUR/NZD:30:L ---- 0.94 12/26 -0.0
EUR/NZD:30:S ---- 1.16 12/26 0.0
EUR/USD:240 ---- 5.63 3/5 1.0
EUR/USD:240:L ---- 0.03 1/3 -0.2
EUR/USD:240:S ---- 307.52 2/2 1.2
EUR/USD:30 ---- 84.99 6/11 18.1
EUR/USD:30:L ---- 21.37 2/6 3.1
EUR/USD:30:S ---- 229.79 4/5 15.1
EUR/USD:5 ---- 1.30 23/123 0.1
EUR/USD:5:L ---- 0.52 11/62 -0.1
EUR/USD:5:S ---- 2.43 12/61 0.2
GBP/AUD:15 ---- 1.36 22/41 0.3
GBP/AUD:15:L ---- 1.56 11/20 0.2
GBP/AUD:15:S ---- 1.17 11/21 0.1
GBP/AUD:240 ---- 2.35 5/3 0.4
GBP/AUD:240:L ---- 3.58 3/1 0.3
GBP/AUD:240:S ---- 1.46 2/2 0.1
GBP/AUD:30 ---- 1.25 20/32 0.3
GBP/AUD:30:L ---- 1.52 11/15 0.2
GBP/AUD:30:S ---- 1.05 9/17 0.0
GBP/AUD:60 ---- 2.12 20/18 0.9
GBP/AUD:60:L ---- 2.34 11/8 0.6
GBP/AUD:60:S ---- 1.86 9/10 0.3
GBP/CAD:240 ---- 1.05 2/2 0.0
GBP/CAD:240:L ---- 1.06 1/1 0.0
GBP/CAD:240:S ---- 1.04 1/1 0.0
GBP/CAD:60 ---- 0.97 13/19 -0.0
GBP/CAD:60:L ---- 1.09 6/10 0.0
GBP/CAD:60:S ---- 0.89 7/9 -0.0
GBP/CHF:60 ---- 1.28 13/19 0.2
GBP/CHF:60:L ---- 0.92 6/10 -0.0
GBP/CHF:60:S ---- 1.70 7/9 0.2
GBP/JPY:15 ---- 1.34 56/89 0.7
GBP/JPY:15:L ---- 1.32 31/42 0.4
GBP/JPY:15:S ---- 1.36 25/47 0.4
GBP/JPY:240 ---- 1.98 5/5 0.3
GBP/JPY:240:L ---- 1.63 2/3 0.2
GBP/JPY:240:S ---- 3.23 3/2 0.2
GBP/JPY:30 ---- 1.14 23/45 0.1
GBP/JPY:30:L ---- 1.12 11/23 0.0
GBP/JPY:30:S ---- 1.17 12/22 0.0
GBP/JPY:5 ---- 1.15 71/131 0.2
GBP/JPY:5:L ---- 1.15 38/63 0.1
GBP/JPY:5:S ---- 1.14 33/68 0.1
GBP/JPY:60 ---- 1.62 14/20 0.4
GBP/JPY:60:L ---- 1.48 5/12 0.2
GBP/JPY:60:S ---- 1.88 9/8 0.2
GBP/NZD:60 ---- 1.91 11/15 0.6
GBP/NZD:60:L ---- 2.42 8/5 0.3
GBP/NZD:60:S ---- 1.61 3/10 0.2
GBP/USD:15 ---- 1.00 60/94 0.0
GBP/USD:15:L ---- 0.76 28/49 -0.1
GBP/USD:15:S ---- 1.22 32/45 0.1
GBP/USD:240 ---- 2.99 6/4 0.8
GBP/USD:240:L ---- 1.28 2/3 0.1
GBP/USD:240:S ---- 5.07 4/1 0.8
GBP/USD:5 ---- 1.13 119/211 0.1
GBP/USD:5:L ---- 0.96 58/107 -0.0
GBP/USD:5:S ---- 1.32 61/104 0.2
GBP/USD:60 ---- 3.39 9/3 1.3
GBP/USD:60:L ---- 1.47 4/2 0.2
GBP/USD:60:S ---- 8.38 5/1 1.1
GER30:5 ---- 1.06 82/155 0.1
GER30:5:L ---- 1.11 43/76 0.1
GER30:5:S ---- 1.01 39/79 0.0
GER30:60 ---- 0.31 7/20 -0.1
GER30:60:L ---- 0.47 5/9 -0.0
GER30:60:S ---- 0.12 2/11 -0.0
NAS100:240 ---- 6.55 6/1 0.7
NAS100:240:L ---- ++++ 4/0 0.7
NAS100:240:S ---- 1.01 2/1 0.0
NAS100:5 ---- 1.14 164/275 0.4
NAS100:5:L ---- 1.41 86/133 0.5
NAS100:5:S ---- 0.91 78/142 -0.1
NAS100:60 ---- 1.74 7/6 0.3
NAS100:60:L ---- 5.08 6/1 0.5
NAS100:60:S ---- 0.57 1/5 -0.1
NZD/CAD:15 ---- 1.29 35/54 0.2
NZD/CAD:15:L ---- 1.23 17/27 0.1
NZD/CAD:15:S ---- 1.35 18/27 0.1
NZD/CAD:240 ---- 1.83 6/4 0.3
NZD/CAD:240:L ---- 2.05 3/2 0.1
NZD/CAD:240:S ---- 1.67 3/2 0.1
NZD/CAD:30 ---- 1.28 24/34 0.3
NZD/CAD:30:L ---- 1.23 12/17 0.1
NZD/CAD:30:S ---- 1.34 12/17 0.2
NZD/CAD:60 ---- 1.19 8/8 0.0
NZD/CAD:60:L ---- 1.14 5/3 0.0
NZD/CAD:60:S ---- 1.24 3/5 0.0
NZD/CHF:15 ---- 1.29 51/60 0.3
NZD/CHF:15:L ---- 1.05 21/34 0.0
NZD/CHF:15:S ---- 1.61 30/26 0.3
NZD/CHF:240 ---- 1.53 3/2 0.1
NZD/CHF:240:L ---- 0.12 1/1 -0.0
NZD/CHF:240:S ---- 2.49 2/1 0.1
NZD/CHF:30 ---- 1.47 19/27 0.7
NZD/CHF:30:L ---- 1.11 8/15 0.1
NZD/CHF:30:S ---- 1.87 11/12 0.6
NZD/CHF:60 ---- 1.40 7/9 0.1
NZD/CHF:60:L ---- 0.97 3/5 -0.0
NZD/CHF:60:S ---- 2.30 4/4 0.1
NZD/JPY:15 ---- 1.25 54/91 0.4
NZD/JPY:15:L ---- 1.19 24/48 0.2
NZD/JPY:15:S ---- 1.32 30/43 0.3
NZD/JPY:30 ---- 1.67 17/25 0.5
NZD/JPY:30:L ---- 1.50 6/15 0.2
NZD/JPY:30:S ---- 1.95 11/10 0.3
NZD/JPY:5 ---- 1.14 76/128 0.2
NZD/JPY:5:L ---- 1.10 40/62 0.1
NZD/JPY:5:S ---- 1.17 36/66 0.1
NZD/JPY:60 ---- 2.11 15/23 1.6
NZD/JPY:60:L ---- 1.98 6/13 0.8
NZD/JPY:60:S ---- 2.27 9/10 0.8
NZD/USD:15 ---- 1.17 39/59 0.1
NZD/USD:15:L ---- 0.89 16/33 -0.0
NZD/USD:15:S ---- 1.54 23/26 0.1
NZD/USD:240 ---- 2.09 5/5 0.3
NZD/USD:240:L ---- 0.82 2/3 -0.0
NZD/USD:240:S ---- 3.15 3/2 0.4
NZD/USD:60 ---- 2.25 6/10 0.7
NZD/USD:60:L ---- 1.32 2/6 0.1
NZD/USD:60:S ---- 3.38 4/4 0.6
US30:240 ---- ++++ 7/0 29.0
US30:240:L ---- ++++ 4/0 22.4
US30:240:S ---- ++++ 3/0 6.6
US30:30 ---- 1.09 19/42 0.2
US30:30:L ---- 1.30 11/20 0.3
US30:30:S ---- 0.89 8/22 -0.1
US30:5 ---- 1.14 103/167 0.6
US30:5:L ---- 1.27 57/78 0.6
US30:5:S ---- 1.01 46/89 0.0
USD/CAD:15 ---- 1.10 49/93 0.1
USD/CAD:15:L ---- 1.38 24/47 0.1
USD/CAD:15:S ---- 0.88 25/46 -0.0
USD/CAD:240 ---- 1.85 6/5 0.3
USD/CAD:240:L ---- 15.15 4/1 0.3
USD/CAD:240:S ---- 0.75 2/4 -0.1
USD/CAD:30 ---- 1.20 25/40 0.1
USD/CAD:30:L ---- 1.83 14/18 0.2
USD/CAD:30:S ---- 0.81 11/22 -0.1
USD/CAD:5 ---- 1.22 75/121 0.4
USD/CAD:5:L ---- 1.53 40/58 0.4
USD/CAD:5:S ---- 0.99 35/63 -0.0
USD/CAD:60 ---- 1.32 8/9 0.1
USD/CAD:60:L ---- 5.68 5/3 0.2
USD/CAD:60:S ---- 0.62 3/6 -0.1
USD/CHF:15 ---- 1.01 55/91 0.0
USD/CHF:15:L ---- 1.11 29/44 0.0
USD/CHF:15:S ---- 0.90 26/47 -0.0
USD/JPY:15 ---- 1.08 31/78 0.1
USD/JPY:15:L ---- 1.88 17/38 0.3
USD/JPY:15:S ---- 0.60 14/40 -0.2
USD/JPY:30 ---- 1.08 18/54 0.0
USD/JPY:30:L ---- 2.08 11/25 0.1
USD/JPY:30:S ---- 0.51 7/29 -0.1
USD/JPY:5 ---- 0.97 64/184 -0.0
USD/JPY:5:L ---- 1.37 37/87 0.1
USD/JPY:5:S ---- 0.73 27/97 -0.1
XAU/USD:15 ---- 1.23 27/53 0.3
XAU/USD:15:L ---- 1.03 15/25 0.0
XAU/USD:15:S ---- 1.43 12/28 0.3
XAU/USD:240 ---- 1.40 5/5 0.1
XAU/USD:240:L ---- 0.90 3/2 -0.0
XAU/USD:240:S ---- 2.04 2/3 0.2
XAU/USD:30 ---- 1.50 29/49 0.6
XAU/USD:30:L ---- 1.27 17/22 0.2
XAU/USD:30:S ---- 1.72 12/27 0.4
XAU/USD:60 ---- 1.76 10/8 0.4
XAU/USD:60:L ---- 1.24 5/4 0.1
XAU/USD:60:S ---- 2.16 5/4 0.3




So now, simple reality check. Make OOS Test the following month:


[Linked Image]
Quote

Test 0_Lapsa_EvenBetterSineWave , Zorro 2.409

Simulated account AssetsFix
Bar period 1 min (avg 1 min)
Total processed 54521 bars
Test period 2022-01-02..2022-01-30 (27851 bars)
Lookback period 1000 bars (25 hours)
Montecarlo cycles 200
Simulation mode Realistic (slippage 5.0 sec)
Capital invested 2000$

Gross win/loss 5934$-5634$, -26699.9p, lr 16.63$
Average profit 3916$/year, 326$/month, 15.06$/day
Max drawdown -1442$ 479.6% (MAE -1815$ 603.7%)
Total down time 89% (TAE 99%)
Max down time 12 days from Jan 2022
Max open margin 624$
Max open risk 3457$
Trade volume 2367045$ (30832134$/year)
Transaction costs -300$ spr, 34.40$ slp, -42.40$ rol, -13.53$ com
Capital required 4303$

Number of trades 1029 (13404/year, 258/week, 53/day)
Percent winning 39.1%
Max win/loss 370$ / -190$
Avg trade profit 0.29$ -25.9p (+1311.0p / -797.9p)
Avg trade slippage 0.0334$ 3.0p (+46.3p / -24.8p)
Avg trade bars 2157 (+3448 / -1329)
Max trade bars 26067 (27 days)
Time in market 7971%
Max open trades 93
Max loss streak 15 (uncorrelated 15)

Annual growth rate 519.78%
Profit factor 1.05 (PRR 0.96)
Sharpe ratio 0.54 (Sortino 0.52)
R2 coefficient 0.000
Ulcer index 100.0%
Scholz tax 79 EUR

Portfolio analysis OptF ProF Win/Loss Wgt%

AUD/CAD avg ---- 0.96 4/7 -1.6
AUD/CHF avg ---- 0.61 10/12 -36.1
AUD/JPY avg ---- 1.51 23/31 69.7
AUD/NZD avg ---- 0.14 3/9 -27.6
AUD/USD avg ---- 3.14 30/38 169.5
CAD/CHF avg ---- 0.47 9/12 -13.4
CAD/JPY avg ---- 0.56 27/40 -53.4
CHF/JPY avg ---- 6.28 7/10 49.9
EUR/AUD avg ---- 0.94 9/13 -3.8
EUR/CAD avg ---- 1.42 12/11 8.4
EUR/CHF avg ---- 1.09 23/38 5.6
EUR/GBP avg ---- 0.67 6/11 -5.3
EUR/JPY avg ---- 1.62 4/9 14.5
EUR/NZD avg ---- 0.54 10/14 -22.6
EUR/USD avg ---- ---- 0/0 0.0
GBP/AUD avg ---- 0.64 15/12 -38.7
GBP/CAD avg ---- 2.22 3/1 2.1
GBP/CHF avg ---- 0.33 2/2 -12.9
GBP/JPY avg ---- 0.75 24/45 -26.2
GBP/NZD avg ---- 0.95 1/3 -1.2
GBP/USD avg ---- 1.68 23/46 34.2
GER30 avg ---- 0.57 12/25 -18.0
NAS100 avg ---- 1.92 22/41 82.7
NZD/CAD avg ---- 2.96 11/9 39.5
NZD/CHF avg ---- 1.59 12/15 19.3
NZD/JPY avg ---- 1.20 23/33 18.7
NZD/USD avg ---- 6.78 8/9 55.1
SPX500 avg ---- ---- 0/0 0.0
US30 avg ---- 0.36 14/36 -211.1
USD/CAD avg ---- 1.40 21/31 22.4
USD/CHF avg ---- 2.09 8/10 7.0
USD/JPY avg ---- 1.07 18/35 2.7
XAU/USD avg ---- 0.63 8/19 -29.5

15 avg ---- 0.93 125/183 -31.1
240 avg ---- 2.63 13/8 260.1
30 avg ---- 0.89 76/95 -42.3
5 avg ---- 0.63 153/302 -214.5
60 avg ---- 1.43 35/39 127.8

AUD/CAD:240 ---- 0.00 0/1 -31.0
AUD/CAD:240:L ---- ---- 0/0 0.0
AUD/CAD:240:S ---- 0.00 0/1 -31.0
AUD/CAD:30 ---- 0.68 3/6 -2.5
AUD/CAD:30:L ---- 0.00 0/4 -6.7
AUD/CAD:30:S ---- 5.75 3/2 4.3
AUD/CAD:60 ---- ++++ 1/0 31.8
AUD/CAD:60:L ---- ---- 0/0 0.0
AUD/CAD:60:S ---- ++++ 1/0 31.8
AUD/CHF:15 ---- 0.60 4/5 -15.3
AUD/CHF:15:L ---- 0.15 1/3 -18.4
AUD/CHF:15:S ---- 1.19 3/2 3.1
AUD/CHF:240 ---- ++++ 1/0 5.2
AUD/CHF:240:L ---- ---- 0/0 0.0
AUD/CHF:240:S ---- ++++ 1/0 5.2
AUD/CHF:30 ---- 1.02 4/5 0.6
AUD/CHF:30:L ---- 0.40 2/2 -9.5
AUD/CHF:30:S ---- 2.06 2/3 10.1
AUD/CHF:60 ---- 0.09 1/2 -26.6
AUD/CHF:60:L ---- 0.00 0/1 -21.6
AUD/CHF:60:S ---- 0.34 1/1 -5.1
AUD/JPY:15 ---- 1.36 8/11 7.1
AUD/JPY:15:L ---- 0.51 3/6 -6.8
AUD/JPY:15:S ---- 3.29 5/5 13.9
AUD/JPY:240 ---- ++++ 1/0 62.3
AUD/JPY:240:L ---- ---- 0/0 0.0
AUD/JPY:240:S ---- ++++ 1/0 62.3
AUD/JPY:30 ---- 0.10 2/7 -60.2
AUD/JPY:30:L ---- 0.00 0/4 -46.3
AUD/JPY:30:S ---- 0.32 2/3 -13.9
AUD/JPY:5 ---- 0.97 11/13 -1.3
AUD/JPY:5:L ---- 0.39 5/7 -18.8
AUD/JPY:5:S ---- 1.93 6/6 17.5
AUD/JPY:60 ---- ++++ 1/0 61.8
AUD/JPY:60:L ---- ---- 0/0 0.0
AUD/JPY:60:S ---- ++++ 1/0 61.8
AUD/NZD:240 ---- 0.00 0/2 -7.1
AUD/NZD:240:L ---- 0.00 0/1 -1.6
AUD/NZD:240:S ---- 0.00 0/1 -5.6
AUD/NZD:30 ---- 0.57 2/3 -2.7
AUD/NZD:30:L ---- 2.83 1/1 2.1
AUD/NZD:30:S ---- 0.06 1/2 -4.8
AUD/NZD:60 ---- 0.06 1/4 -17.7
AUD/NZD:60:L ---- 0.00 0/2 -2.5
AUD/NZD:60:S ---- 0.07 1/2 -15.3
AUD/USD:240 ---- ++++ 1/0 123.2
AUD/USD:240:L ---- ---- 0/0 0.0
AUD/USD:240:S ---- ++++ 1/0 123.2
AUD/USD:30 ---- 4.02 3/2 27.3
AUD/USD:30:L ---- 0.91 1/1 -0.6
AUD/USD:30:S ---- 12.92 2/1 27.9
AUD/USD:5 ---- 1.37 25/34 10.3
AUD/USD:5:L ---- 0.82 14/15 -2.6
AUD/USD:5:S ---- 1.95 11/19 12.9
AUD/USD:60 ---- 1.20 1/2 8.6
AUD/USD:60:L ---- 0.00 0/1 -32.2
AUD/USD:60:S ---- 5.08 1/1 40.8
CAD/CHF:15 ---- 2.12 7/7 5.4
CAD/CHF:15:L ---- 2.72 3/4 4.3
CAD/CHF:15:S ---- 1.47 4/3 1.1
CAD/CHF:240 ---- ++++ 1/0 0.7
CAD/CHF:240:L ---- ---- 0/0 0.0
CAD/CHF:240:S ---- ++++ 1/0 0.7
CAD/CHF:60 ---- 0.05 1/5 -19.5
CAD/CHF:60:L ---- 0.17 1/2 -4.9
CAD/CHF:60:S ---- 0.00 0/3 -14.6
CAD/JPY:15 ---- 0.56 9/10 -18.7
CAD/JPY:15:L ---- 0.37 4/5 -10.2
CAD/JPY:15:S ---- 0.67 5/5 -8.5
CAD/JPY:30 ---- 0.61 5/6 -11.4
CAD/JPY:30:L ---- 0.22 2/3 -5.3
CAD/JPY:30:S ---- 0.73 3/3 -6.0
CAD/JPY:5 ---- 0.54 13/24 -23.3
CAD/JPY:5:L ---- 0.53 4/14 -13.7
CAD/JPY:5:S ---- 0.56 9/10 -9.6
CHF/JPY:240 ---- ++++ 1/0 51.2
CHF/JPY:240:L ---- ---- 0/0 0.0
CHF/JPY:240:S ---- ++++ 1/0 51.2
CHF/JPY:30 ---- 0.61 4/9 -3.1
CHF/JPY:30:L ---- 0.14 1/5 -3.7
CHF/JPY:30:S ---- 1.14 3/4 0.6
CHF/JPY:60 ---- 2.26 2/1 1.8
CHF/JPY:60:L ---- 0.00 0/1 -1.4
CHF/JPY:60:S ---- ++++ 2/0 3.1
EUR/AUD:15 ---- 1.14 7/7 5.8
EUR/AUD:15:L ---- 1.92 4/3 18.3
EUR/AUD:15:S ---- 0.39 3/4 -12.5
EUR/AUD:30 ---- 0.56 2/6 -9.6
EUR/AUD:30:L ---- 2.48 2/2 7.2
EUR/AUD:30:S ---- 0.00 0/4 -16.9
EUR/CAD:15 ---- 1.00 6/9 -0.0
EUR/CAD:15:L ---- 0.50 2/6 -6.2
EUR/CAD:15:S ---- 1.97 4/3 6.2
EUR/CAD:30 ---- 7.50 6/2 8.5
EUR/CAD:30:L ---- 2.61 2/2 2.1
EUR/CAD:30:S ---- ++++ 4/0 6.4
EUR/CHF:15 ---- 1.61 7/10 17.7
EUR/CHF:15:L ---- 1.40 3/6 8.2
EUR/CHF:15:S ---- 2.06 4/4 9.5
EUR/CHF:240 ---- ++++ 1/0 1.5
EUR/CHF:240:L ---- ---- 0/0 0.0
EUR/CHF:240:S ---- ++++ 1/0 1.5
EUR/CHF:30 ---- 0.81 3/1 -0.6
EUR/CHF:30:L ---- ++++ 2/0 0.5
EUR/CHF:30:S ---- 0.65 1/1 -1.0
EUR/CHF:5 ---- 1.09 10/25 0.8
EUR/CHF:5:L ---- 1.13 5/13 0.6
EUR/CHF:5:S ---- 1.05 5/12 0.2
EUR/CHF:60 ---- 0.44 2/2 -13.8
EUR/CHF:60:L ---- 0.33 1/1 -3.9
EUR/CHF:60:S ---- 0.47 1/1 -9.9
EUR/GBP:15 ---- 0.54 5/10 -7.5
EUR/GBP:15:L ---- 0.29 2/5 -7.3
EUR/GBP:15:S ---- 0.96 3/5 -0.3
EUR/GBP:60 ---- 41.97 1/1 2.2
EUR/GBP:60:L ---- 0.00 0/1 -0.1
EUR/GBP:60:S ---- ++++ 1/0 2.3
EUR/JPY:240 ---- ++++ 1/0 19.7
EUR/JPY:240:L ---- ---- 0/0 0.0
EUR/JPY:240:S ---- ++++ 1/0 19.7
EUR/JPY:30 ---- 0.19 2/9 -18.8
EUR/JPY:30:L ---- 0.00 0/5 -13.5
EUR/JPY:30:S ---- 0.46 2/4 -5.4
EUR/JPY:60 ---- ++++ 1/0 13.7
EUR/JPY:60:L ---- ---- 0/0 0.0
EUR/JPY:60:S ---- ++++ 1/0 13.7
EUR/NZD:15 ---- 0.47 4/10 -22.9
EUR/NZD:15:L ---- 1.34 3/4 5.1
EUR/NZD:15:S ---- 0.01 1/6 -28.0
EUR/NZD:30 ---- 1.06 6/4 0.4
EUR/NZD:30:L ---- 9.71 4/1 3.9
EUR/NZD:30:S ---- 0.34 2/3 -3.6
GBP/AUD:15 ---- 3.71 7/3 18.5
GBP/AUD:15:L ---- 15.27 4/1 18.6
GBP/AUD:15:S ---- 0.98 3/2 -0.1
GBP/AUD:240 ---- 0.00 0/1 -28.4
GBP/AUD:240:L ---- ---- 0/0 0.0
GBP/AUD:240:S ---- 0.00 0/1 -28.4
GBP/AUD:30 ---- 2.78 6/2 17.2
GBP/AUD:30:L ---- ++++ 4/0 21.5
GBP/AUD:30:S ---- 0.56 2/2 -4.3
GBP/AUD:60 ---- 0.28 2/6 -46.0
GBP/AUD:60:L ---- 1.02 2/2 0.3
GBP/AUD:60:S ---- 0.00 0/4 -46.3
GBP/CAD:60 ---- 2.22 3/1 2.1
GBP/CAD:60:L ---- 0.72 1/1 -0.5
GBP/CAD:60:S ---- ++++ 2/0 2.6
GBP/CHF:60 ---- 0.33 2/2 -12.9
GBP/CHF:60:L ---- 0.46 1/1 -3.3
GBP/CHF:60:S ---- 0.28 1/1 -9.5
GBP/JPY:15 ---- 0.61 7/16 -18.9
GBP/JPY:15:L ---- 0.50 4/7 -12.6
GBP/JPY:15:S ---- 0.73 3/9 -6.3
GBP/JPY:240 ---- ++++ 1/0 10.2
GBP/JPY:240:L ---- ---- 0/0 0.0
GBP/JPY:240:S ---- ++++ 1/0 10.2
GBP/JPY:30 ---- 1.03 5/5 0.2
GBP/JPY:30:L ---- 0.80 3/2 -0.7
GBP/JPY:30:S ---- 1.18 2/3 0.9
GBP/JPY:5 ---- 0.56 10/21 -16.0
GBP/JPY:5:L ---- 0.49 5/10 -10.2
GBP/JPY:5:S ---- 0.64 5/11 -5.9
GBP/JPY:60 ---- 0.83 1/3 -1.7
GBP/JPY:60:L ---- 0.00 0/2 -5.1
GBP/JPY:60:S ---- 1.68 1/1 3.4
GBP/NZD:60 ---- 0.95 1/3 -1.2
GBP/NZD:60:L ---- 4.57 1/1 17.0
GBP/NZD:60:S ---- 0.00 0/2 -18.2
GBP/USD:15 ---- 1.33 7/9 3.1
GBP/USD:15:L ---- 1.06 4/4 0.4
GBP/USD:15:S ---- 1.71 3/5 2.7
GBP/USD:240 ---- ++++ 1/0 37.3
GBP/USD:240:L ---- ---- 0/0 0.0
GBP/USD:240:S ---- ++++ 1/0 37.3
GBP/USD:5 ---- 0.48 14/35 -12.3
GBP/USD:5:L ---- 0.41 8/16 -7.7
GBP/USD:5:S ---- 0.58 6/19 -4.6
GBP/USD:60 ---- 1.37 1/2 6.2
GBP/USD:60:L ---- 0.00 0/1 -11.1
GBP/USD:60:S ---- 4.02 1/1 17.3
GER30:5 ---- 0.53 9/24 -19.1
GER30:5:L ---- 0.28 3/13 -17.4
GER30:5:S ---- 0.90 6/11 -1.7
GER30:60 ---- 3.63 3/1 1.2
GER30:60:L ---- 0.07 1/1 -0.4
GER30:60:S ---- ++++ 2/0 1.6
NAS100:240 ---- ++++ 1/0 56.8
NAS100:240:L ---- ---- 0/0 0.0
NAS100:240:S ---- ++++ 1/0 56.8
NAS100:5 ---- 0.75 20/41 -22.9
NAS100:5:L ---- 0.25 8/23 -38.4
NAS100:5:S ---- 1.40 12/18 15.6
NAS100:60 ---- ++++ 1/0 48.7
NAS100:60:L ---- ---- 0/0 0.0
NAS100:60:S ---- ++++ 1/0 48.7
NZD/CAD:15 ---- 2.28 6/5 9.4
NZD/CAD:15:L ---- 0.01 1/4 -5.6
NZD/CAD:15:S ---- 10.20 5/1 15.1
NZD/CAD:240 ---- ++++ 1/0 21.2
NZD/CAD:240:L ---- ---- 0/0 0.0
NZD/CAD:240:S ---- ++++ 1/0 21.2
NZD/CAD:30 ---- 1.33 3/4 4.1
NZD/CAD:30:L ---- 0.00 0/3 -11.8
NZD/CAD:30:S ---- 18.32 3/1 16.0
NZD/CAD:60 ---- ++++ 1/0 4.7
NZD/CAD:60:L ---- ---- 0/0 0.0
NZD/CAD:60:S ---- ++++ 1/0 4.7
NZD/CHF:15 ---- 0.63 6/13 -10.3
NZD/CHF:15:L ---- 0.29 2/7 -12.0
NZD/CHF:15:S ---- 1.16 4/6 1.8
NZD/CHF:30 ---- 5.31 5/2 19.9
NZD/CHF:30:L ---- 0.82 1/2 -0.8
NZD/CHF:30:S ---- ++++ 4/0 20.7
NZD/CHF:60 ---- ++++ 1/0 9.7
NZD/CHF:60:L ---- ---- 0/0 0.0
NZD/CHF:60:S ---- ++++ 1/0 9.7
NZD/JPY:15 ---- 0.65 8/11 -13.5
NZD/JPY:15:L ---- 0.23 3/6 -20.5
NZD/JPY:15:S ---- 1.59 5/5 7.0
NZD/JPY:30 ---- 1.07 1/4 1.3
NZD/JPY:30:L ---- 0.00 0/2 -14.0
NZD/JPY:30:S ---- 5.18 1/2 15.3
NZD/JPY:5 ---- 0.80 12/17 -5.3
NZD/JPY:5:L ---- 0.26 4/10 -13.2
NZD/JPY:5:S ---- 1.93 8/7 7.9
NZD/JPY:60 ---- 4.34 2/1 36.2
NZD/JPY:60:L ---- 0.00 0/1 -10.8
NZD/JPY:60:S ---- ++++ 2/0 47.1
NZD/USD:15 ---- 1.70 5/8 2.9
NZD/USD:15:L ---- 0.08 1/5 -2.8
NZD/USD:15:S ---- 6.09 4/3 5.7
NZD/USD:240 ---- ++++ 1/0 29.5
NZD/USD:240:L ---- ---- 0/0 0.0
NZD/USD:240:S ---- ++++ 1/0 29.5
NZD/USD:60 ---- 5.20 2/1 22.7
NZD/USD:60:L ---- 0.00 0/1 -5.4
NZD/USD:60:S ---- ++++ 2/0 28.1
US30:240 ---- 0.00 0/1 -63.2
US30:240:L ---- ---- 0/0 0.0
US30:240:S ---- 0.00 0/1 -63.2
US30:30 ---- 0.77 2/5 -18.6
US30:30:L ---- 0.00 0/3 -39.0
US30:30:S ---- 1.47 2/2 20.4
US30:5 ---- 0.29 12/30 -129.3
US30:5:L ---- 0.20 5/16 -94.7
US30:5:S ---- 0.46 7/14 -34.6
USD/CAD:15 ---- 1.09 4/13 0.7
USD/CAD:15:L ---- 1.10 2/7 0.4
USD/CAD:15:S ---- 1.08 2/6 0.3
USD/CAD:240 ---- 0.09 1/1 -12.2
USD/CAD:240:L ---- ++++ 1/0 1.3
USD/CAD:240:S ---- 0.00 0/1 -13.5
USD/CAD:30 ---- 1.75 5/3 6.9
USD/CAD:30:L ---- 2.42 3/1 4.0
USD/CAD:30:S ---- 1.46 2/2 2.9
USD/CAD:5 ---- 1.28 9/14 7.1
USD/CAD:5:L ---- 1.66 5/7 6.6
USD/CAD:5:S ---- 1.03 4/7 0.5
USD/CAD:60 ---- ++++ 2/0 20.0
USD/CAD:60:L ---- ++++ 1/0 10.8
USD/CAD:60:S ---- ++++ 1/0 9.1
USD/CHF:15 ---- 2.09 8/10 7.0
USD/CHF:15:L ---- 3.32 6/3 5.6
USD/CHF:15:S ---- 1.36 2/7 1.4
USD/JPY:15 ---- 1.08 6/9 1.8
USD/JPY:15:L ---- 1.14 3/4 2.1
USD/JPY:15:S ---- 0.97 3/5 -0.3
USD/JPY:30 ---- 3.72 4/2 4.0
USD/JPY:30:L ---- 2.02 1/2 1.5
USD/JPY:30:S ---- ++++ 3/0 2.5
USD/JPY:5 ---- 0.75 8/24 -3.1
USD/JPY:5:L ---- 0.79 3/13 -1.5
USD/JPY:5:S ---- 0.70 5/11 -1.6
XAU/USD:15 ---- 0.88 4/7 -3.3
XAU/USD:15:L ---- 0.74 2/3 -3.2
XAU/USD:15:S ---- 0.99 2/4 -0.1
XAU/USD:240 ---- 0.00 0/2 -16.8
XAU/USD:240:L ---- 0.00 0/1 -12.6
XAU/USD:240:S ---- 0.00 0/1 -4.1
XAU/USD:30 ---- 0.81 3/8 -5.2
XAU/USD:30:L ---- 0.65 1/4 -4.2
XAU/USD:30:S ---- 0.94 2/4 -1.0
XAU/USD:60 ---- 0.54 1/2 -4.2
XAU/USD:60:L ---- 0.00 0/1 -4.9
XAU/USD:60:S ---- 1.17 1/1 0.7




First impression: stick to 1h and 4h, these timeframes seem profitable (at some assets, not all). And noticed in Train mode that shorter "Duration" optimization might fit better to 1h and 4h, lets say experiment between 30 till 150 maybe ...
I personally will not further investigate EBSW. It might have potencial with further research and development. Experimenting and implementing stops, trails, exit strategies and so on.

So why did i post this? I had read in one of your posts that you purchased or subscribed to Zorro S (I have the free version), so you have a really mighty tool in your hands, that you should use with all its power. Before you sticked to 1 asset with 1 strategy ... waste of time and efforts. @Gann and the other dude (sorry, forget your name smirk ) were also impressed from your approch, posts and efforts (me too). I believe that you will find your way to profitability ... dont give up. Cant await your new posts in your very own thread grin

PS: Not sure if i am allowed to post this here:
I personally follow a Youtube channel which is strongly related to algo trading. He is showing different approaches and he is really explaining everything very well and clear.
can just recomment to watch his videos. they are also not very long and boring, always around 10 minutes short, but have (at least for me) a huge value of knowledge in such a short time.
Darwinex Algo Trade Series
Thanks for your time.

So, be curious, be patient, never give up! Trade safe.

Attached File
Attached File
Attached File
AssetsFix.csv  (3 downloads)
Posted By: Lapsa

Re: Lapsa's very own thread - 12/15/23 12:01

ebsw works better with .8 to .9 cross

but I wouldn't recommend such usage either way

it's more useful for checking local cycles at a glance - graphically
© 2024 lite-C Forums