Header ads

Viết code amibroker tốt nhất

Code Accumulation/Distribution | Code amibroker tích lũy - Phân kỳ

Code Accumulation/Distribution | Code amibroker tích lũy  - Phân kỳ


Code amibroker tích lũy/phân kỳ là một indicator cho thấy sự tích lũy ở đáy và xuất hiện sự phân kỳ ở đỉnh. Code cho NĐT thấy sự xuất hiện đáy/đỉnh ngắn hạn.



Xem thêm:
- Cộng tác viên kiếm tiền.
- Độc quyền hệ thống Trading Plus
- Cách chọn cổ phiếu tốt dựa vào phân tích cơ bản

Code amibroker miễn phí

//==============================================================
// Signal Buy Sell
//  Production by: Trading Plus
// Date: 16/10/2012
//     Contact: tradingplus.dt@gmail.com
// Version: 5.2.1.1
//==============================================================
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetBarsRequired(sbrAll,sbrAll);
SetChartBkColor(ParamColor("Outer panel",colorDarkOliveGreen));
GraphXSpace=Param("GraphXSpace",20,-10,25,1);
_SECTION_END();

_SECTION_BEGIN( "Flower" );
//Title = StrFormat( "\\c02 {{DATE}} | Volume = " + WriteVal( V, 1.0 )+" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) );
_SECTION_END();

_SECTION_BEGIN( "Sup/Res Detail" );
SupResPeriod = Param( "LookBack Period", 50, 0, 200, 1 );
SupResPercentage = Param( "Percentage", 100, 0, 200, 1 );
PricePeriod = Param( "Price Period", 16, 0, 200, 1 );
SupportLinecolor = ParamColor( "Support Color", colorGreen );
SupportLinestyle = ParamStyle( "Support Style", styleThick | 8 | styleNoLabel );
ResistanceLinecolor = ParamColor( "Resistance Color", colorRed );
Resistancestyle = ParamStyle( "Resistance Style", styleThick | 8 | styleNoLabel );
_SECTION_END();

_SECTION_BEGIN( "Line Detail" );
OverBought = Param( "OverBought Above", 200, 0, 400, 1 );
OverSold = Param( "OverSold Bellow", -200, -400, 0, 1 );
_SECTION_END();

_SECTION_BEGIN( "Trend Bought/Sold Detail" );
Smoother = Param( "Trend Smoother", 5, 5, 20 );
upcolor = ParamColor( "UpTrend Color", colorGreen );
Downcolor = ParamColor( "DownTrend Color", colorRed );
_SECTION_END();

_SECTION_BEGIN( "Circle Detail" );
Warningcolor = ParamColor( "Warning/Watch Signal", colorBlue );
WatchColor = ParamColor( "Accumulation Zone", colorWhite );
EntryColor = ParamColor( "Entry Signal", colorAqua );
ProfitTakeColor = ParamColor( "Distribution Zone", colorYellow );
ExitColor = ParamColor( "Exit Signal", colorRed );
_SECTION_END();

_SECTION_BEGIN( "Swing Sup/Res" );
Lookback = SupResPeriod;
PerCent = SupResPercentage;
Pds = PricePeriod;
Var = MACD();
Up = IIf( Var > Ref( Var, -1 ), abs( Var - Ref( Var, -1 ) ), 0 );
Dn = IIf( Var < Ref( Var, -1 ), abs( Var - Ref( Var, -1 ) ), 0 );
Ut = Wilders( Up, Pds );
Dt = Wilders( Dn, Pds );
RSIt = 100 * ( Ut / ( Ut + Dt ) );
A1 = RSIt;
B2 = RSI( pds );
C3 = CCI( pds );
D4 = StochK( pds );
E5 = StochD( pds );
F6 = MFI( pds );
G7 = Ultimate( pds );
H8 = ROC( C, pds );
Osc = C3;
Value1 = Osc;
Value2 = HHV( Value1, Lookback );
Value3 = LLV( Value1, Lookback );
Value4 = Value2 - Value3;
Value5 = Value4 * ( PerCent / 100 );
ResistanceLine = Value3 + Value5;
SupportLine = Value2 - Value5;
baseline = IIf( Osc < 100 AND Osc > 10 , 50 , IIf( Osc < 0 , 0, 0 ) );
Plot( ResistanceLine, "", SupportLinecolor, SupportLinestyle );
Plot( SupportLine, "", ResistanceLinecolor, Resistancestyle );
_SECTION_END();

_SECTION_BEGIN( "Entry/Exit Detail" );
n = Smoother;
ys1 = ( High + Low + Close * 2 ) / 4;
rk3 = EMA( ys1, n );
rk4 = StDev( ys1, n );
rk5 = ( ys1 - rk3 ) * 200 / rk4;
rk6 = EMA( rk5, n );
UP = EMA( rk6, n );
DOWN = EMA( up, n );
Oo = IIf( up < down, up, down );
Hh = Oo;
Ll = IIf( up < down, down, up );
Cc = Ll;
barcolor2 = IIf( Ref( oo, -1 ) < Oo AND Cc < Ref( Cc, -1 ), upcolor, IIf( up > down, upcolor, downcolor ) );
PlotOHLC( Oo, hh, ll, Cc, "Trading Plus", barcolor2, styleCandle );  // When value is -ve it is accumulation, when +ve it is distribution ( 200 lines are limtits to watch )
Buy = Cross( up, OverSold );
Sell = Cross( OverBought, up );
PlotShapes ( IIf( Buy, shapeSmallCircle, shapeNone ) , EntryColor, layer = 0, yposition = -220, offset = 1 );
PlotShapes ( IIf( Sell, shapeSmallCircle, shapeNone ) , ExitColor, layer = 0, yposition = 220, offset = 1 );
_SECTION_END();

_SECTION_BEGIN( "Overbought/Oversold/Warning Detail" );
n = Smoother;
ys1 = ( High + Low + Close * 2 ) / 4;
rk3 = EMA( ys1, n );
rk4 = StDev( ys1, n );
rk5 = ( ys1 - rk3 ) * 210 / rk4;
rk6 = EMA( rk5, n );
UP = EMA( rk6, n );
DOWN = EMA( up, n );
Oo = IIf( up < down, up, down );
Hh = Oo;
Ll = IIf( up < down, down, up );
Cc = Ll;
barcolor2 = IIf( Ref( oo, -1 ) < Oo AND Cc < Ref( Cc, -1 ), colorGreen, IIf( up > down, colorGreen, colorRed ) );
PlotOHLC( Oo, hh, ll, Cc, "", barcolor2, styleCandle | stylehidden );
UP = EMA( rk6, n );
UPshape = IIf( UP >= OverBought OR UP <= OverSold, shapeHollowSmallCircle, shapeNone );
UPColor = IIf( UP >= 210, ProfitTakeColor, IIf( UP <= -210, WatchColor, Warningcolor ) );
Plot( UP, "", colorGrey50, styleThick | stylehidden );
PlotShapes( UPShape, UPColor, 0, UP, 0 );
_SECTION_END();

_SECTION_BEGIN( "Plot Lines" );
Plot( OverBought, "", colorDarkGrey, styleLine | styleNoLabel );
Plot( 0, "", colorDarkGrey, styleDashed | styleNoLabel );
Plot( OverSold, "", colorDarkGrey, styleLine | styleNoLabel );
_SECTION_END();

Post a Comment

0 Comments