AmiBroker v5.2 : Phân Tích Cung Cầu.Hướng dẫn A -> Z

Chủ đề trong 'Thị trường chứng khoán' bởi LeaderFPT, 11/07/2009.

6767 người đang online, trong đó có 250 thành viên. 00:25 (UTC+07:00) Bangkok, Hanoi, Jakarta
  1. 0 người đang xem box này (Thành viên: 0, Khách: 0)
Chủ đề này đã có 44178 lượt đọc và 117 bài trả lời
  1. LeaderFPT

    LeaderFPT Thành viên gắn bó với f319.com

    Tham gia ngày:
    18/11/2007
    Đã được thích:
    954
    Newbies IEM xin hầu Các Bác

    Data Bao Gia.rar
    Data Cung Cau.rar
    Data Format.rar

    2) Copy 4 file trong Data Format vô C:program FilesAmiBrokerFormats
    3) Tools -> Preferences -> Data -> Default Database Path ....xác định thư mục chứa cơ sỡ dữ liệu làm việc of AmiBroker
    4) Vô thư mục nói trên ...Ctrl+A ... Shift+Delete !!!
    5) File -> Import ASCII -> Toan Bo (*.txt) -> vô Data Bao Gia -> chọn 2 file : HOSE_BG.TXT & HASTC_BG.TXT
    6) File -> Import ASCII -> Moi Ngay (*.txt) -> vô Data Bao Gia -> chọn tất cả file nhưng lọai trừ 2 file: HOSE_BG.TXT & HASTC_BG.TXT ra
    7) File -> Import ASCII -> Cung Cau (*.txt) -> vô Data Cung Cau -> chọn 2 file : CC_Upto300609.txt & NN_Upto300609.txt
    8) File -> Import ASCII -> Cung Cau (*.txt) -> vô Data Cung Cau -> chọn tất cả file nhưng lọai trừ 2 file: CC_Upto300609.txt & NN_Upto300609.txt

    Sheet 1:
    + Fibonacci Moving averages
    + TRIX - Triple Exponential
    + MFI - Money Flow Index
    + FastStochK FullStochK-D
    + MACD and histogram divergence detection => set 11 12 13 ngày !
    + Aroon The Advisor
    + Projection Oscillator
    + CCI(20) Divergence

    Sheet 8 :
    + ZeroLag W%R
    + MA Exploration
    + STD_STK Single
    + Dynamic Momentum Index 2007
    + DSS Bressert
    + Volume Oscillator
    + Williams %R with 358 period signal line
    + RSI Fibonnacci

    Sheet 6 :
    + Foreign NET Value
    + Foreign NET Volume
    + NET Order
    + NET Volume

    Scan Stocks :
    Analysys -> Automatic Analysys -> use filter -> define -> include -> Group 255 <= set lần đầu tiên thôi
    n last days : n=1
    Scan
    File-> Export...Text files (*.txt) nên đặt tên theo indicator & kem theo ngày cho dễ nhớ
  2. LeaderFPT

    LeaderFPT Thành viên gắn bó với f319.com

    Tham gia ngày:
    18/11/2007
    Đã được thích:
    954
    Analysis -> Formular Editor ...past CODE vào ...chọn Sheet 8 ...Apply Indicator


    _SECTION_BEGIN("ZERO LAG INDICATOR");
    /*ZeroLag W%R*/
    "========";

    GraphXSpace = 3;

    R = ((HHV(H,14) - C) /(HHV (H,14) -LLV (L,14))) *-100;

    MaxGraph=10;
    Period= 10;
    EMA1= EMA(R,Period);
    EMA2= EMA(EMA1,5);
    Difference= EMA1 - EMA2;
    ZeroLagEMA= EMA1 + Difference;
    PR=100-abs(ZeroLagEMA);

    Graph0=PR;
    MoveAvg=MA(PR,5);
    Graph1=MoveAvg;
    Graph1Color=colorTan;
    Graph0Style=4;
    upbar= PR>= MoveAvg AND PR>= Ref(PR,-1) ;
    downbar=(PR < MoveAvg) OR PR>= MoveAvg AND PR< Ref(PR,-1) ;
    barcolor = IIf( downbar,colorRed, IIf( upbar, colorBrightGreen, 7));
    Graph0BarColor = ValueWhen( barcolor != 0, barcolor );
    Graph2=30;
    Graph3=70;
    Graph2Style=Graph3Style=Graph4Style=1;
    Graph4Color=2;
    Graph2Color=5;
    Graph3Color=4;
    Graph5=0;
    Graph6=100;
    Graph5Style=Graph6Style=1;
    Graph5Color=Graph6Color=2;
    Title=Name()+" < ZeroLag W%R :"+WriteVal(PR)+"%";
    Buy = Cross(PR,moveAvg) AND PR<30;
    Sell = Cross(moveAvg,PR) AND PR>30;
    PlotShapes(Buy*shapeUpArrow,colorGreen,0,Graph0);
    PlotShapes(Sell*shapeDownArrow,colorRed,0,Graph0);

    PlotOHLC( pr,pr,50,pr, "", IIf( pr > 50, ParamColor( "Color+", colorGold), ParamColor( "Color-", colorTeal)),styleCloud | styleClipMinMax, 30, 70 );

    _SECTION_END();
    _SECTION_BEGIN("Change Background Color");
    SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),
    ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 )));
    _SECTION_END();
  3. LeaderFPT

    LeaderFPT Thành viên gắn bó với f319.com

    Tham gia ngày:
    18/11/2007
    Đã được thích:
    954
    //Base trading system:
    //Su+? du.ng 2 ?u+O+`ng MA5 Và MA 8.
    //_Mua : khi price cut MA8.
    //_Bán : Khi price cut MA5.
    // simple trading system
    Buy = Cross( C, MA( C, 8 ) );
    Sell = Cross( MA( C, 5 ), C );
    Cover = Buy;
    Short =Sell;
    Plot(C,"",IIf(C>Ref(C,-1),colorGreen,colorRed),styleLine|styleThick);
    Plot(MA( C, 8 ),"MA8",colorWhite,styleLine);
    Plot(MA( C, 5 ),"MA5",colorYellow,styleLine);
    shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
    PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );

    _SECTION_BEGIN("Change Background Color");
    SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),
    ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 )));
    _SECTION_END();
  4. LeaderFPT

    LeaderFPT Thành viên gắn bó với f319.com

    Tham gia ngày:
    18/11/2007
    Đã được thích:
    954
    /*StochK/StochD Crossover for A single ticker.

    Enters long on stochastic indicator when EMA StochD line crosses the EMA StochK line. Exit on reversing signals only.

    Sequence: To run optimisation remove // in front of lines with optimization instructions (the 3 lines in the praragraph below) and place // in front of line with specific STK, STD and pds per ticker (3 lines in 2nd paragraph below). Set range, click apply to current stock and run optimisation.
    Insert the optimized figures in ( STK=, STD= and pds=) statement of 2nd paragraph below.
    Once completed replace // in front of optimization instruction lines (1st paragraph below), remove // in front of line with specific STK, STD and pds (2nd paragraph below), save file and click on scan, explore or backtest. These formulas can also be used as indicator.

    Each optimisation requires 729 optimisation steps.*/

    /*1st paragraph.*/
    //STK=Optimize ("StK" , 14, 2, 18, 2); //*Remove // before STK for optimization, replace for scan, exploration & backtesting.
    //STD=Optimize ("StD" ,14, 2, 18, 2); //*Remove // before STD for optimization, replace for scan, exploration & backtesting.
    //pds = Optimize("pds", 9,2,18,2); //*Remove // before pds for optimization, replace for scan, exploration & backtesting.

    /*2nd paragraph.*/

    STK= 8; //*Place // in front of STK before optimization, remove for scan, exploration & backtesting.*//
    STD= 8; //*Place // in front of STD before optimization, remove for scan, exploration & backtesting.*//
    pds= 5; //*Place // in front of pds before optimization, remove for scan, exploration & backtesting.*//

    //STK=LastValue(STK);
    //STD=LastValue(STD);
    //pds = LastValue(pds);

    Sell= Cross (EMA (StochD (STD),pds),EMA( StochK (STK),pds));
    Buy= Cross (EMA(StochK (STK),pds),EMA( StochD (STD),pds));
    Cover = Cross (EMA(StochK (STK),pds),EMA( StochD (STD),pds));
    Short = Cross (EMA (StochD (STD),pds),EMA( StochK (STK),pds));

    PlotShapes(IIf(Buy ,shapeUpArrow,shapeNone) ,colorBrightGreen);
    PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorOrange);

    Filter=Buy OR Sell OR Short OR Cover;

    Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy); Short=ExRem(Short,Cover); Cover=ExRem(Cover,Short);
    NumColumns = 2;
    Column0 = EMA( StochK (STK),pds);
    Column1 = EMA (StochD (STD),pds);

    AddColumn(Buy,"Buy"); AddColumn(Sell,"sell"); AddColumn(Short,"short"); AddColumn(Cover,"cover");

    Graph0 = EMA( StochK (STK),pds);
    Graph1 = EMA (StochD (STD),pds);
    Graph2 = (EMA( StochK (STK),pds) - EMA (StochD (STD),pds))*2;
    Graph2Style = 2;
    Graph2Color =1;


    Title=Name()+" " +"StD% Cross StK%" + " " +"%K="+WriteVal(Graph0,FORMAT=1.1)+", %D="+
    WriteVal(Graph1,FORMAT=1.1)+
    WriteIf(Graph0>Graph1," LONG position"," ")+
    WriteIf(Graph1>Graph0," SHORT position","")+"; "+ " Delta" + " "+WriteVal((Graph2/2),FORMAT=1.1)+"%";

    _SECTION_BEGIN("Change Background Color");
    SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),
    ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 )));
    _SECTION_END();
  5. LeaderFPT

    LeaderFPT Thành viên gắn bó với f319.com

    Tham gia ngày:
    18/11/2007
    Đã được thích:
    954
    _SECTION_BEGIN("Dynamic Momentum Index");
    period = Param( "RSI Period", 13, 1, 100, 1 );
    MAperiod = Param( "MA Period", 5, 1, 100, 1 );
    StDevperiod = Param( "StDev Period", 8, 1, 100, 1 );

    upday=IIf(C>Ref(C,-1),C-Ref(C,-1),0);
    downday=IIf(Ref(C,-1)> C,Ref(C,-1)-C,0);

    Stda=MA(StDev(C,StDevperiod),MAperiod);
    V1=StDev(C,StDevperiod)/Stda;
    TD=int(period/V1);

    Su=Sum(upday,TD);
    Sd=Sum(downday,TD);
    M1=(Su-Sd);
    M2=abs(Su+Sd);
    DMI=50*(M1+M2)/M2;
    xs=Param("Smoothing",3,1,10,1);
    xs1=Param("Trigger Line",5,1,10,1);

    Plot(EMA(DMI,xs),"Dynamic Momentum Index ",colorRed,1);
    Plot(MA(DMI,xs1),"trigger",colorBlue,1);

    Buy=Cross(EMA(DMI,xs),MA(DMI,xs1));
    Sell=Cross(MA(DMI,xs1),EMA(DMI,xs));
    PlotShapes(IIf(Buy ,shapeUpArrow,shapeNone) ,colorBrightGreen);
    PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorOrange);




    Plot(70,"",2,1);Plot(30,"",2,1);
    _SECTION_END();

    _SECTION_BEGIN("Change Background Color");
    SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),
    ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 )));
    _SECTION_END();
  6. LeaderFPT

    LeaderFPT Thành viên gắn bó với f319.com

    Tham gia ngày:
    18/11/2007
    Đã được thích:
    954
    _SECTION_BEGIN("RSI");
    barvisible = Status("barvisible");

    //SetChartOptions(0,0,chartGrid30|chartGrid70);

    periods = Param( "Periods", 9, 1, 200, 1 );

    //r = RSI( 14 );

    r = RSI( periods);

    maxr = LastValue( Highest( IIf( barvisible, r, 0 ) ) );
    minr = LastValue( Lowest( IIf( barvisible, r, 100 ) ) );
    ranr = maxr - minr;
    //Plot( r, "RSI(14)", colorRed );
    Plot( RSI( periods), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );

    PlotOHLC( r,r,50,r, "", IIf( r > 50, ParamColor( "Color+", colorGold), ParamColor( "Color-", colorTeal)),styleCloud | styleClipMinMax, 30, 70 );

    Plot( maxr , "0%", colorGrey50 );
    Plot( maxr - 0.236 * ranr, "-23.6%", colorPaleGreen, styleDashed );
    Plot( maxr - 0.382 * ranr, "-38.2%", colorPaleBlue, styleDashed );
    Plot( maxr - 0.50 * ranr, "-50.0%", colorOrange, styleDashed );
    Plot( maxr - 0.618 * ranr, "-61.8%", colorPaleBlue, styleDashed );
    Plot( minr , "-100%", colorGrey50 );
    GraphXSpace = 3;
    _SECTION_END();

    _SECTION_BEGIN("RSI1");
    //SetChartOptions(0,0,chartGrid30|chartGrid70);
    periods = Param( "Periods", 4, 1, 200, 1 );
    Plot( RSI( periods), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
    _SECTION_END();

    _SECTION_BEGIN("Change Background Color");
    SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),
    ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 )));
    _SECTION_END();
  7. LeaderFPT

    LeaderFPT Thành viên gắn bó với f319.com

    Tham gia ngày:
    18/11/2007
    Đã được thích:
    954
    /* Volume Oscillator */
    /* Indicator, system, and exploration */
    /* Steve Wiser slwiserr@erols.com */

    PlusDM= IIf(High>Ref(High,-1) AND Low>=Ref(Low,-1), High-Ref(High,-1),
    IIf(High>Ref(High,-1) AND Low<Ref(Low,-1)
    AND High-Ref(High,-1)>Ref(Low,-1)-Low,
    High-Ref(High,-1),0));

    Vm=log(EMA(V,3));

    Buy= (C-L)*Vm+ (H-O)*Vm +
    IIf(C>O,(C-O)*Vm,0) + PlusDM*Vm +
    IIf(Ref(C,-1)<O,(O-Ref(C,-1))*Vm,0);

    MinDM = IIf(Low<Ref(Low,-1) AND High<=Ref(High,-1), Ref(Low,-1)-Low,
    IIf(High>Ref(High,-1) AND Low<Ref(Low,-1)
    AND High-Ref(High,-1)<Ref(Low,-1)-Low, Ref(Low,-1)-Low, 0));

    Sell= (H-C)*Vm + (O-L)*Vm +
    IIf(C<O,(O-C)*Vm,0) + MinDM*Vm +
    IIf(Ref(C,-1)>O,(Ref(C,-1)-O)*Vm,0);

    Wm=Wilders(Wilders(Buy,3)-Wilders(Sell,3),3);

    MA3=MA(Wm,3);
    MA5=MA(Wm,5);
    MA8=MA(Wm,8);
    //MA13=MA(Wm,13);

    Plot(Wm, "Volume Oscillator", colorBlue, styleLine|styleThick);

    Plot(MA3, "MA3", colorYellow, styleLine);

    Plot(MA5, "MA5", colorRed, styleLine);

    Plot(MA8, "MA8", colorWhite, styleLine);

    //Plot(MA13, "MA13", colorGreen, styleLine);

    Buy=Cross(Wm,MA3);
    Sell=Cross(MA5,Wm);

    PlotShapes(IIf(Buy ,shapeUpArrow,shapeNone) ,colorGreen, 0, MA3);
    PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed, 0, MA5);

    Plot(0, "", colorBlack, styleDashed);

    /*
    Graph1=Wm;
    //Graph2=Wilders(Wm,30);
    Graph2=MA(Wm,5);

    Graph0=0;
    Graph0Style=Graph1Style=Graph2Style=styleLine;
    Graph2Color=colorRed;

    Buy=Cross(Wm,MA(Wm,5));
    Sell=Cross(MA(Wm,5),Wm);

    PlotShapes(IIf(Buy ,shapeUpArrow,shapeNone) ,colorBrightGreen, 0, MA(Wm,5));
    PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorOrange, 0, MA(Wm,5));

    Title=Name()+" " +"Volume Oscillator" + " " +"Vol Osc="+WriteVal(Wm,FORMAT=1.2)+", MA5="+
    WriteVal(MA(Wm,5),FORMAT=1.2)+
    WriteIf(Graph1>Graph2," LONG position"," ")+
    WriteIf(Graph2>Graph1," SHORT position","");
    */
    Filter= (Buy==1) ;
    NumColumns = 6;
    Column0 =Ref(C+0.065,-1);
    Column0Format = 1.2;
    Column0Name = "Trigger Price";WriteVal(C+0.065);
    Column1 = C;
    Column1Name = "Close ";WriteVal(C);
    Column1Format = 1.2;
    Column2 = MA(V,17);
    Column2Name = "17 Ma Vol ";WriteVal(MA(V,17) );
    Column2Format = 1.0;
    Column3 = MA(C,17)/MA(C,50);
    Column3Name = "% 17/50 ";WriteVal( MA(C,17)/MA(C,50) );
    Column3Format = 1.2;
    Column3Format = 1.2;
    Column4= MA(C,17);
    Column4Name="17 C ma"; WriteVal( MA(C,17) );
    Column4Format = 1.2;
    Column4= MA(C,50);
    Column4Name="50 C ma"; WriteVal( MA(C,50) );
    Column4Format = 1.2;
    Column5=Wm;
    Column5Name="Vol Osc"; WriteVal(Wm);
    Column5Format=1.2;

    /* End of Exploration Code. */
    _SECTION_BEGIN("Change Background Color");
    SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),
    ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB( 172,172,172 )));
    _SECTION_END();
  8. nocstock

    nocstock Thành viên rất tích cực

    Tham gia ngày:
    18/06/2009
    Đã được thích:
    0
  9. nocash

    nocash Thành viên rất tích cực

    Tham gia ngày:
    01/10/2008
    Đã được thích:
    1
    bác cho cái link khác đi bác ơi, link cũ die hết rùi



    Được nocash sửa chữa / chuyển vào 00:16 ngày 14/07/2009
  10. maninpaper

    maninpaper Thành viên gắn bó với f319.com

    Tham gia ngày:
    06/04/2009
    Đã được thích:
    542
    Die đâu, em vào download phà phà. Bác phải chờ nó đếm ngược 10 giây rồi mới hiện link cho bác download.

Chia sẻ trang này