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

Re: Market Position



PureBytes Links

Trading Reference Links

{Conditions:
-If not in the market I want to go long or short at value A or B.
-If Long I want to go short at value Y else short at B.
-If Short I want to go long at value Z else long at A.}

{assignINPUT} A:=Input("Long value A",1,10000,1);
{assignINPUT} B:=Input("Short value B",1,10000,1);
{assignINPUT} Y:=Input("S/L Short value Y",1,10000,1);
{assignINPUT} Z:=Input("S/L Long value Z",1,10000,1);
{assignCOND} Longform:=(C>=Z);
{assignCOND} Shortform:=(C<=Y);
{assignPOS}Pos1:=Ref(
                                    If({cond} Ref(Longform,-1)=+1{true},{then}+1{long},
                                    {else}
                                    If({cond} Ref(Shortform,-1)=-1{true},{then}-1{short},
                                    {else}0)),-1);
{assignPOS}Pos2:=Ref(
                                    If({cond}(C>=A)=+1{true},+1{long},
                                    {else}
                                    If({cond}(C<=B)=+1{true},-1{short},
                                    {else}0)),-1);
If({cond}(Pos1 or Pos2)=+1{true},{then}Shortform{short},
{else}
If({cond}(Pos1 or Pos2)=-1{true},{then}Longform{long},
{else}
If({cond}C>=A{true},{then}+1{long},
{else}
If({cond}C<=B{true},{then}-1{short},
{else}0))))

{---------------------------------------------}

Version 1.0
It is only a first quick shot at it (and from an indicator angle upose to a SysTest), so
this formula too (see another mail this weekend) might need some adjustments
here and there. It's only suppose to be a Binairy Wave for now, giving you a +1 when
Long and -1 when Short and 0 when out, eg a "Flip-neutral-Flop" biwave indicator.

Regards,
Ton Maas
ms-irb@xxxxxxxxxxxxxxxx
Dismiss the ".nospam" bit (including the dot) when replying.
Homepage  http://home.planet.nl/~anthmaas


----- Original Message ----- 
From: Jeff Rawson
To: <metastock@xxxxxxxxxxxxx>
Sent: zondag 6 februari 2000 19:53
Subject: Market Position


> Hi,
> 
> I am new to the List and new to Metastock.  I am attempting to write my 
> first system test in version 6.52.  What I don't know is how to test for my 
> market position.  If I am not in the market I want to go long or short at 
> value A or B.  If I am Long I want to go short at value Y and if I am short 
> I want to go long at value Z.
> 
> If Long then Sell at Y else Sell at B.
> 
> If Short then Buy at Z else Buy at A.
> 
> Thanks   Jeff