Stock Portfolio Organizer
The ultimate porfolio management solution.
Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Trend Short Term Indicator for Amibroker (AFL)
Copy & Paste Friendly
Back
SetBarsRequired(100000,0);
GraphXSpace = 3;
k = Param("K", 0.01, 0, 0.2, 0.001);
Trend[0] = 1;
Revers[0] = C[0] - C[0]*k;
PE[0] = C[0];
for(i = 1; i < BarCount; i++)
{
if(Trend[i-1] == 1)
{
if(C[i] > PE[i-1])
{
Trend[i] = 1;
PE[i] = C[i];
Revers[i] = C[i] - C[i]*k;
}
else
{
if(C[i] < Revers[i-1])
{
Trend[i] = -1;
PE[i] = C[i];
Revers[i] = C[i] + C[i]*k;
}
else
{
Trend[i] = 1;
PE[i] = PE[i-1];
Revers[i] = Revers[i-1];
}
}
}
//======================================
else
{
if(C[i] < PE[i-1])
{
Trend[i] = -1;
PE[i] = C[i];
Revers[i] = C[i] + C[i]*k;
}
else
{
if(C[i] > Revers[i-1])
{
Trend[i] = 1;
PE[i] = C[i];
Revers[i] = C[i] - C[i]*k;
}
else
{
Trend[i] = -1;
PE[i] = PE[i-1];
Revers[i] = Revers[i-1];
}
}
Plot(Revers, "Trend Short Term", IIf(Trend == 1, 27, 4), 4);
_SECTION_BEGIN("Trend Short Term");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}
Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +"
{{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
Buy = Cross(Close,Revers);
Sell=Cross(revers,Close);
PlotShapes( Buy*shapeUpArrow, colorGreen, 0, Low);
PlotShapes( Sell*shapeDownArrow, colorRed, 0, High);