No Trend Band

trading strategies and money management discussion, code, results

Moderator: moderators

User avatar
heyen
rank: <50 posts
rank: <50 posts
Posts: 20
Joined: Fri May 19, 2006 10:41 am
Reputation: 0
Location: Germany
Gender: Male

No Trend Band

Postby heyen » Wed Jun 07, 2006 11:12 am

Hello,

i am testing an approach to sideways markets.

The ER2 Future moves very volatile sideways.

The idea is to create a delayed band around a moving average.
If price leaves the band it may be trending.
But if price moves back in the band, chances are it will go to the other side -
oscillating, moving sideways.

I do not have enough historical data yet to establish a long term proof.
But my 5 days ("curve fit" i know) is incredible.

Since i work with Amibroker Professional i wont post codes.
The model is fairly easy to remodel in TradeStation.
I have fit my model to the ER2.

Upper Band: lagging EMA + offset
Lower Band: lagging EMA - offset

Entry long: price crosses Lower Band from below
Exit long: price crossed Upper Band from below

Entry short: price crosses Upper Band from above
Exit short: price crosses Lower Band from above

Risk: Price trends within this Band.
A proper trend stop must be implemented.

Attached is a screenshot.

This did not work for ES or NQ well, just the ER2.

I thought i'd share it for evaluation.
Please dont use without proper backtesting!

Oh, i forgot: my timeframe here: 15 seconds.
Attachments
notrendband.jpg
notrendband.jpg (197.73 KiB) Viewed 366 times

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
blr121970
rank: <50 posts
rank: <50 posts
Posts: 23
Joined: Mon May 22, 2006 1:55 am
Reputation: 0
Location: Irvine, California
Gender: Male

Postby blr121970 » Fri Jun 09, 2006 12:50 am

Don't know how to export ELDs yet since I am a 2-month old TS user
[schild=11 fontcolor=000000 shadowcolor=C0C0C0 shieldshadow=1]Help![/schild]

TS Function (DEMA):

Code: Select all

// --------------------------------------------------------------
// SYNTAX     dema( ARRAY, periods )
// RETURNS    ARRAY
// FUNCTION Calculates double exponentially smoothed average - DEMA.
// The function accepts time-variable periods.
//
// http://www.amibroker.com/guide/afl/afl_view.php?id=42
//
// DEMA can be implemented via EMA:
//
// Len=10;
// Graph0= 2 * EMA( C, len ) - EMA( EMA( C, len ), Len );
// for comparison only
// Graph1=DEMA(C,Len)
// --------------------------------------------------------------

Input:
   ClosePrice(Numeric),
   Len(Numeric);

DEMA = 2 * XAverage(ClosePrice, Len) - XAverage(XAverage(ClosePrice, Len), Len);



TS Strategy [SidewaysTrndngRevBnd]:

Code: Select all

// ------------------------------------------------------------------
// This is the sideways trending reversal band strategy
//
// Original Author   : Thomas Heyen
//
// Converted to TS by: Ryan B. Saldanha (blr121970@yahoo.com)
//
// Base Time Frame(on TS): 10 minutes (tested on @ER2.D)
// ------------------------------------------------------------------
Input:
    lfast       (3),
    llag        (25),
    lband       (2.3),
    sfast       (7),
    slag        (17),
    sband       (2.3);

Variables:
    lp          (lfast * 4),
    sp          (lfast * 4),
    labove      (0),
    lopen       (0.0),
    sabove      (0),
    sopen       (0),
    markethours (false),
    marketclose (false),
    _buy        (false),
    _cover      (false),
    _short      (false),
    _sell       (false),
    _stop       (0);

// --------------------------------------------
// Modify this to accomodate you local time
// --------------------------------------------
markethours = Time >= 0900 AND Time <= 1500;
marketclose = Time >= 1544 AND Time <= 2400;

// --------------------------------------------
// sideways trending reversal band
// --------------------------------------------
labove = DEMA(C,lp)[llag] - lband;
lopen  = DEMA(C,lp)[llag] + lband;

sabove = DEMA(C,lp)[slag] - sband;
sopen  = DEMA(C,lp)[slag] + sband;

_stop  = 0;
_buy   = (DEMA(C,lfast) crosses above labove)
         AND
         Markethours;

_short = (sopen crosses above DEMA(C,sfast))
         AND
         Markethours;

_sell  = (labove crosses above DEMA(C,lfast))
         OR
         (DEMA(C,lfast) crosses above lopen)
         OR
         marketclose
         OR
         _short;

_cover = (DEMA(C,sfast) crosses above sopen)
         OR
         (sabove crosses above DEMA(C,sfast))
         OR
         marketclose
         OR
         _buy;

_stop  = Iff((_buy OR _short), C[1], _stop[1]);

_sell  = (_stop>0)
         AND
         (C<_stop);

_cover = (_stop>0)
         AND
         (C>_stop);

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;

User avatar
michal.kreslik
rank: 1000+ posts
rank: 1000+ posts
Posts: 1032
Joined: Sat May 13, 2006 2:40 am
Reputation: 0
Location: Monte Carlo, Monaco
Real name: Michal Kreslik
Gender: Male
Contact:

Postby michal.kreslik » Fri Jun 09, 2006 9:48 am

blr,

to export ELD in Tradestation, hit File > Import/Export EasyLanguage > Export EasyLanguage Documents file (ELD)

User avatar
blr121970
rank: <50 posts
rank: <50 posts
Posts: 23
Joined: Mon May 22, 2006 1:55 am
Reputation: 0
Location: Irvine, California
Gender: Male

Postby blr121970 » Fri Jun 09, 2006 3:39 pm

Thank you Michal.

Attached is the strategy in ELD format.
Attachments
SIDEWAYSTRNDNGREVBND.ELD
(5.6 KiB) Downloaded 62 times

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “strategy trading & money management”