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

Re: Easy Lang Help



PureBytes Links

Trading Reference Links

> I want to create a setup: SlowK crosses below 90 and then sell
> when a low takes out the previous low. 
> 
> "If L < L[1]" doesn't work because if the market first rallies, I
> want to sell a low that takes out the previous low, even though it
> may be higher than when the SlowK crossed below 10. 

Right.  "L<L[1]" just says "if this bar's low is lower than the 
previous bar's low."  That's not what you want -- you want the 
"previous low."

First you have to define what you mean by "previous low."  The low at 
the time SlowK crosses below 90?  The previous swing low before the 
SlowK crossing?

For purposes of illustration I'll be lazy and assume you mean the low 
at the time SlowK crossed below 90.

Having defined that, you then have to REMEMBER that "previous low" 
value and compare the current low to THAT value.

For example:

        Vars: Slo(0), RecentLow(999999);
        Slo = SlowK(whatever);
        if (Slo crosses under 90) then RecentLow = Low;
        
        if Low < RecentLow then sell;

You also have to decide when to CLEAR the value of RecentLow.  Does 
it stay in force until you sell, or until the next time SlowK crosses 
under 90, or does it "expire" after N bars, or...?  Whenever you 
decide the old value of RecentLow has expired, reset it to 999999 so 
the "if Low < RecentLow" test will fail until you set it to a new 
valid value.

Gary




  • Follow-Ups: