logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
draggie  
#1 Posted : Tuesday, November 8, 2005 3:00:08 AM(UTC)
draggie

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 8/23/2005(UTC)
Posts: 7

Hi everyone - my first post. I've been having a look at various trend-identification or trend-valuation indicators. I had the thought to build an MA which was sensitive to the strength of the underlying trend such that, should the trend's strength fall below a particular threshold, the MA would flatline until the trend reversed or re-emerged. So far, so good. Well, not so good, really, as it has exceeded the level of my skill to program it! Apart from that, I had thought to make the MA cycle- or volatility-dependent, and would appreciate any thoughts on that too. Opinions and help gratefully received.
Jose  
#2 Posted : Tuesday, November 8, 2005 5:13:42 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Try the EMA-cycle indicator - "cycle-adaptive EMA - periodicity determined by historical price cycles". jose '-)
draggie  
#3 Posted : Tuesday, November 8, 2005 6:12:08 AM(UTC)
draggie

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 8/23/2005(UTC)
Posts: 7

Thanks Jose, Not surprisingly, yours were two of the MA's I was looking at; both cycle- and volatility- adaptive, but I had also thought to have a look at an Ehlers-derived periods value as well. Which brings in an aside - what's the 'magic' in ATR(10), but ADX(14)? Obviously these default values are based on first-order optimisation in days of yore. Wouldn't it be better to examine whether, for any particular indicator or oscillator, we want to capture 1/4, 1/2 or 1 cycle? Any thoughts on that? More to the point, however, was that I was looking at how to code for the flatline. As always, my ideas seem to run well ahead of my coding ability: but that doesn't say much for my ideas, either! Kind regards
Jose  
#4 Posted : Tuesday, November 8, 2005 7:52:19 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
There is actually little or no magic in the chosen indicator periods, within a reasonable period range of course. With a stop based on the ATR(10) [which BTW is the same as Mov(ATR(1),19,E)], the ATR multiplier is the main effective parameter. Multiplier * ATR(10) or ATR(20) makes little difference. This can be seen clearly when using charting software such as AmiBroker, which allows real-time adjusting of parameters using sliders (i.e., the chart's stop changes in real-time as the parameters are adjusted). This is also something that requires very fast & efficient software, perhaps something that we will never see in MetaStock, unless it is rebuilt from the ground up. [code:1:93b953dce1] ==================== AmiBroker - ATR Stop ==================== ---8<---------------------------- _SECTION_BEGIN("Price"); Plot(Close,"Price",colorPaleGreen,128); _SECTION_END(); _SECTION_BEGIN("ATR_Stop"); //ATR Stop GraphXSpace =5; pds = Param("ATR periods",10,2,63,1); multi = Param("ATR multiplier",2,0,10,0.1); myATR = ATR( pds ); result[ 0 ] = Close[ 0 ]; for( i = 1 ; i < BarCount; i++) {if( Close[ i ] > result[ i - 1]) {temp = Close[ i ] - multi * myATR[ i ]; if( temp > result[ i - 1 ] ) result[ i ] = temp; else result[ i ] = result[ i - 1 ]; } else result[ i ] = Close[ i ]; } Plot(Result,"ATR Stop",colorRed,1); Plot(Close,"Close",colorBlack,128); _SECTION_END(); ---8<---------------------------- [/code:1:93b953dce1] jose '-)
draggie  
#5 Posted : Tuesday, November 8, 2005 9:43:42 PM(UTC)
draggie

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 8/23/2005(UTC)
Posts: 7

Thanks for your forbearance Jose, This has rapidly turned into an exploration of the inadequacies of my understanding, even if it gets me no nearer my goal. Please understand if I seem a bit sloooow. As you can see, I've been lurking for a while, and have followed the discussion on making indicators 'adaptive' using a variable 'pds'. Both the ASI.dll and the Forum.dll offer this ability, and from there it's but a short step, I would have thought, to optimisation based on that variable 'pds'. If I'm right, what you're saying is that the more 'processed' an indicator is - and ATR is a prime case because it's internally smoothed before we do the (10) bit - the less apparent will be the effect of any optimisation process, and that we could safely limit optimisation to lookback periods - ref, HHV etc - and the length of primary and secondary MA's, as well as the coefficients in things like HHV-2*ATR. Is this where you're coming from? Am out for the rest of the day. I look forward to your response on this, as well as my original problem - which I think might lie in my self-confidence rather than actual degree of difficulty. :-s Cheers
Jose  
#6 Posted : Wednesday, November 9, 2005 5:53:27 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Draggie, what I'm trying to say is keep things simple where possible. Don't worry too much about optimizing indicators to historical trends, because the trend cycles themselves are not regular. The same applies to any kind of optimizing process. Averaging historical trend cycles is not unlike averaging historical weather patterns: average rainfall over x years is not going to give an accurate prediction of tomorrow's weather. jose '-)
draggie  
#7 Posted : Monday, November 14, 2005 9:00:51 PM(UTC)
draggie

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 8/23/2005(UTC)
Posts: 7

Hi Jose. Point taken about optimising; but how do you reconcile that with, for instance, the ASI homodyne cycle finder? Are we talking about 'adaptive' rather than 'optimised' here. Aren't adaptive indicators self-optimising? Anyways, I must admit to being a little scared of 'Prev'; but here's my effort at what I'm trying to do: x:=Mov(C,20,E); y:= Fml("Trend - normalised"); If(y<50,x,PREV) Of course, it's the last line that gets me: what I'm trying to do is, when the trend drops off, have x flatline at its crrent value until a new trend emerges. Any pointers? Cheers!
Jose  
#8 Posted : Monday, November 14, 2005 10:50:32 PM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
draggie wrote:
but how do you reconcile that with, for instance, the ASI homodyne cycle finder?
You'll have to ask Brad (the ASI.dll developer) about that.
draggie wrote:
Aren't adaptive indicators self-optimising?
I don't know about the term "adaptive" - I would think "variable input" may be more appropriate.
draggie wrote:
x:=Mov(C,20,E); y:= Fml("Trend - normalised"); If(y<50,x,PREV) Of course, it's the last line that gets me: what I'm trying to do is, when the trend drops off, have x flatline at its crrent value until a new trend emerges. Any pointers?
Try using the ValueWhen() function for this purpose. jose '-)
draggie  
#9 Posted : Monday, November 21, 2005 1:03:17 AM(UTC)
draggie

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 8/23/2005(UTC)
Posts: 7

Remarkably easy when you've been shown how. Thanks Jose. {Trend-sensitive MA} x:=ExtFml("ASI.HomodyneCyclePeriod","PDS") ; y:=Fml("Trend Strength - (normalised)"); z:=ExtFml("forumdll.varmov",L, x, e); If(y>50,z,ValueWhen(1,y>50,z)); I'd still like to pick your brains on variable periods for MA-based indicators, though. Your weather analogy is a good place to start, as I feel it's a close parallel of TA. While we can't predict, we can look back and see when similar occurrences occurred. Then, by induction, we can make a stab at what is more likely to happen on a repeat of the setup. I liked reading some stuff by John Ehlers, which approached the question of trend vs range as one of signal vs noise. The homodyne period is derived from his work. At this stage you'd realise that I've just pulled in a non-optimised (or non-adaptive) TS, which incorporates 2 EMAs - 10 and 20. Many of your own indicator averages default at 21. As I said before, I think that perhaps a little more science could be applied here to derive some meaningful values for those EMAs; but I'm throwing that out to the forum to see what advice or expertise might be around. Many thanks again for your help!
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.