2008 performance graph of Hershey Rockets as per above code <img src=http://www.elitetrader.com/vb/attachment.php?s=&postid=2260027>
The code below is from the thread in automated trading : http://www.elitetrader.com/vb/showthread.php?s=&threadid=147441 I have added the threshold lookup tables for suppression regarding MACD and volume as suggested therein. Code: inputs:volumethreshold(0),macdThreshold(0); { CashCow automated trading system Architect: Jack Hershey Version 0.3 12 Dec 2008 New functionality: Context Supression Logic. Diagnostic Module. New enhancements: Better organized code structure for natural reading. Bug fixes: none } //Data Module variables: Stoch5FastK( 0 ), Stoch5FastD( 0 ), Stoch5SlowK( 0 ), Stoch5SlowD( 0 ), Stoch14FastK( 0 ), Stoch14FastD( 0 ), Stoch14SlowK( 0 ), Stoch14SlowD( 0 ), MACDVal( 0 ), MACDMA( 0 ), MACDDiff( 0 ), TimeOK(False), VolumeOK(False), CurrentbarOK(False), LongOK(False), ShortOK(False), DateOK(False); //Formula Module Value1 = Stochastic( H, L, C, 5, 2, 3, 1, Stoch5FastK, Stoch5FastD, Stoch5SlowK, Stoch5SlowD ) ; Value2 = Stochastic( H, L, C, 14, 1, 3, 1, Stoch14FastK, Stoch14FastD, Stoch14SlowK, Stoch14SlowD ) ; MACDVal = MACD( Close, 5, 13 ) ; MACDMA = XAverage( MACDVal, 6 ) ; MACDDiff = MACDVal - MACDMA ; //Context Supression Logic if Time > 845 and Time < 1500 then TimeOK = True else TimeOK = False; if Volume of 1 bar ago > volumethreshold then VolumeOK = True else VolumeOK = False; if currentbar > 2 then CurrentbarOK = True else CurrentbarOK = False; if MACDDiff > macdthreshold then LongOK = true else LongOK = false; //Needs to be validated and then tuned. if MACDDiff < macdThreshold*-1 then ShortOK = true else ShortOK = false; //Needs to be validated and then tuned. DateOK = true; //Only used during testing phase. if CurrentBarOK and TimeOK and DateOK then begin //Entry Logic if VolumeOK then //enter only when volume greater than 'Medium' begin if LongOK and Stoch5FastK crosses above 50 and Stoch5FastK > Stoch5FastD and marketposition = 0 then Buy ( "S5FKLE" ) 1 contract this bar at close ; if ShortOK and Stoch5FastK crosses below 50 and Stoch5FastK < Stoch5FastD and marketposition = 0 then Sellshort ( "S5FKSE" ) 1 contract this bar at close ; end; //Reverse logic If VolumeOK then begin if ShortOK and marketposition > 0 and Stoch5FastK crosses below 50 then sellshort ( "S5FKRS" ) 1 contracts this bar at close ; if LongOK and marketposition < 0 and Stoch5FastK crosses above 50 then buy ( "S5FKRL" ) 1 contracts this bar at close ; end; //Exit Logic { Hold Logic. Tee up stub for later. if absvalue( MACDVal ) < 1.4 then } if {(Stoch14SlowK < Stoch14SlowD) and} (Stoch14SlowK crosses below 80) and marketposition > 0 then Sell ( "S14SKLX" ) 1 contract this bar at close ; if {(Stoch14SlowK > Stoch14SlowD) and} (Stoch14SlowK crosses above 20) and marketposition < 0 then buytocover ( "S14SKSX" ) 1 contract this bar at close ; if marketposition > 0 and Stoch14SlowK crosses below Stoch14SlowD then sell ( "S14KDLX" ) 1 contract this bar at close ; if marketposition < 0 and Stoch14SlowK crosses above Stoch14SlowD then buytocover ( "S14KDSX" ) 1 contract this bar at close ; if marketposition > 0 and Stoch5FastK crosses below 50 then sell ( "S5FKSX" ) 1 contracts this bar at close ; if marketposition < 0 and Stoch5FastK crosses above 50 then buytocover ( "S5FKLX" ) 1 contracts this bar at close ; //Diagnostic Module {Remove brackets and define date to enable. if date = 1081210 then Print(File("c:\log.txt"), time, Stoch5FastK, Stoch5FastD, Stoch5SlowK, Stoch5SlowD, Stoch14FastK, Stoch14FastD, Stoch14SlowK, Stoch14SlowD, MACDVal, MACDMA, MACDDiff, " ",Volume[0]); if date = 1081210 then Print(Stoch5FastK, Stoch5FastD, Stoch5SlowK, Stoch5SlowD, Stoch14FastK, Stoch14FastD, Stoch14SlowK, Stoch14SlowD, MACDVal, MACDMA, MACDDiff, " ",Volume[0]); } end; //End of Day Module if Time > 1500 and marketposition > 0 then sell ( "EODLX" ) next bar at market; if Time > 1500 and marketposition < 0 then buytocover ( "EODSX" ) next bar at market;
results with MACD and Volume threshold nullified, i.e. = 0 over the past 100 days in the ES contract.
The performance graph of the last 100 days of cash cow version 5 with no MACD or Volume suppression attached.
Cash Cow version 5 with Volume and MACD suppression as tested over the previous 100 days does not show any tendency to profitablity. Perhaps the entwining filter which has not been coded is really the "secret sauce" which makes the Hershey method using indicators profitable. OR perhaps its all BS as I am wont to speculate. As I stated in the thread it all comes down to the ambiguous entwining filter which I do not believe can be coded. Entwining is a definition which relies on the ability to see all the data which should be excluded. You only know entwining has occurred after the fact by seeing that numerous excursions revert to the mean and "entwine".
Chart is pretty consistent. All you need for a good system is consistency. If it makes money, play it, if it loses money, reverse it and play it that way. DUH!!!!