PureBytes Links
Trading Reference Links
|
Ton,
Tut, tut.... you of all people should have picked up what's
wrong here.
PREV probably *should* work like this but it doesn't
PREV gives you the previous value of the current expression
NOT THE PREVIOUS VALUE OF THE INDICATOR.
A simple test will prove that to anyone who doubts this.
Try:
vPrev:=PREV;
If(Cum(1) < 50,Cum(1),vPrev);
Versus:
If(Cum(1) < 50,Cum(1),PREV);
Cheers
Jeff.
>
> If the List had a Mail of the Year competition, I'd vote for your mail.
> Formula wise you are definitely getting the hang of it.
>
snip
> >
> > Anyway, here is how the code (at least this iteration) should be modified to
> > speed up the calculation by a factor of 5. Basically, we move PREV into a
> > variable vPREV prior to using it (so that it is only calculate once) in the
> > long and short exits. Here is the code for the long exit. I tested it with
> > the sample Entry Rule and receive the same results in 1/5th the time. Just
> > modify the SHORT exit in the same way. Hope this helps everyone using it.
> >
> > {DEFINE ENTRY PRICE, WITH EXIT BEING -- ENTRY PRICE AND NO TRADE BEING 0}
> > {Move PREV into a variable to speed things up - DB 2/17/00}
> > vPREV:=PREV;
> > EntryPrice:= If(vPREV <= 0,
> > {Trade entered today?}
> > If(LongEntry, CLOSE, 0),
> > {Trade entered before today. Stopped today?}
> > If(LOW <= vPREV - MoneyMgmtStop, -vPREV,
> > If(LOW <= HighestSince(1,vPREV=0, HIGH) - 3 * ATR(10), -vPREV,
> > If(LOW <= HighestSince(1,vPREV=0, CLOSE) - 2.5 * ATR(10), -vPREV,
> > vPREV))));
> >
> >
> > David
|