[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another way to answer to Mr Gaius



PureBytes Links

Trading Reference Links

was: Re : Another way of using Keltner Channels

Dans un courrier daté du 04/10/98 01:27:14  , Gaius Marius écrit :

<< Suj :	 Another way of using Keltner Channels
 Date :	04/10/98 01:27:14  
 From:	magnus@xxxxxxxxxxx (Gaius Marius)
 Reply-to:	magnus@xxxxxxxxxxx (Gaius Marius)
 To:	Omega-List@xxxxxxxxxx
 
 Here's another system I've created a long time ago that uses Keltner
 channels as supplements to the main system.  Essentially, we use William
 Blau's TSI to trigger the trade and when the prices moves beyond the Upper
 or Lower Keltner Channels, we add a second position to the first trade.
 --------------------------------------------
 First thing you're gonna need is the following function (based on William
 Blau's book," Momentun, Divergence and Direction"):
>>

OK
Thanks for the code, but this is a chance for me to make you learn something:
Your code below is a perfect example of the erors  that can produce strange
result that you shameless attribute to Omega.
You make an abuse of Xaverage imbicated code  without measuring the effects
of the initialisation period.
This effect  is more obvious when you use Xaverage(Xaverage(  and  I do not
want to speak of the formula below, where you use twince the imbricated
Xaverage in the numerator, but also in the divisor!!

As the Xaverage in the divisor use C-C[1] (ie a small value, even 0) you will
have serious initialisation problem.
And the small value in the divisor produced high jumps in  MTM at the
initialisation, making it very difficult to quickly stabilize.


MTM=Xaverage(Xaverage(Close-Close[1],R),S)/Xaverage( XAverage(AbsValue(Close
 -Close[1]),R),S);

Any small difference (one tick missing) during the initialisation period will
certainly produce a different performance summary  during the initialisation
phase, and this is probably what explains your different results in your big
system that should use a lot of imbricated recursive functions.

But there is  more to come:
Later, you will use your MTM function in the system and applu again a fifth
Xaverage on it:!

Avg=XAverage(MTM(R,S),Q);

Useless to say that the effect is more obvious with this last one.
The effect will be at its maximum because of the MTM unstable initialisation
(see above)

Not to speak of the 4 other Xaverage for Upper and Lower.

This does not mean that your code is wrong, this means that it will take dozen
and dozen of bars to stabilize.

There are other ways to write imbricated xaverage without producing this kind
of error.

I think that we can now put your bug request into the OmegaBug.doc file that
contains a lot like this one  and that I proved to be wrong to this list years
ago (check the archives).

Knowing his own errors is the starting point of widsom, do not forget it.
I have made myself enough mistakes in my life to know what I'm speaking
about....

Rgds

-Pierre Orphelin
www.sirtrade.com

===============================your
code========================================


 {function: MTM}
 Input: R(Numeric),S(Numeric);
 
 if close-close[1]<>0 then
 MTM=Xaverage(Xaverage(Close-Close[1],R),S)/Xaverage( XAverage(AbsValue(Close
 -Close[1]),R),S);
 
 --------------------------------------------
 {System: Keltner TSI}
 Inputs: R(21),S(12),Q(6),Len(25),Fc(1.75),Extra(1);
 Vars: Mo(0),Avg(0),Upper(0),Lower(0),Ncontr(0),Mp(0);
 
 Ncontr=1;                                        {Number of Contracts to
 trade is initialized to 1}
 Mo=MTM(R,S);
 Avg=XAverage(MTM(R,S),Q);
 Upper=XAverage(Close,Len)+Fc*XAverage(TrueRange,Len);
 Lower=XAverage(Close,Len)-Fc*XAverage(TrueRange,Len);
 Mp=MarketPosition;
 
 If Mp<>1 and Mo crosses above Avg then buy ncontr contracts on close;
 If MP=1 and Close crosses above Upper then buy Extra contracts on close;
 If MP<>-1 and Mo crosses below Avg then sell ncontr contracts on close;
 If MP=-1 and Close crosses below Lower then sell Extra contracts on close;