PureBytes Links
Trading Reference Links
|
Re "Ref(bingo,3)", forward-referencing has at least two inherent
problems:
1) Each forward-referenced period introduces a null or N/A bar to the
final MS plot;
2) Forward-referencing signals gives an unfair advantage to those
traders that have a window into future events. ')
The MS code below resolves problem #1:
=====================================
Forward-referencing without null bars
=====================================
---8<-----------------------------------------
{ Signal forward-referencing without null bars }
{ ©Copyright 2005 Jose Silva.
The grant of this license is for personal use
only - no resale or repackaging allowed.
All code remains the property of Jose Silva.
http://www.metastocktools.com }
{ User input }
plot:=Input("Signals: [1]Hindsight, [2]Real-time, [3]Both",1,3,1);
{ Example - "Category III resistance" }
L1:=Ref(H,-6);L2:=Ref(H,-5);L3:=Ref(H,-4);
PP:=Ref(H,-3);R1:=Ref(H,-2);R2:=Ref(H,-1);R3:=H;
{ Original signal }
real:=PP>L1 AND PP>L2 AND PP>L3 AND PP>R1
AND PP>R2 AND PP>R3;
{ Forward-referenced signal }
x:=real-(HHV(H,3)>Ref(HHV(H,3),-1))+1;
count:=Cum(IsDefined(x));
hindsight:=Zig(x-(count=1),1.5,$)=0
AND count>1 AND count<>LastValue(count);
{ Plot in own window }
If(plot=1,hindsight,
If(plot=2,real,hindsight-real))
---8<-----------------------------------------
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, "awlaimeng" <awlaimeng@xxxx>
wrote:
> I have created an indicator that will trigger signal when a Category
> 3 resistance pattern is formed.
>
> For the benefits of other user, a Category 3 resistance pattern is
> formed when the 3 bars immediately prior to and immediately after
> the pivotal bar must have their highs that are lower than the high
> of the bar pinpointing the Category 3 resistance.
>
> |
> | |
> | |
> | |
>
> The codes for my indicator are as below:
>
> {Category 3 Resistance}
> L1:=Ref(H,-6);
> L2:=Ref(H,-5);
> L3:=Ref(H,-4);
> PP:=Ref(H,-3);
> R1:=Ref(H,-2);
> R2:=Ref(H,-1);
> R3:=HIGH;
> bingo:=PP>L1 AND PP>L2 AND PP>L3 AND PP>R1 AND PP>R2 AND PP>R3;
> bingo
>
> My indicator plots a vertical line on same day (that means 7th. day)
> when the "bingo" statement is true. However I wanted the indicator
> to plot the vertical line on the same day as the bar pinpointing the
> Category 3 resistance (in this case the 4th. bar). I was able to
> "force" the indicator to do that by replacing the code "bingo" with
> "Ref(bingo,3)".
>
> I would appreciate comment whether the code "Ref(bingo,3)" is the
> proper way.
>
> Regards,
> ALM
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/BefplB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|