PureBytes Links
Trading Reference Links
|
Hi Kevin
My opinions about forward referencing are not shared by everyone, and I accept that.
Your code for "Category 3 High" and "Category 3 Low" will not plot for the last 3 bars of a chart,
and that illustrates one of my reasons for not using forward references. The indicator value for the
latest bar cannot be known until 3 more bars of data are available. That situation is only visible
at the "Hard Right Edge", but it applies across the whole chart. Changing the code to the following
(eliminating the forward references) ensures that all data is available for the plot on any given
bar.
{Category 3 High}
Cat3H:=ValueWhen(1,
Ref(H,-6) < Ref(H,-3) AND
Ref(H,-5) < Ref(H,-3) AND
Ref(H,-4) <= Ref(H,-3) AND
Ref(H,-2) <= Ref(H,-3) AND
Ref(H,-1) < Ref(H,-3) AND
H < Ref(H,-3), Ref(H,-3));
Cat3H;
I haven't tested a forward referencing scenario in the Enhanced System Tester, but I know that the
old System Tester would happily accept forward references and report results that were unattainable
in real life. The Explorer will return an N/A result unless a forward reference is compensated for
by an equal or greater backward reference (delay, or negative reference).
I trust this helps explain why a forward reference has no place in the MetaStock formulas I write.
Kind regards
Roy Larsen
www.metastocktips.co.nz
Free formulas and MS links
> I apologise for the late response to your note. I have been down in Spain
> and my internet access was by way of two cans and piece of string.
>
> First though, a caveat: the strategy that Clayburg describes in his book is
> a discretionary trading system. However, I have discovered from experience
> that discretionary trading is not my forte and so, as has recently been
> mentioned many times on this forum, I have adapted it to suit my own
> trading style, i.e. fully automated. In order to facilitate this, I have
> converted the indicators to give binary signals. Here is the code for the
> %R indicator; the other indicators that Clayburg describes can be adapted
> in the same way.
>
> Create an indicator called Clay%R.
>
> A1:=WillR(50); {Fast}
> A2:=WillR(75); {Slow}
>
> SIGNAL:=If(A1<-88 AND A2<-70 AND Cross(A1,Ref(A1,-1)),-1,If(A1>-12 AND
> A2>-30 AND Cross(Ref(A1,-1),A1),1,0));
> SIGNAL;
>
> {The following code is only necessary for display purposes if required}
>
> {Slow Overbought Window Open}
>
> OBWO:=If(A2>-30,1,0);
>
> {Slow Oversold Window Open}
>
> OSWO:=If(A2<-70,-1,0);
>
> OBWO;
> OSWO;
>
> Drag the indicator into a new window and display OSWO and OBWO in line
> style and SIGNAL in histogram style. If you then compare this indicator to
> the normal %R plot (with the same parameters), it should be clear what is
> going on.
>
> Next, we need to create a flag indicating that conditions for trade entry
> have been met pending our entry price being hit. I shall just give you the
> code here for a long trade. By the way, thanks to Roy and Heitor for
> helping me to finesse the flag.
>
> Clay%RLongFlag
>
> LongFlagSet:=If(FmlVar("Clay%R","SIGNAL")=-1,1,0);
> LongFlagReset:=H > FmlVar("Clayburg Cat3 H&L Stops","CAT3H")
> OR
> FmlVar("Clay%R","SIGNAL")=1;
> Init:=Cum(LongFlagSet+LongFlagReset>-1)=1;
> LongFlag:=BarsSince(Init+LongFlagSet)<BarsSince(Init+LongFlagReset);
> LongFlag:=Alert(LongFlag,2);
> LongFlag;
>
> Open Clay%RLongFlag in a new window and display in histogram style.
>
> Now we need to identify the price level at which we will enter a trade.
> Create an indicator called Clayburg Cat3 H&L Stops. You will know that
> there are also category 1 and category 2 stop levels. The code can easily
> be amended accordingly.
>
> WARNING: Roy has pointed out in his recent newsletter that it is not good
> programming style to use forward references (e.g. Ref(H,+1) ) in MS
> formulas. I'm sure that he is right. However, I couldn't easily achieve my
> objective in this case any other way. I would most certainly suggest that
> you take Roy's advice in preference to mine.
>
> Clayburg Cat3 H&L Stops
>
> {Category 3 High}
>
> Cat3H:=
>
> ValueWhen(1,
> Ref(H,-3) < H AND
> Ref(H,-2) < H AND
> Ref(H,-1) <= H AND
> Ref(H,+1) <= H AND
> Ref(H,+2) < H AND
> Ref(H,+3) < H, H);
>
> {Category 3 Low}
>
> Cat3L:=
>
> ValueWhen(1,
> Ref(L,-3) > L AND
> Ref(L,-2) > L AND
> Ref(L,-1) > L AND
> Ref(L,+1) > L AND
> Ref(L,+2) > L AND
> Ref(L,+3) > L,L);
>
> Cat3H;
> Cat3L;
>
> Drag this indicator on to the price chart and you will be able to see where
> your long stop buy trade should be placed provided the Clay%RLongFlag is
> set. You can then decide upon your exit strategy. Try a Cat2 stop to begin
> with.
>
> Now, just test on your favourite stocks and enjoy. If you need any help
> putting together the system test code, let me know.
>
> Regards,
> Kevin
>
>
>
> At 09:38 07/10/2004 +1000, you wrote:
>>Hi Kevin, have also read his book and would like to see your version of
>>his indicators as you offered.
>>
>>regards keith
>>
>>Yahoo! Groups Sponsor
>>ADVERTISEMENT
>>
>>
>>----------
>>Yahoo! Groups Links
>> * To visit your group on the web, go to:
>> *
>> <http://groups.yahoo.com/group/Metastockusers/>http://groups.yahoo.com/gro
>> up/Metastockusers/
>> *
>> * To unsubscribe from this group, send an email to:
>> *
>> <mailto:Metastockusers-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>Met
>> astockusers-unsubscribe@xxxxxxxxxxxxxxx
>> *
>> * Your use of Yahoo! Groups is subject to the
>> <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
>>
>>
>>--
>>This message has been scanned for viruses and
>>dangerous content by <http://www.hostplus.co.uk?from=MailScanner/>HostPlus
>>MailScanner,
>>and is believed to be clean.
>
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/zMEolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Metastockusers/
<*> To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|