PureBytes Links
Trading Reference Links
|
> Can anyone explain why the oddball code below gives
> such good results for 1st quarter 2002 ?
According to my charts, it made $20575 between the close on 12/31/01
and 3/8/02. The original Oddball code made $25725. That's without
slippage or commission.
> If you chart it though it does not produce the sells I was hoping
> for, only the buys (and it labels them buy2's).
That's because you goofed in the code:
> Inputs: RL(7), BZ(3), SZ(1), BU(1), BD(1), Xaverage(20);
>
> If Close data1 < XAverage and RateOfChange(Close
> Data2, RL) > BZ Then Buy;
> If Close data1 > XAverage and RateOfChange(Close
> Data2, RL) > BZ Then Buy at high + BU Stop;
Note: Xaverage is a constant value of 20, NOT an Xaverage of length
20. So you're saying "If Close < 20 then buy; If Close > 20 then buy
on a stop." Obviously Close is always > 20, so you always buy on a
stop. Similarly you always sell at the close. If you change the
code to calculate an xaverage, it makes $9675 since 12/31/01.
Also, are you aware that buy/sell orders only stay active for the
next bar? So when you say "Buy at high + BU Stop", that order takes
effect only if the price exceeds the order price on the VERY NEXT
BAR. If you want it to stay in effect until the price hits it, you
have to store the stop price in a variable and re-issue it on every
bar. And check to see if the price hits it & clear the variable (and
stop issuing the order) if so, etc etc. It's a pain but that's the
way EL works.
Gary
|