[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Breakout - VIDYA & DIM



PureBytes Links

Trading Reference Links

A number of amibroker users have requested me to post the systems 
that were used in the January 2009 Issue of Stocks & Commodities 
magazine.
A brief thank you first. Without the kind assistance of many 
individuals who read this list, and contribute to it, that article 
would not have been possible (I believe strongly in re-using code). 
Special thanks goes to the maestro, Tomasz Janeczko, without ehose 
insight and talent none of this would have been possible.

One of those systems was the "DMI" System from Tushar Chande.
I claim neither originality nor particular brilliance in programming 
this system. The key parts of the code that I used is as follows:

function VarPeriodRSI( array, periods ) 
{ 
  Chg = array - Ref( array, -1 ); 
  pc = Max( Chg, 0 ); 
  nc = Max( -Chg, 0 ); 

  pa = AMA( pc, 1/periods ); 
  na = AMA( nc, 1/periods ); 

  return 100 * pa / ( pa + na ); 
} 
/* Functions */ 
//Length=21; Smooth=5; 
function Vidya(Length, smooth) { 
Change = C - Ref( C, -1 ); 
SU = Sum( C - Ref( C, -1 ) > 0, Length ); 
SD = Sum( C - Ref( C, -1 ) < 0, Length ); 
CMO = 100 * ( SU - SD ) / ( SU + SD ); 
 AbsCMO=( abs(CMO) )/100; 
SC=2/(Smooth+1); 
return AMA( C, SC*AbsCMO ); 
} 
//==============================================================
VidyaDelta = Optimize("VidyaDelta", 1.2, .8, 1.2, .2);
VidyaLen = Optimize("Vidyalen", 8, 8, 24, 2);
VidyaSmooth = Optimize("VidyaSmooth", 20, 10, 26, 4); 
UpLimit = Optimize("UpLimit", 75, 70, 85, 5);
//==============================================================

UpBand=(1+VidyaDelta/100) * Vidya(VidyaLen, VidyaSmooth); 
LoBand=(1-Vidyadelta/100) * Vidya(VidyaLen, VidyaSmooth); 
//Calculation of Volatility for DMI to range from 5 to 30 days
STDa = MA(StDev(Close, 5), 10); 
Vi = StDev(Close, 5)/STDa; 
TD = int(14/Vi); 
TD= IIf(TD >30, 30, IIf(TD < 5, 5, TD)); 
DMI = VarPeriodRSI(Close,TD);  
 
Condition1=  Close >= UpBand AND (Ref(Low,-1) >= Ref(UpBand,-1));
Condition2 =  DMI > UpLimit; 
 
Buy= Condition1 AND Condition2 ; 
 
Sell = Low < UpBand AND DMI < 100- UPLimit ;  
Buy = ExRem( Buy, Sell ); 
Sell = ExRem( Sell, Buy ); 
 
 
Short = Cover = False; 
//==================================================================

--- In amibroker@xxxxxxxxxxxxxxx, "areehoi" <areehoi@xxx> wrote:
>
> Breakouts afford good buying opportunities.  A combination of VIDYA
> and DMI yields some good result according to an article on this
> subject (see below).  Has anyone developed an AFL along with
> Exploration for this combined indicator?  If so a post would be most
> appreciation. Thanks
> 
> Dick H.
> 
> "A combination of VIDYA and DMI may be used to identify when prices
> have broken out and when the breakout has occurred with great
> strength. To do so, a 1% band around VIDYA may be optimal. Whenever
> the market closes above the upper band or below the lower band, we 
can
> assume that prices have broken out in that direction. A close above
> the upper band implies that prices will move higher, while a close
> below the lower band implies prices will move lower. A more
> conservative criterion could be called for, such as multiple closes
> beyond the 1% bands, or insisting that the low be above the upper 
band
> (or high below the lower band) to recognize a breakout."
>



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/