PureBytes Links
Trading Reference Links
|
Thanx Roy, sorry not 2 come back 2 U sooner but I've been trying 2
get my head around the PREV command. Also, I think I may B losing my
vision, how I couldn't C the Value When command in the manual when
it's in alphabetical order is beyond me. Humble apologies!
I'm assuming that the PREV comand applies itself to the nearest
previous indicator or expression in the code so I think what your
code does is the following:
If the previous occurrence of Trade <= 0 then
set Trade to the value of EnterLong
else
if (close >= the most recent open * 1.2 when Trade = 0
or close >= the most recent open 0.9 when Trade = 0
or CloseLong =1 then
set Trade to -1
else
set Trade to +1
Frankly, I'm still not sure what 'Trade < 0;' & 'Abs(Trade)*ValueWhen
(1,Trade+Alert(Trade=0,2)=2,O); actually does as the Trade variable
is being set in the previous command.
That being said, I've used my own 'Enterlong' code & the indicator
works a treat if the last Abs line is commented out, I'm just not
completely sure how. ;~}
Cheers
Steve H
--- In Metastockusers@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx>
wrote:
> Steve
>
> > I know this has been covered B4, but having searched the archives
4
> > 'storing open' I couldn't find the relevant question which is...
in MS
> > 7.x EOD, how can U store the open on the day that U open a trade.
> >
> > 'Valuewhen' isn't available in 7.x but I'm sure Henry or Roy have
> > answered this question B4. Unfortunately I forgot 2 archive the
answer.
> > :~{ I just want 2 set up an indicator 2 tell me when a trade has
been
> > 10% successful so far, so need 2 compare the current low 2 the
open on
> > the start of the trade.
>
> You can actually use ValueWhen() in 7.2, but it's not a great idea
because a second entry signal
> before your exit target is met results in the ValueWhen() stored
value being set to a new (unwanted)
> level.
>
> The best way to manage an exit based on an entry price or entry-
derived value is to use a PREV based
> latch. A PREV latch can either store the value directly, or to
reduce the minimum number of PREVs
> from three to two you can store binary values zero and one (minus
one is optional). How that works
> is a ValueWhen() follows the latch to pick up the entry price to
plot for following code.
>
> The beauty of a PREV based latch is that the exits can be entry
related or independent of the entry,
> users choice. The example that follows doesn't have an independent
exit, but it has a 20% gain and
> 10% loss exit. There are any number of ways this can be configured,
but remember that each entry
> related exit requires another PREV.
>
> EnterLong:=Cross(Mov(C,15,E),Mov(C,25,E));
> CloseLong:=0;
> Trade:=If(PREV<=0,EnterLong, {entry}
> If(C>=ValueWhen(1,PREV=0,O)*1.2 OR {exit}
> C<=ValueWhen(1,PREV=0,O)*0.9 OR {exit}
> CloseLong {exit} ,-1,1));
> Trade<0; {latch reset}
> Abs(Trade)*ValueWhen(1,Trade+Alert(Trade=0,2)=2,O);
>
> Hope this helps some.
>
> Roy
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/zMEolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Metastockusers/
<*> To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|