Technical analysis :useless junk science

Quote from ssrrkk:

Surprising but it does. I have hundreds of such test results. Also MACD is widely published. Also take a look at the world championship automated trading competitions. Most of the "successful" winning algorithms are based on cross-overs. Overcoming the costs is the name of the game.

Other than a few winners , 90 % of participants lose money , therefore the average performance is negative and losses in that same championship.


You forgot to mention unsuccessful are also based on t/a etc.
 
Remember (or you can confirm yourself) price timeseries are multi-scale and fractal like. No matter how you zoom in or zoom out, the trajectory has the same (scaled) distribution of wave lengths. At the seconds and minutes timescales, you will have relatively longer time scale fluctuations that give you winning MACD cross-over trades. But you will have more "stuttering" or sideways fluctuations which will kill you in terms of commission and slippage. Now zoom out to days or weeks. Guess what: the exact same thing happens but now at even longer time scales (i.e., good longer term winning trends, interspersed by sideways stuttering periods that kill you).

Quote from jcl:

I can not confirm this experience, and there is also no logical reason for it. Commission and slippage have nothing to do with the profitability of an algorithm. They have only relevance for the timeframe.

When you trade on minutes timeframes, then of course your algorithm must be very profitable for overcoming the trading costs, because the price movements are small. When you however trade the same algo on hour or day time frames, trading costs are negligible compared to the typical price movement range.
 
Quote from ssrrkk:

Remember (or you can confirm yourself) price timeseries are multi-scale and fractal like. No matter how you zoom in or zoom out, the trajectory has the same (scaled) distribution of wave lengths. At the seconds and minutes timescales, you will have relatively longer time scale fluctuations that give you winning MACD cross-over trades. But you will have more "stuttering" or sideways fluctuations which will kill you in terms of commission and slippage. Now zoom out to days or weeks. Guess what: the exact same thing happens but now at even longer time scales (i.e., good longer term winning trends, interspersed by sideways stuttering periods that kill you).
True, but that has nothing to do with commission and slippage. It has to do with the signal generation method, and is a reason why simple MA crossovers normally won't work, at least not without additional filters or other algorithms.

I remember we already had the same discussion here some months ago, about using frequency filters instead of moving averages. What I said at that time still stands, and we've meanwhile collected good profit with frequency filters, aside from other TA methods.
 
You seem to be missing the point. I am not arguing that delays are irrelevant or whatever. I am saying that simple cross-overs don't work when you add commission and slippage. But they actually do in the idealized world where there is no cost when you stutter step and enter in and out of a trade because of high frequency fluctuations and delayed entry exits. It is so easy to confirm this if you just ran it. Just run without costs and a simple cross-over is profitable. The results are so robust, almost any simulator or R-script can reproduce this.

Quote from jcl:

True, but that has nothing to do with commission and slippage. It has to do with the signal generation method, and is a reason why simple MA crossovers normally won't work, at least not without additional filters or other algorithms.

I remember we already had the same discussion here some months ago, about using frequency filters instead of moving averages. What I said at that time still stands, and I've meanwhile collected a lot of profit with frequency filters and similar methods.
 
Quote from ssrrkk:

You seem to be missing the point. I am not arguing that delays are irrelevant or whatever. I am saying that simple cross-overs don't work when you add commission and slippage. But they actually do in the idealized world where there is no cost when you stutter step and enter in and out of a trade because of high frequency fluctuations and delayed entry exits. It is so easy to confirm this if you just ran it. Just run without costs and a simple cross-over is profitable. The results are so robust, almost any simulator or R-script can reproduce this.
Ok, I'll do that in a couple minutes and will post the result here.
 
Quote from ssrrkk:

You seem to be missing the point. I am not arguing that delays are irrelevant or whatever. I am saying that simple cross-overs don't work when you add commission and slippage. But they actually do in the idealized world where there is no cost when you stutter step and enter in and out of a trade because of high frequency fluctuations and delayed entry exits. It is so easy to confirm this if you just ran it. Just run without costs and a simple cross-over is profitable. The results are so robust, almost any simulator or R-script can reproduce this.
Ok, I dont know how you tested it, but a simple test with an optimized MA crossover looks like this:

Code:
 function run()
{
	Spread = 0;
	Slippage = 0;
	Commission = 0;
	RollLong = 0;
	RollShort = 0;

	DataSplit = 80;
	
	var *Close = series(priceClose());
	var *MA1 = series(SMA(Close,optimize(100,10,1000)));
	var *MA2 = series(SMA(Close,optimize(300,30,3000)));
	Stop = 2*ATR(100);
	
	if(crossOver(MA2,MA1))
		enterLong();
	else if(crossUnder(MA2,MA1))
		enterShort();
}

It's an 80/20 out of sample test, 1 hour time frame, the two MA periods were optimized. All trading costs are zero. With EUR/USD, which is normally a rather trending asset, you get 93% loss on capital per year. Other assets won't fare better.

Any profit with such a system, in my opinion, is either a lucky year, or some test mistake, such as testing in-sample.
 
Can you plot the stock price, the MAs and the position of entry and exits?

Quote from jcl:

Ok, I dont know how you tested it, but a simple test with an optimized MA crossover looks like this:

Code:
 function run()
{
	Spread = 0;
	Slippage = 0;
	Commission = 0;
	RollLong = 0;
	RollShort = 0;

	DataSplit = 80;
	
	var *Close = series(priceClose());
	var *MA1 = series(SMA(Close,optimize(100,10,1000)));
	var *MA2 = series(SMA(Close,optimize(300,30,3000)));
	Stop = 2*ATR(100);
	
	if(crossOver(MA2,MA1))
		enterLong();
	else if(crossUnder(MA2,MA1))
		enterShort();
}

It's an 80/20 out of sample test, 1 hour time frame, the two MA periods were optimized. All trading costs are zero. With EUR/USD, which is normally a rather trending asset, you get 93% loss on capital per year. Other assets won't fare better.
 
Here is something I did over a year ago in R. It is a simple 30 minute cross on the SPX intraday, i.e., if the 30 minute SMA crosses the price, then enter or exit. PL curve attached.

lastmin = 388
simday = function(datestr,plotflag=FALSE) {

day = as.Date(datestr)
spxidx = spx$Date==day
flipvec = vector()
#print(spx$Date[spxidx])

totpl = 0.0
maxpl = 0.0
maxtime = 0
firstpos = 0.0
firsttime = 0
ncross = 0
if (sum(spxidx)==390) {
#print(as.Date(day,origin="1970-01-01"))
#flush.console()

open = spx$Open[spxidx]
high = spx$High[spxidx]
low = spx$Low[spxidx]
close = spx$Close[spxidx]
sma30 = spx$SMA30[spxidx]

status = "cash"
price = 0.0
for (imin in seq(sum(spxidx))) {

if (imin >= 40 && imin < lastmin) {

if (status!="short" && close[imin]<sma30[imin]) {

status = "short"
ncross = ncross+1
pl = 0.0
if (price>0.0) {
pl = (low[imin]-price)
totpl = totpl+pl
if (totpl>maxpl) {
maxpl = totpl
maxtime = imin
}
if (firsttime==0 && totpl>0) {
firsttime = imin
firstpos = totpl
}
}
price = low[imin]
print(paste("short",as.Date(day,origin="1970-01-01"),imin,price,pl,totpl))
flipvec = c(flipvec,imin)

}
if (status!="long" && close[imin]>sma30[imin]) {

status = "long"
ncross = ncross+1
pl = 0.0
if (price>0.0) {
pl = (price-high[imin])
totpl = totpl+pl
if (totpl>maxpl) {
maxpl = totpl
maxtime = imin
}
if (firsttime==0 && totpl>0) {
firsttime = imin
firstpos = totpl
}
}
price = high[imin]
print(paste("long",as.Date(day,origin="1970-01-01"),imin,price,pl,totpl))
flipvec = c(flipvec,imin)
}

}
}

# close positions at end of day
imin = lastmin
if (status=="long") {
pl = 0.0
if (price>0.0) {
pl = (low[imin]-price)
totpl = totpl+pl
}
if (totpl>maxpl) {
maxpl = totpl
maxtime = imin
}
if (firsttime==0 && totpl>0) {
firsttime = imin
firstpos = totpl
}
price = low[imin]
print(paste("eod close long",as.Date(day,origin="1970-01-01"),imin,price,pl,totpl))
flipvec = c(flipvec,imin)
}
else if (status=="short") {
pl = 0.0
if (price>0.0) {
pl = (price-high[imin])
totpl = totpl+pl
}
if (totpl>maxpl) {
maxpl = totpl
maxtime = imin
}
if (firsttime==0 && totpl>0) {
firsttime = imin
firstpos = totpl
}
price = high[imin]
print(paste("eod close short",as.Date(day,origin="1970-01-01"),imin,price,pl,totpl))
flipvec = c(flipvec,imin)
}

print(paste(as.Date(day,origin="1970-01-01"),ncross,totpl))
flush.console()

if (plotflag) {
plot(close,type="l",col="blue",main=datestr)
plot.xy(xy.coords(seq(length(close)),sma30),type="l",col="red")
abline(v=flipvec,col="green")
grid()
}
}
c(totpl,ncross,maxpl,maxtime,firstpos,firsttime)
}

spx = read.table("spx.csv",sep=",",stringsAsFactors=FALSE,header=TRUE)
spx$Date = as.Date(spx$Date,format="%m/%d/%Y")

datevec = unique(spx$Date)
ndays = length(datevec)
plvec = vector()
simdates = vector()
ncrossvec = vector()
maxplvec = vector()
maxtvec = vector()
firstplvec = vector()
firsttvec = vector()
for (day in datevec[1:ndays]) {

retvec = simday(as.character(as.Date(day,origin="1970-01-01")))
totpl = retvec[1]
ncross = retvec[2]
maxpl = retvec[3]
maxtime = retvec[4]
firstpl = retvec[5]
firstt = retvec[6]
if (totpl!=0.0) {
plvec = c(plvec,totpl)
simdates = c(simdates,as.Date(day,origin="1970-01-01"))
ncrossvec = c(ncrossvec,ncross)
maxplvec = c(maxplvec,maxpl)
maxtvec = c(maxtvec,maxtime)
firstplvec = c(firstplvec,firstpl)
firsttvec = c(firsttvec,firstt)
}

}

pldat = data.frame(date=as.Date(simdates,origin="1970-01-01"),pl=plvec,ncross=ncrossvec,maxpl=maxplvec,maxt=maxtvec,firstpl=firstplvec,firstt=firsttvec)
 

Attachments

Quote from oilfxpro:

Why hasn't anyone produced a software with algorithms ? your statement is incorrect , and you lack the knowledge about software and algos.

The professors probably took an independent view , and proved that 10,000 t/a rules worked and 10,000 did not work., so there was no benefit.

There are plenty of software sellers on this site , why don't they just license it out on commission basis with guaranteed profits?The softwares don't work consistently.

You really lack any kind of logical thinking.
If someone has something that really works, they will NEVER sell it (unless they're insane).
What you're suggesting is as if Apple should sell iPhone manufacturing rights along will patents for pennies - they're not insane so they manufacture it themselves and hold on to the profits.
 
Quote from ssrrkk:

Can you plot the stock price, the MAs and the position of entry and exits?
At first, I made a mistake with the code, I got the crossover the wrong way around - sorry for that. Here's the fixed code, with the MA plots:

Code:
function run()
{
	Spread = 0;
	Slippage = 0;
	Commission = 0;
	RollLong = 0;
	RollShort = 0;

	DataSplit = 80;
	
	var *Close = series(priceClose());
	var *MA1 = series(SMA(Close,optimize(100,10,1000)));
	var *MA2 = series(SMA(Close,optimize(300,30,3000)));
	Stop = 2*ATR(100);
	
	if(crossOver(MA1,MA2))
		enterLong();
	else if(crossUnder(MA1,MA2))
		enterShort();
	
	plot("MA1",*MA1,0,RED);
	plot("MA2",*MA2,0,BLUE);
}

And here's the chart:

MA_EURUSD.png


As you see, the fixed version ends indeed with a win, not with a loss, but it is obviously not a profitable strategy - the drawdown is larger than the profit, and the positive result was just random. The Sharpe Ratio is 0.39.
 
Back
Top