Разместил:   Дата: 2005-12-27 16:20
Комментарии: (0)   Рейтинг:

Breakout_Range2 by Mark Vakkur

In "Catching DJIA Breakouts" in this issue, I discuss the strategy of buyingmarkets that are breaking out to new highs, and present the results ofbuying breakouts in the Dow Jones Industrial Average (DJIA).

In EasyLanguage, you can create a Boolean variable or a ShowMe studyto simply test whether the two conditions of a breakout are met. However, I thought it more useful to have the function return the numberof bars since the last time a new high was achieved. The o­nly time a numberother than zero is returned is when it is a true breakout (the functionwill return a zero either when no new high is achieved or when a new highhas been achieved, but it has not been a breakout of look_bak length orgreater).

The EasyLanguage code for this function, which I have called Breakout_Range2, follows:

Type : Function, Name : Breakout_Range2

{********************1/26/2000 Mark Vakkur, M.D.
if this bar is the highest bar of the last look_bak bars
AND this has not occurred in look_bak bars, returns
the number of bars, otherwise returns 0. **************}

price( numericseries),

Vars: bar_count(0),
max_price(h); {number of bars since last high}

If CurrentBar = 1
then Begin bar_count = 1;
{bar_count counts the number of bars since
a new high was made}End
Else Begin
If price > Highest(high, look_bak)[1]
{if this bar is the highest high of
the look_bak period} then Begin
if bar_count >= look_bak then Begin
bar_count = 0;
Else {highest high but NOT since look_bak bars}
Begin bar_count = 0;
Breakout_Range2 = 0;
End { of highestbar check }

Else {this isn't the highest high }
Begin bar_count = bar_count + 1;

Breakout_Range2 = 0;

If this seems too complicated, don't worry. Simply cut and paste the code into TradeStation and then create the following system based o­n this function:

Type : Signal, Name : Breakout_Range2

If Breakout_Range2(h, look_bak) <> 0 then    
{this would o­nly occur if a new high price occured after n_bars of no such new high}  
Buy ;
If BarsSinceEntry >= n_bars then ExitLong;

Note that all of the work of the breakout system went into the breakout function.  This is perhaps the best way to develop your ideas: first create a function, then use the function to create indicators, ShowMe studies, and systems. If later you change the function, all the studies o­n whichit is based will be changed automatically, freeing you from the labor requiredto change each study.


Rambler's Top100

Страница создана за 0.03 секунды