Universal Trend Trading

Discussion in 'Journals' started by luckyputanski, Aug 4, 2011.

  1. Yeah, this entire thread is pure incompetent bunk.
     
    #311     Aug 13, 2012
  2. Show me a strategy profitable on dozens different markets, over 40 years of data, with drawdown shorter than a year.
     
    #312     Aug 14, 2012
  3. jcl

    jcl

    The strategy with the equity curve posted above trades profitable on 14 different markets. Within the 10 years that I tested it, all drawdowns were shorter than a year. I can show you the algorithm if you want, it's rather simple.

    I didn't test it with 40 years data because that would make no sense: trend trading today requires very different strategies than 40 years ago. Even within the 10 years, the parameters must be recalculated every 4 months. The markets change permanently and backtests from 20 or 40 years ago are meaningless.
     
    #313     Aug 14, 2012
  4. If it's not a secret, post the strategy here. Also, I don't take results from 40 years ago too seriously, but it's good to know that my edge existed back then.
     
    #314     Aug 14, 2012
  5. jcl

    jcl

    It's no secret, I have the code also on my website. It's a general trend trading strategy compound with a long-term and a short-term trend algorithm, and variants with modifications and different time frames. The two basic entry functions are (in lite-C):

    Code:
    function trend_slow()
    {
    	var *Price = series(price());
    	var *Trend = series(LowPass(Price,optimize(250,100,1000)));
    	
    	if(valley(Trend)) 
    		enterLong();
    	else if(peak(Trend)) 
    		enterShort();
    }
    
    function trend_fast()
    {
    	var *Price = series(price());
    	var TimeFactor	= optimize(1.2,0.25,4);
    	var Threshold	= optimize(1.0,0.1,2,0.1);
    
    	int TimePeriod = TimeFactor*DominantPeriod(Price,100);
    	var *HP = series(HighPass(Price,TimePeriod));
    	var *Signal = series(Fisher(HP,500));
    	
    	if(valley(Signal) && *Signal < -Threshold) 
    		enterLong();
    	else if(peak(Signal) && *Signal > Threshold) 
    		enterShort();
    }
    HighPass() and LowPass() are standard 2-pole highpass and lowpass filters, DominantPeriod() is the main cycle of the price curve, Fisher() is the Fisher transform, and peak() and valley() detect peaks and valleys in the series.

    The exit functions are a little more lengthy, but the strategy also stays profitable when using a simple stop loss instead.
     
    #315     Aug 15, 2012
  6. Can you post full code in C so I can backtest it?
     
    #316     Aug 16, 2012
  7. jcl

    jcl

    This is the C code for a lowpass filter:
    Code:
    inline var smoothF(int period) { return 2./(period+1); }
    
    var LowPass(var *Data,int Period)
    {
    	var* LP = series(*Data,3);
    	var a = smoothF(Period);
    	var a2 = a*a;
    	return LP[0] = (a-a2/4)*Data[0]
    		+ 0.5*a2*Data[1]
    		- (a-0.75*a2)*Data[2]
    		+ 2*(1.-a)*LP[1]
    		- (1.-a)*(1.-a)*LP[2];
    }
    
    The code of the other functions is more lengthy and integrated in the Zorro software, so I can't as easily post it here. But you can get the complete software, it's public domain and available for download on request. It has a backtester. I'm not allowed to post a link here, but you can just PM me.
     
    #317     Aug 16, 2012
  8. Opened long UsdJpy @ 79.41
    Opened long Nikkei @ 9195
    Opened long Oil @ 95.86
    Opened long GbpJpy @ 124.68

    Account Value 229k
     
    #318     Aug 20, 2012
  9. Closed long DJIA with profit +2.2k

    Account Value 230k
     
    #319     Aug 20, 2012
  10. Opened short on Silver @ 29.00

    Account Value 220k
     
    #320     Aug 21, 2012