Page 1 of 2

Anti Moving Averages Crossover Strategy

Posted: Wed Jun 07, 2006 8:19 pm
by heyen
Hello,

once again a different approach to mechanical trading systems.

I have always wondered, why a MA Crossover is supposed to signal a certain price trend.
When my long term ma crosses below my short term ma, then price can still go south. there is no reference to the vertical direction of price.
Also if i a triple ma system, then once the st crosses above the mt above the lt, the run might be exhausted.

everybody dreams of getting in at the "low"!!!

if i look for a reversal of a short term ma i do konw that price has reversed and is going up.

lets say DEMA[2]>DEMA[1]<DEMA than price has reversed from down trend to up trend. my smoothed ma tells me so.
if i know the stma is above the lt ma i also know its a general uptrend.

same goes for down trend reversal.

if i pinpoint entries by different time frames of the short and long term ma's and just use plain reversals for exit i get a money mashine intraday system.

just let the automatic optimization run over your historical date and see for yourself....

:-)

Any feedback of back tests is welcome.
Since i am using amibroker professional, no TS code - sorry.

If you'd like the amibroker code - PM!

Posted: Thu Jun 08, 2006 5:26 am
by blr121970
Please post the amibroker code.

Even though most of us are TS users we could still benefit from it.

Thanks,
Ryan

Posted: Thu Jun 08, 2006 10:39 pm
by blr121970
I converted your amibroker code to TS.

Looks good on a 1 min ER2:

Return on Initial Capital 2.21%
Annual Rate of Return 56.24%
Buy & Hold Return (2.06%)
Return on Account 168.70%
Avg. Monthly Return $1,105.00
Std. Deviation of Monthly Return $91.92

Code: Select all

// Original Author: Thomas Heyen
// Mechanical Trading Model ER2 - Emini Russel 2000
// Curve Fit June 2006
// Base Time Frame: 15 seconds
//
// Converted to TS strategy by
//            Ryan B. Saldanha (blr121970@yahoo.com)
// Base Time Frame(on TS): 1 minute
// -------------------------------------------------

Input:
    PositionSize  (1),
    MarginDeposit (1),
    perL          (40),
    perL0         (40),
    perL2         (60),
    per0          (50),
    per           (50),
    per2          (74);

Variables:
    MarketHours(false),
    MarketClose(false),
   up(false),
   down(false),
   fastup(false),
   fastdown(false),
   _Buy(false),
   _Cover(false),
   _Short(false),
   _Sell(false);

MarketHours = Time>=094000 AND Time<=154000;
MarketClose = Time>=154444 AND Time<=240000;

up          = (Average(C,perL) > Average(C,perL)[1])
              AND
              (Average(C,perL)[2] > Average(C,perL)[1]);

down        = (Average(C,per)<Average(C,per)[1])
              AND
              (Average(C,per)[2] < Average(C,per)[1]);

fastup      = (Average(C,perL0)>Average(C,perL0)[1])
              AND
              (Average(C,perL0)[2] > Average(C,perL0)[1]);

fastdown    = (Average(C,per0)<Average(C,per0)[1])
              AND
              (Average(C,per0)[2] < Average(C,per0)[1]);

_Buy        = up   AND (Average(C,per) > Average(C,perl2));
_Cover      = fastup;
_Short      = down AND (Average(C,per) < Average(C,per2));
_Sell       = fastdown;

If marketposition = 0 then
begin
   if _Buy then
      Buy this bar
   else if _Short then
      SellShort this bar;
end
else if  marketposition = 1 AND _Sell then
   Sell this bar
else if _Cover then
   BuyToCover this bar;

Posted: Fri Jun 09, 2006 3:45 pm
by blr121970
Attached is the strategy in ELD format.

Posted: Fri Jun 09, 2006 4:07 pm
by rrobin
For a 2 month old you are doing good.

Thanks for the code.

6 month old :P

rr

Posted: Tue Jun 27, 2006 5:59 pm
by geff
Hello, blr121970 and heyen. I tried ER2 1 min on TS with the posted ELD but it wasn't pretty.

What parameters did you use?
Date range?
Exchange Time?
Slippage/Commission?

Thanks, Jeff

Posted: Tue Jun 27, 2006 7:41 pm
by TheRumpledOne


I couldn't help myself!! :idea:

When I saw this thread and code, I thought I should write a SLOT MACHINE indicator for it. Then I decided to write it as a function that could be used in the POOR MAN'S SLOT MACHINE "PMSM" as an input!!

Which means you can also use it in the AUTO AVERY TRADE MANAGER and any other indicator that uses a function as input.

Ami Broker Code

Posted: Fri Jun 30, 2006 1:33 pm
by heyen
Since People haved asked for the AmiBroker code, here it is.

Code: Select all

PositionSize = MarginDeposit = 1;
MarketHours = TimeNum()>=094000 AND TimeNum()<=154000;
MarketClose= TimeNum()>=154100 AND TimeNum()<=240000;

perL0 = Optimize("fast long",40,15,90,5);
perL2 = perL0+Optimize("slow long",30,15,90,5);
per0 = Optimize("fast short",40,15,90,5);
per2 = per0+Optimize("slow short",30,15,90,5);

up= (MA(C,perL2)>Ref(MA(C,perL2),-1)) AND (Ref(MA(C,perL2),-2)>Ref(MA(C,perL2),-1));
down= (MA(C,per2)<Ref(MA(C,per2),-1)) AND (Ref(MA(C,per2),-2)<Ref(MA(C,per2),-1));
fastup= (MA(C,per0)>Ref(MA(C,per0),-1)) AND (Ref(MA(C,per0),-2)>Ref(MA(C,per0),-1));
fastdown= (MA(C,perL0)<Ref(MA(C,perL0),-1)) AND (Ref(MA(C,perL0),-2)<Ref(MA(C,perL0),-1));


Buy = markethours AND up AND (EMA(C,perL2)>MA(C,perL2));
Sell = marketclose OR fastdown;
Short = markethours AND down AND (EMA(C,per2)<MA(C,per2));
Cover = marketclose OR fastup;
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen);
PlotShapes(IIf(Short,shapeDownArrow,shapeNone),colorRed);
Lang = BarsSince(Buy) < BarsSince(Sell);
kurz = BarsSince(Short) < BarsSince(Cover);
//Plot Trading Ribbon
Color = IIf( Lang, colorGreen, IIf( kurz, colorRed, colorWhite ));
Plot( 1, "", Color, styleArea | styleOwnScale | styleNoLabel, 0, 15 );


Posted: Sat Jul 01, 2006 12:27 am
by fatdog1
Hi Heyen,

I hope you don't mind.
I read the thread and wanted to chime in.

For Tradestation users, here is a 5 minue workspace of the Russell with blue lines for support and orange lines for resistance between 650 and 780.

I put the lines on the hourly chart and changed it to a 5 minute chart. I will tighten them up to reflect the areas of S/R on the 5 minute chart depending which way the Russell moves next week.

The first area of resistance on a 5 minute chart is 733, but it is small.
740 will be harder to get past since it is big on a 60 minute chart.

725.50 is the first area of support on the 5 minute.

If the price starts to rise when you are near a blue line and the ma's cross, your long trade has a better chance of working out.

If the ma's cross and the price is near an orange line, use caution on new long positions. I personally won't enter long near a orange line if it is the first time back to that area.

If you are already long and have a profit, at least tighten up your stop near orange lines.
I also use those orange line areas to take partial profits on my longs.

An area like 740 would be a good place to enter a short if the ma's cross for an short trade entry signal.

You will get an alert the first time a line is touched.

TS Workspace

Posted: Sat Jul 01, 2006 8:17 pm
by heyen
Hello fatdog1,

could you please post a screenshot?
i dont use trade station, but amibroker pro.

thank you.