PureBytes Links
Trading Reference Links
|
Don,
your code seems to work fine. Stock AEM at 09/11/06 don't gives a signal
because the detrended price oscillator is above zero, therefore your sell
condition isn't given.
Thomas
<http://www.tradingbasis.com/> www.tradingbasis.com
_____
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Don Lindberg
Sent: Saturday, November 18, 2006 4:55 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] An on again off again plotted arrow
Well, I have pulled all the hair out of my head, and I can't see the
forest for the tree. I have created an Indicator to replicate a
Vector Vest style screen. For the most part it works just as I
planned, except for the Buy-Sell Arrows. They do work, but not always
in the same chart! An example of one of the wayward charts is AEM.
There are several correctly plotted Arrows, but then on 9/11/06 where
it should plot a Sell arrow it doesn't. I don't know if I am doing
something wrong in my code, or if it is a bug.
My Code Follows:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates|chartWrapTitle);
_N(Title = StrFormat("Vector Vest System - {{INTERVAL}} {{DATE}} Open
%g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C,
SelectedValue( ROC( C, 1 ) ) ));
Plot( Close, "Price", IIf( Close > Open, colorBlue, colorCustom12 ),
styleBar | styleThick );
//Plot( C, "Close", ParamColor("Color", colorBlue ), styleNoTitle |
ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("DPO");
function DetrendedPriceOsc( Periods )
{
return C - Ref( MA( C, Periods ), -( 1 + Periods/2 ) );
}
dynamic_color = IIf(DetrendedPriceOsc( Param("Periods", 20, 1, 100 ))
> 0, colorGreen, colorDarkRed );
Plot( DetrendedPriceOsc( Param("Periods", 20, 1, 100 ) ),_DEFAULT_NAME
()+"Detrended Price Oscillator",dynamic_color,
styleHistogram|styleThick);
_SECTION_END();
_SECTION_BEGIN("WMA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 30, 1, 200, 1, 10 );
Plot( WMA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color",
colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("PlotArrows");
Buy=Cross(DetrendedPriceOsc(20),0) AND Cross(Close,WMA( P, Periods ));
Sell=Cross(0,DetrendedPriceOsc(20)) AND Cross(WMA( P,
Periods ),Close);
PlotShapes(shapeUpArrow*Buy, colorDarkGreen,0, L, - 1);
PlotShapes(shapeDownArrow*Sell, colorRed,0, H, - 1);
_SECTION_END();
_SECTION_BEGIN("Keltner Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 1, 100, 1 );
Width = Param("Width", 6, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
CenterLine = MA( P, Periods );
KTop = CenterLine + Width * ATR( Periods );
KBot = CenterLine - Width * ATR( Periods );
Plot( KTop, "KBTop" + _PARAM_VALUES(), Color, Style );
Plot( KBot, "KBBot" + _PARAM_VALUES(), Color, Style );
_SECTION_END();
Any help will be GREATLY appreciated!
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.14.11/542 - Release Date: 11/20/2006
|