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

Re: Simple Easy Language Code



PureBytes Links

Trading Reference Links

At 2:08 AM +0200 5/13/01, Charles Strong wrote:

>Thanks for your comments.  I substituted highest high and lowest low but
>that didn't seem to work either.  Any ideas?  I get multiple buys and sells all
>clumped together.
>
>Inputs: BZ(2), SZ(1);
>
>Sell at highest(high,50) - (highest(high,50)* (sz*.01)) stop;
>
>buy at lowest(low,50) +  (lowest(low,50)* (bz*.01)) stop;


Bill Wynne described the problem correctly.

But I am guessing that you want to sell at some amount below the tops, etc.

The trouble with the Highest(High, XX) function is that it searches back in time to a high. What I think you want is to move forward in time keeping track of new highs.

The following code should do that:

Bob Fulks

---

Inputs: BZ(2), SZ(1);

Vars: HHigh(0), LLow(0), MP(0);

MP = MarketPosition;

HHigh = iff(High > HHigh or MP <> MP[1], High, HHigh);
LLow  = iff(Low  < LLow  or MP <> MP[1], Low,  LLow);

if MP >= 0 then Sell next bar at HHigh * (1 - 0.01 * SZ) stop;
if MP <= 0 then Buy  next bar at LLow  * (1 + 0.01 * BZ) stop;