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

Re: [EquisMetaStock Group] TRAILING STOP LOSS



PureBytes Links

Trading Reference Links

OK, so this gives the all time high.  Well, then let us work with
that.  Suppose you want to use a level say 10% below this, then simply
use something like

StopLevel := 0.9 * X;

to get it.  Also, if you don't want the all time high, just the
highest high since entry, then simply reset it on entry.  Suppose you
have a variable, EnterLong, that becomes positive when you enter, then
simply do something like

X := Max( PREV, Y ) * ( EnterLong > 0 ) + Y * ( EnterLong <= 0 );

and the level will be equal to Y (probably the close) as long as you
are out.

Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com 


--- In equismetastock@xxxxxxxxxxxxxxx, "Sharad Lohia"
<sharadlohia@xxxx> wrote:
> Thanks for the suggestion but
> X := Max( Ref(X,-1), Y )
> does not provide the solution
> 
> and 
> X := Max( PREV, Y )
> gives the all the time high so far as the trailing stop loss level
for calculation.
> Thus each trade gets stopped out on the next bar.
> It does not reset for every long or short position. 
> 
> 
> Also - i want to program this condition - can someone help pls
> > 
> > if current position is long then....... if current position is
> square then .... if current position is short then ...
> > 
> > what is the function for checking the current position ?
> 
> Any clues ?
> 
> Regards
> 
> 
>   ----- Original Message ----- 
>   From: MG Ferreira 
>   To: equismetastock@xxxxxxxxxxxxxxx 
>   Sent: Tuesday, May 03, 2005 3:32 PM
>   Subject: Re: [EquisMetaStock Group] TRAILING STOP LOSS
> 
> 
>   Hi Sharad,
> 
>   How about using the Max function, something like
> 
>   X := Max( Ref(X,-1), Y )
> 
>   will let X either take on Y if it is higher than the current X or stay
>   at the current X.  You can also do the same using
> 
>   X := Max( PREV, Y )
> 
>   but this, I am told, is not good MS practise...
> 
>   Regards
>   MG Ferreira
>   TsaTsa EOD Programmer and trading model builder
>   http://www.ferra4models.com
>   http://fun.ferra4models.com 
> 
> 
>   --- In equismetastock@xxxxxxxxxxxxxxx, "Sharad Lohia"
>   <sharadlohia@xxxx> wrote:
>   > Dear all,
>   > 
>   > Is there a Bug with "Trailing Stop Loss" in metastock. It does not
>   seem to be working properly at all.
>   > 
>   > It should be programmable in Close Long / Short condition.
>   > 
>   > Hi:=ValueWhen(1,H>Ref(H,-1),H);
>   > this catches the last swing top - which need not be the highest high
>   in that particular long position.
>   > 
>   > Hi:=ValueWhen(1,H>Ref(Hi,-1),H);
>   > this also does not work.
>   > 
>   > How can i update a variable value only when a fresh value of higher
>   value is compared with its current value?
>   > 
>   > somethimes i feel excel is so much easier :-)
>   > 
>   > 
>   > Also - i want to program this condition - can someone help pls
>   > 
>   > if current position is long then....... if current position is
>   square then .... if current position is short then ...
>   > 
>   > what is the function for checking the current position ?
>   > 
>   > Thnx in advance
>   > 
>   > Regards
> 
> 
> 
> 
> 
> 
>    
>   Yahoo! Groups Links




------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/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/