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

[amibroker] NEW INDICATOR: Multiple TimeFrame DMI



PureBytes Links

Trading Reference Links

If you like using the Directional Movement Indicator, you're gonna
love this.....

Open this indicator in a new pane and use on 1 or 5 minute data. It
shows higher time frame trends: green = UP, red = DOWN.

There are two parameters:

1. DMI length

2. Show 15 and 30min also?: 0 = Don't add these in, 1 = Show them as
well

Default is DMI of 2 on hourly, 4 hourly and 12 hourly data.

I really like this one, as it shows me what the major trends are
doing at any one time. DMI is much more sensitive than EMAs, etc...

Just look over your data and see how the major trend always affects 
the minor trend in the end. This is like having a compass and a map 
at sea!

Have fun and post your comments.

Cheers,
Alex

=======================================================================

_SECTION_BEGIN("MultipleFrameDMI");

// Programmer: (C) Alex Chambers, June 2007
// For Amibroker - just insert into a NEW BLANK pane

// I, Alex Chambers, am not responsible for any results you may have 
from the use of this indicator
// You must evaluate yourself the potential for gains AND losses

// Please include this and/or any other comment description of any 
changes you make.
  
a = 0;
Plot(a,"",colorWhite);			// This creates enough chart 
space for the rectangles

SetChartOptions(0,chartShowArrows|chartShowDates|chartWrapTitle);
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | 
ParamStyle("Style") | GetPriceStyle() );

f = Param("DMI length",2,2,20,1);
Opt = Param("Show 15 and 30min also?",1,0,1,1);

TimeFrameSet(in15Minute); 
eVal = PDI(f);
fifPDI = Ref(eval,1);     /// Push back by one so on right one
eVal = MDI(f);
fifMDI = Ref(eval,1);     /// Push back by one so on right one
TimeFrameRestore(); 

TimeFrameSet(2*in15Minute); 
eVal = PDI(f);
thirPDI = Ref(eval,1);     /// Push back by one so on right one
eVal = MDI(f);
thirMDI = Ref(eval,1);     /// Push back by one so on right one
TimeFrameRestore(); 

TimeFrameSet(12*inHourly); 
eVal = PDI(f);
twPDI = Ref(eval,1);     /// Push back by one so on right one
eVal = MDI(f);
twMDI = Ref(eval,1);     /// Push back by one so on right one
TimeFrameRestore(); 

TimeFrameSet(4*inHourly); 
eVal = PDI(f);
frPDI = Ref(eval,1);     /// Push back by one so on right one
eVal = MDI(f);
frMDI = Ref(eval,1);     /// Push back by one so on right one
TimeFrameRestore(); 

TimeFrameSet(inHourly); 
eVal = PDI(f);
hrPDI = Ref(eval,1);     /// Push back by one so on right one
eVal = MDI(f);
hrMDI = Ref(eval,1);     /// Push back by one so on right one
TimeFrameRestore(); 


twPDIexp = TimeFrameExpand(twPDI,12*inHourly); 
twMDIexp = TimeFrameExpand(twMDI,12*inHourly);
ColTW = IIf(twPDIexp > twMDIexp,colorGreen,colorRed);
wrdTW = WriteIf(twPDIexp > twMDIexp,"BULLISH","BEARISH");

frPDIexp = TimeFrameExpand(frPDI,4*inHourly); 
frMDIexp = TimeFrameExpand(frMDI,4*inHourly); 
ColFR = IIf(frPDIexp > frMDIexp,colorGreen,colorRed);
wrdFR = WriteIf(frPDIexp > frMDIexp,"BULLISH","BEARISH");

hrPDIexp = TimeFrameExpand(hrPDI,inHourly); 
hrMDIexp = TimeFrameExpand(hrMDI,inHourly);
ColHR = IIf(hrPDIexp > hrMDIexp,colorGreen,colorRed);
wrdHR = WriteIf(hrPDIexp > hrMDIexp,"BULLISH","BEARISH");

fifPDIexp = TimeFrameExpand(fifPDI,in15Minute); 
fifMDIexp = TimeFrameExpand(fifMDI,in15Minute);
ColFIF = IIf(fifPDIexp > fifMDIexp,colorGreen,colorRed);
wrdFIF = WriteIf(fifPDIexp > fifMDIexp,"BULLISH","BEARISH");

thirPDIexp = TimeFrameExpand(thirPDI,2*in15Minute); 
thirMDIexp = TimeFrameExpand(thirMDI,2*in15Minute);
ColTHIR = IIf(thirPDIexp > thirMDIexp,colorGreen,colorRed);
wrdTHIR = WriteIf(thirPDIexp > thirMDIexp,"BULLISH","BEARISH");


if (Opt==0)
{
	t = HHV(H,BarCount);
	a = t / 4;

	PlotShapes(shapeSquare,ColHR,0,a*3,0);
	PlotShapes(shapeSquare,ColFR,0,a*2,0);
	PlotShapes(shapeSquare,ColTW,0,a,0);

	Title = "Hourly "+wrdHR+"     4 Hourly "+wrdFR+"     12 
Hourly "+wrdTW+"      DMI = "+f;
}
else
{
	t = HHV(H,BarCount);
	a = t / 6;

	PlotShapes(shapeSquare,ColFIF,0,a*5,0);
	PlotShapes(shapeSquare,ColTHIR,0,a*4,0);
	PlotShapes(shapeSquare,ColHR,0,a*3,0);
	PlotShapes(shapeSquare,ColFR,0,a*2,0);
	PlotShapes(shapeSquare,ColTW,0,a,0);

	Title = "15min "+wrdFIF+"     30min "+wrdTHIR+"     Hourly 
"+wrdHR+"     4 Hourly "+wrdFR+"     12 Hourly "+wrdTW+"      DMI = 
"+f;
}

_SECTION_END();



Please note that this group is for discussion between users only.

To get 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/