The ideal timeseries to trade - page 2

 
 

ok, great.

The more I read about autocorrelation (parametric/nonparametric) the more I'm starting to think that it is really usefull, but what we need is maybe a little less complex: the ideal timeseries for trading would have very clear trends; and what is a trend? higher highs and higher lows or lower highs and lower lows, so based on closing prices we could just calculate a sort of "trend score" of a rolling window (the length of the window is hard to define) where every close of a bar "in the same direction" gets a +1 score, and where a close in a different direction gets a -1 score and you start at zero at the beginning of the window. I know this sounds a lot like other trend-indicators but it's really raw, so easier to manipulate.

I'm reading more on nonparametric (no assumptions about probability distributions etc.) autocorrelation tests and I'll get back to you soon.

Looking forward to that Wealthlab code though

 
MrM:
ok, great.

The more I read about autocorrelation (parametric/nonparametric) the more I'm starting to think that it is really usefull, but what we need is maybe a little less complex: the ideal timeseries for trading would have very clear trends; and what is a trend? higher highs and higher lows or lower highs and lower lows, so based on closing prices we could just calculate a sort of "trend score" of a rolling window (the length of the window is hard to define) where every close of a bar "in the same direction" gets a +1 score, and where a close in a different direction gets a -1 score and you start at zero at the beginning of the window. I know this sounds a lot like other trend-indicators but it's really raw, so easier to manipulate.

I'm reading more on nonparametric (no assumptions about probability distributions etc.) autocorrelation tests and I'll get back to you soon.

Looking forward to that Wealthlab code though

Hi,

Here it is..and check this link too Traders Tips - May 2003

{ Declare Variables }

var E, Hurst, Bar, Period, SumDiff, FDIPane, EPane: integer;

var R, S, H: float;

Period := 200;

{ Create Custom Indicator Series }

Hurst := CreateSeries;

E := CreateSeries;

{ Our "E" Series is P/P[-1] }

for Bar := 1 to BarCount - 1 do

@E := PriceClose( Bar ) / PriceClose( Bar - 1 );

{ Calculate the sum of deviations over the period }

SumDiff := SumSeries( SubtractSeries( E, SMASeries( E, Period ) ), Period );

{ Plot deviation range }

EPane := CreatePane( 50, true, true );

HidePaneLines;

PlotSeries( HighestSeries( SumDiff, Period ), EPane, 474, #Thick );

PlotSeries( LowestSeries( SumDiff, Period ), EPane, 744, #Thick );

PlotSeries( SumDiff, EPane, #Silver, #Thick );

DrawLabel( 'Cumulative Deviation, and Range', EPane );

{ Calculate R/S and the Hurst Exponent }

for Bar := Period * 2 to BarCount - 1 do

begin

R := Highest( Bar, SumDiff, Period ) - Lowest( Bar, SumDiff, Period );

S := StdDev( Bar, E, Period );

@Hurst := LN( R / S ) / LN( Period );

end;

{ Plot Hurst Exponent }

FDIPane := CreatePane( 100, true, true );

PlotSeries( Hurst, FDIPane, #Navy, #Thick );

H := @Hurst;

DrawLabel( 'Hurst Exponent = ' + FormatFloat( '#0.000', H ), FDIPane );

DrawLabel( 'Random Walk = 0.500', FDIPane );

AddScanColumnStr( 'Hurst', FormatFloat( '#0.0000', @Hurst ) );

Regards

Simba

 

another Fractal Dimension definition

This is one of the ways (Waveforms) of calculating Fractal Dimension in Matlab: it's the code of an M file. Remember: H = 2 - D

{_FractalDim

Calculate the approximate Fractal Dimension of a waveform

Copyright (c) 2003 by Alex Matulich, Unicorn Research Corporation

January 2006: changed to calculate on n intervals rather than n-1.

Note: the Hurst exponent H = 2 - D, where D is the fractal dimension.

See the following article (particularly equation 6):

A procedure to Estimate the Fractal Dimension of Waveforms

Cevcik, Carlos, "A procedure to Estimate the Fractal Dimension of

Waveforms," International Complexity, Vol 5, 1998.

Because the lookback length n goes from 0 to n, we also have n

intervals, and not n-1 intervals as described in the paper.

}

Inputs:

y(NumericSeries), {price data, e.g. Close of data1}

n(NumericSimple); {lookback length}

Vars: j(0), lngth(0), ymax(0), ymin(0), yscl(0), dx2(0), dy(0);

ymin = Lowest(y, n); ymax = Highest(y, n); yscl = ymax - ymin;

if n < 2 Or ymax = ymin then

lngth = 1

else begin

{ calculate length of curve }

lngth = 0;

dx2 = Square(1/n);

for j = 1 To n begin

dy = (y[j] - y[j-1]) / yscl;

lngth = lngth + SquareRoot(dx2 + dy*dy);

end;

end;

_FractalDim = 1 + (Log(lngth) + Log(2)) / Log(2*n);

{Note: for large n, the result above converges to:

_FractalDim = 1 + Log(lngth) / Log(2*n);

However, because we typically using small values of n (like n<50)

for market analysis, we use the result with the Log(2) term in it.

See the technical article referenced in the opening comments.}

More can be found on Matlab's file exchange: The MathWorks - MATLAB Central - File Exchange

Another potentially usefull link is 2 archives in C where H is calculated in 2 different ways: the popular R/S & also the wavelet transform:

Estimating the Hurst Exponent

So would anyone be interested in taking a look at those two C archives and creating a custom indicator for Hurst exponent in those 2 ways?

I'm afraid I'm not a programmer..

 

No takers?

 
MrM:
No takers?

Ive been having a play with C and VB versions based on some of the papers you suggested. Have you got any test data sets that you've verified with Mathlab ?

 

Well no, because the theory around Hurst exponents is still developping, most papers speak of an estimation of H, and not a calculation: comparison between different calculation methods doesn't seem correct, but comparisons of Hurst exponents of different timeseries which were calculated with the same method seem to be a very valid tool.

Would you care to share your results?

 

Just a question

Has anyone range traded for months at a time? If so would it be logical to have alot of capital @ hand due to the possible long ranges of movement in the market? For example the trend for august is down would you lets say have S/L's, trailing stops and T/P's @ increments of a 100+pips at a time?

 
Pip Trip:
Hey - you're thinking way too much now. Currency trading is far too simple than this. People don't become casualties in this biz b/c they don't and/or can't get the entries/indicators/trends/etc. right.

It's ALL discipline. (Oh, how many threads are on this subject in any given forum? Next to none!)

[..snip..]

My piece of advice to you would be to throw a MACD and perhaps 2 MA's onto a chart, be disciplined, use stop losses that have a purpose, use take profit areas that have a purpose, and do the same thing every single time you place a trade.

I have heard this comment millions of times but in my oppinion it's exactly the human factor that gives you edge against those "very disciplined" traders.

Why do I think this? It's against all the books and everything!

It's quite simple actually. If discipline and few indicators would be enough, there would be millions of EAs that would provide constant profits (well all of them probably!). EAs don't have problem with discipline, they are most disciplined than you can ever be. Therefore problem with discipline is removed from the problem when you have EA's.

And still nobody makes money with EA that only has couple of MA's and MACD.

Edit: uh and sorry for making out of topic replies.. I'll try a little bit on the subject too (a bit only) :-)

Stephen Wolfram has written a book "new kind of sciece" where he goes through his ideas on how to predict chaos or generate very complex structures that cannot be predicted by normal means easily (like liquid movements etc) with cellular automata, ie. small programs that act with each other. I haven't read the book very thoughly (it has been on my bookself for couple of years and it's THICK!) but I think there might be a point in his comments that you can emulate or predict some models with many small simple programs that communicate together.

Stephen Wolfram: A New Kind of Science

Forex would be a very good target for this kind of experiment because there are so many actors that it's probably impossible to find a common indicator for all the different scenarios, every scenario is a complex mixture of different aspects and outside influences.

What I'm talking is a bit like neural network without the normal neuron connection, more like a neural network where each node is a specialized unit.

And yes, I know wolframs theories are quite contoversial but there is some good points behind them too.

 

Simplicity Vs Choas

while a junior member here, forex has been a long time trading occupation for me, and is all I do to keep the wolf from the door (well, there is a tactical shotgun also !) and I cannot say anything but that I must (from many years of experience) agree with Pip Trip.

Forex works on a principle of support and resistance, easily shown by most of the bands available, of which the LRC is my favorite. While "waves" and "quant" and advanced forms of entertaining calculus can be applied (and may or may not work well) in a DAY, a WEEK or a MONTH, a currency has support and resistance, just dependent on trend, and that trend can be a monthly, weekly, daily, or down to 5 mins or so ---- the beauty is that you get to pick your timeframe, and each one has different support and resistance point !

Forex aint rocket science . . . . . . . . come to think of it, rocket science aint that hard actually ----- aim, light the fuse and run away like mad !

I have no argument with "higher science" attempting to find the answers to forex, but as already stated its really kinda simple once you get the idea of how the banks are playing the game and what THEY are using to trade with and the direction theyre heading in at the moment !

enjoy and trade well

mp

Pip Trip:
Hey - you're thinking way too much now. Currency trading is far too simple than this. People don't become casualties in this biz b/c they don't and/or can't get the entries/indicators/trends/etc. right.

It's ALL discipline. (Oh, how many threads are on this subject in any given forum? Next to none!)

I like indicators. Most good ones can get you good entries/exits w/o even looking at the price. However, it's the mind stuff that gets me when I do get into trouble. Has NEVER been anything else. We spend WAY too much time feeding our addictions looking at charts, indicators, and past data. We pinpoint where we would've, could've, and should've gotten into trades when really it's only about trading live and from the right side of the chart.

My piece of advice to you would be to throw a MACD and perhaps 2 MA's onto a chart, be disciplined, use stop losses that have a purpose, use take profit areas that have a purpose, and do the same thing every single time you place a trade.

I say this not b/c I found this out on some silly website like Newbie Forex Factory but out of trading for a living, making lots of mistakes, and being successful.
Reason: