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

[EquisMetaStock Group] Re: Stop loss



PureBytes Links

Trading Reference Links

Hi Roy,

I've been trying to understand your latch-based stop.  I feel as if 
I'm disappearing up my own asymptote, but I'd prefer to work things 
out for myself if I can.

If you could assert some binary responses (Y,N) to the following, I 
can use your answers to figure out what's happening.

(This is your formula:

{PREV Latch Exercise}
Set:=Cross(Mov(C,15,E), Mov(C,25,E));
Reset:=Cross(Mov(C,25,E), Mov(C,15,E));
Trade:=If(PREV<=0,If(Set,1,0),
If( Reset {independent exit} OR
C>=ValueWhen(1,PREV=0,C)*1.2 {20% profit exit} OR
C<=ValueWhen(1,PREV=0,C)*0.9 {10% loss exit} ,-1,1));
Abs(Trade)*ValueWhen(1,Ref(Trade=0,-1),C); {trade active/entry price}
)

Q: When is Trade = -1? {a sell}
A: Only when Trade(-1) = 1 AND (Reset = 1 OR C>20% profit OR C<10% 
stop)
In Queen's English:  a sell can only follow a buy, and only if the 
EMA signal crossed down, or 20% profit, or 10% loss.

Q:  When is Trade = 1? {a buy}
A:  If (a) Trade(-1) = 0 or -1 AND Set = 1
In English:  When the previous trade was a sell, or neutral (neutral 
itself can only occur after a sell or another neutral) and EMA 
crossed up.

Q: What is ValueWhen doing?
A: We want the closing price of the bar for which the immediately 
previous bar was the last occurrence of Trade=0 {did you get that?}


Regards,
Alan


--- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx> 
wrote:
> Alan
> 
> > At my delicate stage of development, it seems to me that "LOW"
> > and "Ref(LOW,-1)" would be recalculated daily, which is not what I
> > want.  For example, if the low were 20 on the day that the buy
> > conditions were satisfied, I would want it to stay at 20 (at least
> > until I start it trailing).  Am I correct in saying that it would 
be
> > recalculated daily?
> 
> I think this has been mentioned in a subsequent post already but 
you can use the ValueWhen()
> function to hold a value from one event to the next. Unfortunately 
this is not a total solution
> because an unwanted second or third event will change the returned 
value prematurely. This is where
> the use of a PREV function may be required. It allows the storing 
of a value from an entry signal
> until either an external exit signal OR an entry related condition 
occurs.
> 
> How you code this will depend on exactly what it is you are wanting 
to do.
> 
> I think that the Simulation dll functions may also be able to be 
used for what you want to do. I
> haven't studied it yet so I'm not sure what it's potential uses 
are. Check it out.
> 
> Here's an example of how you can use a PREV based latch to remember 
an entry value. It doesn't have
> to be the entry price, it could just as easily be a relevant ATR or 
RSI value. Notice that the value
> is not stored in the latch itself ('Trade' variable) but 
is "reconstituted" using ValueWhen(). It
> takes at least one additional PREV to store the value inside 
the 'Trade' variable, and that's why I
> prefer to have the latch function only using 1, 0 and -1.  Minus 1 
is not necessary either as far as
> that goes but it's useful though not critical.
> 
> The 'Trade' variable can be reset either by using the 
external 'Reset' or internally by referencing
> some current value to some value at the time of the first 'Set' 
signal. There are a zillion
> variations you can do with this.
> 
>   {PREV Latch Exercise}
> Set:=Cross(Mov(C,15,E), Mov(C,25,E));
> Reset:=Cross(Mov(C,25,E), Mov(C,15,E));
> Trade:=If(PREV<=0,If(Set,1,0),
>   If( Reset {independent exit} OR
>     C>=ValueWhen(1,PREV=0,C)*1.2 {20% profit exit} OR
>     C<=ValueWhen(1,PREV=0,C)*0.9  {10% loss exit} ,-1,1));
> Abs(Trade)*ValueWhen(1,Ref(Trade=0,-1),C);  {trade active/entry 
price}
> 
> 
> 
> 
> Roy



------------------------ 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
---------------------------------------------------------------------~->

 
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/