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

[EquisMetaStock Group] Re: anyone know how to plot a trailing stop only while in a trade?



PureBytes Links

Trading Reference Links

Mike,

Here's a modified version of the indicator:

{BarBack Z}
{Will draw a line from one High to the next---back in time}
{Reference highs are also displayed within the window}
len:=Input("Periods for Ref High(Set > Barsback)",3,700,15);
Signal:=Ref(H,-len);
Barbk:=Input("Barsback High",0,700,2);
Signal2:=Ref(H,-Barbk);
LastBar:=Cum(1)=LastValue(Cum(1)-(len));
bacdis1:=ValueWhen(1,LastBar,LastValue(Signal));
1stRefPnt:=Ref(Ref(bacdis1,-Barbk),Barbk);
{end}
bacdis2:=ValueWhen(1,LastBar,LastValue(Signal2));
2ndRefPnt:=Ref(Ref(bacdis2,-Barbk),Barbk);
{end}
{Line Plot }
D1:=LastValue(Cum(1))-LastValue(LEN);
{D1 is first high of line}
D2:=LastValue(Cum(1))-LastValue(BARBK);
{D2 is last high of line}
P1:=1stRefPnt; {start-of-line data array}
P2:=2ndRefPnt; {end-of-line data array}
V1:=ValueWhen(1,D1,P1);
V2:=ValueWhen(1,D2,P2);
B1:=LastValue(Cum(1))-D1;
B2:=LastValue(Cum(1))-D2;
LINE:=V1-(BarsSince(Cum(1)=D1)*( (V1-V2)/(B1-B2)));
LINE;

1stRefPnt; 
2ndRefPnt;
x:=Mov(C,3,S);
y:=If(line>1,x,x);
y;
{end}

When plotted this will plot the high and low horizontal line and a 
slope from those points. It also will plot the "x" variable[Mov
(C,3,S)] during the same period of time.

I realize this is not quite what you're looking for because it is not 
automatic but it may be possible to get get it to become automatic 
with some additional work. 

Just some thoughts,

Preston

 



--- In equismetastock@xxxxxxxxxxxxxxx, "Mike Sloane" <mfsloane@xxxx> 
wrote:
> Hi Preston,
>  
> I remember following that thread and I have just checked the 
archive.
>  
> I believe the main difference is that your barsback was designed to 
plot
> a LINE in response to various inputs.
>  
> What I am looking for is a way to tell MetaStock to only plot a 
variable
> function when certain conditions (not defined by the user, but 
defined
> by a custom indicator) are met, and I can't see immediately how your
> LINE formula could help with that; it may be that I can't see the 
wood
> for the trees!!
>  
> I have had a bit of a fiddle with it since posting the original 
request
> and have found that I can mask the LOW (or HIGH for a short) plot on
> days when I am not in a trade by overlaying an extra custom 
indicator
> that plots the low in WHITE (or whatever background colour I use); 
only
> problem is it overlays on top of the price candles (yes . . . I am 
one
> of people who happen to like candles); so I tried CUTTING the base
> security our of the chart and then PASTING it back in; it works - 
the
> candles come back in over the top of the custom indicators and the 
MASK
> and it comes close to what I am looking for; I just end up with a 
few
> funny tails at the transition between the start and end points of a
> trade. Would still like to find a way to do it in formula language 
tho'.
>  
> Thanks for the heads up on your earlier thread.
>  
> Regards,
> Mike



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/BefplB/TM
---------------------------------------------------------------------~->

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/