Here's the new code if anybody is interested. You'll have to reply with quote to read it, I'm not formatting this thing again. Basically all I did was add
shorted=random(2);
and changed the long entry conditional to:
if shorted < 1 then
I also changed the initialization of shorted to zero from false, and doc-ed out the code that set shorted to false and true.
Here's the entire code:
vars: Shorted(0);
if marketposition=0 then
begin;
shorted=random(2);
// print(" <<< ",shorted," >>> ");
if time<1500 then
begin;
if shorted<1 then
begin;
buy next bar at open;
// shorted=false;
end
else
begin;
sell short next bar at open;
// shorted=true;
end;
end;
end
else if marketposition>0 then
begin;
if close<close[1] then sell this bar at close;
end
else if marketposition<0 then
begin;
if close>close[1] then buy to cover this bar at close;
end;
Trial from 4/5/2002 to 7/15/2005 on YM 5 minute chart that opens at 9:30 ET and closes at 4pm ET. No commisions, no slippage
Run #1
17800 trades
-$20,445.00 gross results
33.47% net profitable
-$1.15 average/trade
8871 long trades
8929 short trades
Run #2
17652 trades
-11,435.00 gross results
34.28% profitable
-$0.65 average/trade
8950 long trades
8702 short trades
Run #3
17696 trades
-$25,375.00 gross results
33.81% profitable
-$1.43 average/trade
8774 long trades
8922 short trades
Must be a lucky coin around here someplace. Let's try some more.
Run #4
17742 trades
-$28,505.00 gross results
33.56% profitable
-$1.61 average/trade
8806 long trades
8936 short trades
Run #5
17804 trades
-$26,085.00 gross results
33.27% profitable
-$1.47 average/trade
8796 long trades
9008 short trades
Run #6
17754 trades
-$16,285.00 gross results (woah! This could be the best one)
34.02% profitable
-$.92 average/trade (or maybe not, we should get one that's at least in the low -.70s if we try enough times)
8950 long trades
8804 short trades
Run #7
17767 trades
-$20230.00 gross results
33.74% profitable
-$1.14 average/trade
8863 long trades
8904 short trades
Not looking good there, champ. We're into the home stretch now.
Run #8
17786 trades
-$17,990.00 gross results
33.46% profitable
-$1.01 average/trade
8831 long trades
8955 short trades
Run #9
17854 trades
-$34,100.00 gross results (ouch!)
32.91% profitable
-$1.91 average/trade
8925 long trades
8929 short trades
Well, we're up to the last run (my drink is nearly empty and I gotta refill). So far, we've made a lot of applesauce.
Run #10
17731 trades
-$18810.00 gross results
34.18% profitable
-$1.06 average/trade
8915 long trades
8816 short trades
There ya go, 10 runs with the "new and improved" random method. And what a surprise, it's still a loser.