PureBytes Links
Trading Reference Links
|
Roy,
I'll certainly try your ideas. The only problem is that I don't
understand PREV. I submitted an earlier post asking how to determine
exactly what variable, formula, constant, data array, etc, etc, was
calculated by PREV.
I got only one response (suggesting I should use Ref() instead), so
it seems to me that other people also have difficulty in
understanding PREV. Except you, of course :-).
(As an aside, my inability to understand PREV hinders me in trying to
understand your Pegasus indicators, which are full of PREVs. For
example:
X:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-X)+K*X);
)
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 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/
|