Page 1 of 1
BabyPips.com Cowabunga Strategy....
Posted: Mon Nov 19, 2007 6:40 am
by whittakerj
Hello everyone,
I've been a huge fan of the forum and I've been reading about all of TRO's indicators and trying to learn them. I attempted to write a strategy that followed BabyPips.com Cowabunga system. I'm curious if I can get some feedback, it doesn't look all to promising to me but then again I'm an amateur to Tradestation and I'm not sure it's programmed 100% correctly. Any feedback, thoughts, suggestions, fixes would be great. Thanks in advance.
link
Posted: Mon Nov 19, 2007 6:45 am
by whittakerj
I wanted to post a link to the strategy for those of you that are not familiar with it.
Cowabunga
Posted: Mon Nov 19, 2007 9:24 pm
by gmoney
I see a few things that don't match the website. I'll look at it this holiday weekend and get back to you.
Posted: Mon Nov 19, 2007 10:02 pm
by whittakerj
gmoney wrote:I see a few things that don't match the website. I'll look at it this holiday weekend and get back to you.
That would be great...Like I said I'm new to Tradestation so I wasn't sure how to do a couple of things. For one I know the exits are off. I just made those inputs. I was thinking something along the lines of
short exit = highest high of the last 10 bars
long exit = lowest low of the last 10 bars.
I just wasn't sure about the correct syntax.
TS strategy code
Posted: Fri Nov 23, 2007 3:56 pm
by gmoney
Here is the code I came up with. This meets the general method the website describes for the entries and stops. I didn't address the profit targets. Can't promise this is perfect and it certainly is not the most elegant coding but here you go! I had to come up with new trading time code since I am in Arizona and the start time is the previous day.
Code: Select all
//Write code to emulate http://www.BabyPips.com Cowabunga system.
//Adjust inputs based on currency decimals example is for GBPUSD
//TP is take profit and SL is stop loss optimized back two years with intrabar at 1 minute.
//For questions or corrections: ME @ Jeremy Whittaker dot com
//modified by gmoney 11/23/07
inputs: numContracts(1),starttradetime(2300),endtradetime(1200),TP(.0080),SL(.0040);
variables: MyMACD( 0 ), MACDAvg( 0 ), MACDDiff( 0 ),oFastK( 0 ), oFastD( 0 ), oSlowK( 0 ), oSlowD( 0 ),
SlowK2(0), SlowD2(0), sellstop(0), buytocoverstop(999999);
MyMACD = MACD( Close, 12,26) ;
MACDAvg = XAverage( MyMACD,9) ;
MACDDiff = MyMACD - MACDAvg ;
Value1 = Stochastic( H, L, C, 10, 3, 3, 1, oFastK, oFastD, oSlowK, oSlowD ) ;
SlowK2 = SlowK(10) data2;
SlowD2 = SlowD(10) data2;
if marketposition = 0 then
begin
sellstop = 0;
buytocoverstop = 999999;
end;
//setup trading times
IF STARTTRADETIME > ENDTRADETIME THEN IF (TIME > STARTTRADETIME OR TIME < ENDTRADETIME) THEN
CONDITION99 = TRUE;
IF STARTTRADETIME < ENDTRADETIME THEN IF (TIME > STARTTRADETIME AND TIME < ENDTRADETIME) THEN
CONDITION99 = TRUE;
IF CONDITION99 THEN
BEGIN
//long entries
//data2 (240 min) setup for longs
condition1 =
(Xaverage(close,5) > Xaverage(close,10)) data2 and
rsi(close,9) data2 > 50 and
SlowK2 > SlowK2[1] and SlowD2 > SlowD2[1];
//data1 (15 min) setup for longs
condition3 =
MACDDiff[1] < 0 and
MACDDiff > MACDDiff[1] and //MACDDiff[1] > MACDDiff[2] and
oSlowK > oSlowK[1] and oSlowD > oSlowD[1] and
oSlowD < 80 and
rsi(close,9) > 50;
if Xaverage(close,5) crosses over Xaverage(close,10) and condition1 and condition3 then
buy ("LE") numContracts contracts next bar market;
//short entries
//data2 (240 min) setup for shorts
condition2 =
(Xaverage(close,5) < Xaverage(close,10)) data2 and
rsi(close,9) data2 < 50 and
SlowK2 < SlowK2[1] and SlowD2 < SlowD2[1];
//data1 (15 min) setup for shorts
condition4 =
MACDDiff[1] > 0 and
MACDDiff < MACDDiff[1] and //MACDDiff[1] < MACDDiff[2] and
oSlowK < oSlowK[1] and oSlowD < oSlowD[1] and
oSlowD > 20 and
rsi(close,9) < 50;
if Xaverage(close,5) crosses under Xaverage(close,10) and condition2 and condition4 then
sellshort ("SE") numContracts contracts next bar market;
END;
//Exits
SetStopContract;
SetProfitTarget(TP);
//SetStopLoss(SL);
if marketposition = 1 and barssinceentry = 1 then sellstop = lowest(l,10);
if marketposition = -1 and barssinceentry = 1 then buytocoverstop = highest(h,10);
if marketposition = 1 then sell next bar at sellstop stop;
if marketposition = -1 then buytocover next bar at buytocoverstop stop;
if time = endtradetime then
begin
sell next bar market;
buytocover next bar market;
end;