|
This competition is now closed.
Below is the original indicator code solution.
|
MetaStock -> Tools -> Indicator Builder -> New
-> Copy & Paste complete MS indicator code below.
====================
Month's High & Low signals
====================
---8<---------------------------------------------------
{ Month's High & Low signals}
{Signals are dynamic in last incomplete month. }
{ Copyright © 2005-2007 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }
{ line 1: Start of month }
nuMonth:=Month()<>Ref(Month(),-1) OR Cum(1)=2;
{ line 2: Alternative month binary }
altMth:=Cum(nuMonth)/2=Int(Cum(nuMonth)/2);
{ line 3: Dynamic Month's High }
Hi:=HighestSince(1,nuMonth,H);
{ line 4: Dynamic Month's Low }
Lo:=LowestSince(1,nuMonth,L);
{ line 5: Hindsight Month's Peak }
pk:=Zig(If(altMth,Hi=H,-(Hi=H)),1.5,$);
{ line 6: Hindsight Month's Trough }
tr:=Zig(If(altMth,Lo=L,-(Lo=L)),1.5,$);
{ line 7: Plot hindsight High signals }
Abs(pk)=1 AND Cum(1)>2;
{ line 8: Plot hindsight Low signals }
-(Abs(tr)=1 AND Cum(1)>2)
---8<---------------------------------------------------
|
|
|
Alternative solution, using minimal code
|
MetaStock -> Tools -> Indicator Builder -> New
-> Copy & Paste complete MS indicator code below.
===========================
Month's Hi/Lo Signals - minimal code
===========================
---8<---------------------------------------------------
{ Monthly High/Low signals in retrospect - v1.7 }
{ Complete signals in 162 code characters }
{ With thanks to Wabbit for the 3rd line of code }
{ Copyright © 2005-2007 Jose Silva }
{ For personal use only }
{ http://www.metastocktools.com }
{11} m:=Month();
{27} a:=m<>Ref(m,-1)+(Cum(1)=2);
{21} b:=Mod(Cum(a),2)*2-1;
{12} x:=Cum(1)>2;
{45} x*Abs(Zig(b*(H>=HighestSince(1,a,H)),2,$))=1;
{46} -(x*Abs(Zig(b*(L<=LowestSince(1,a,L)),2,$))=1)
---8<---------------------------------------------------
|
|
|