Phân tích kỹ thuật (TA) - (chỉ chia sẻ kiến thức, ko spam)

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

7156 người đang online, trong đó có 1084 thành viên. 14:29 (UTC+07:00) Bangkok, Hanoi, Jakarta
  1. 6 người đang xem box này (Thành viên: 1, Khách: 5)
Chủ đề này đã có 3856071 lượt đọc và 1160 bài trả lời
  1. TXViet08

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

    Tham gia ngày:
    19/01/2017
    Đã được thích:
    101
    Code RSI:

    [​IMG]

    _SECTION_BEGIN("RSI");
    SetChartOptions(0,0,ChartGrid30|ChartGrid70,0,100);

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

    z = RSI( periods);

    RSILineColor = ParamColor("RSI Line Color",colorGreen);

    RSIOverboughtColor = ParamColor("RSI Overbought Color",colorBlue);

    RSIOversoldColor = ParamColor("RSI Oversold Color",colorRed);

    Plot( z, _DEFAULT_NAME(), RSILineColor , styleLine );

    Plot( 50, _DEFAULT_NAME(), RSILineColor , styleDashed|styleNoTitle );

    Plot( 70, _DEFAULT_NAME(), RSILineColor , styleLine|styleNoTitle );

    Plot( 30, _DEFAULT_NAME(), RSILineColor , styleLine|styleNoTitle );

    PlotOHLC(z,z,50,z,"",IIf(z>50,RSIOverboughtColor,RSIOversoldColor),styleCloud|styleClipMinMax,30,70);

    _SECTION_END();
    lt2vietnam thích bài này.
  2. TXViet08

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

    Tham gia ngày:
    19/01/2017
    Đã được thích:
    101
    Code MFI:

    [​IMG]

    _SECTION_BEGIN("MFI");
    periods = Param( "Periods", 14, 2, 200, 1 );

    //Plot( MFI(periods), _DEFAULT_NAME(), ParamColor("Color", colorCycle ), ParamStyle("Style") );

    RSILineColor = ParamColor("RSI Line Color",colorGreen);

    RSIOverboughtColor = ParamColor("RSI Overbought Color",colorBlue);

    RSIOversoldColor = ParamColor("RSI Oversold Color",colorRed);

    Plot( MFI(periods), _DEFAULT_NAME(), RSILineColor , styleLine );

    Plot( 50, _DEFAULT_NAME(), RSILineColor , styleDashed|styleNoTitle );

    Plot( 80, _DEFAULT_NAME(), RSILineColor , styleLine|styleNoTitle );

    Plot( 20, _DEFAULT_NAME(), RSILineColor , styleLine|styleNoTitle );

    PlotOHLC(MFI(periods),MFI(periods),50,MFI(periods),"",IIf(MFI(periods)>50,RSIOverboughtColor,RSIOversoldColor),styleCloud|styleClipMinMax,20,80);

    _SECTION_END();
    lt2vietnam thích bài này.
  3. TXViet08

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

    Tham gia ngày:
    19/01/2017
    Đã được thích:
    101
    Code Buy Sell Volume:

    [​IMG]

    _SECTION_BEGIN("Volume");
    Plot( Volume, _DEFAULT_NAME(), IIf( C > O, ParamColor("Up Color", colorGreen ), ParamColor("Down Color", colorRed ) ), ParamStyle( "Style", styleHistogram | styleThick, maskHistogram ) );
    _SECTION_END();

    _SECTION_BEGIN("MA");
    P = ParamField("Price field",-1);
    Periods = Param("Periods", 15, 2, 300, 1, 10 );
    Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
    _SECTION_END();

    //********Dedicated to my father*************

    SetBarsRequired(sbrAll,sbrAll);

    // calculate the trading volume
    BV = IIf( (H==L), 0, (V*(C-L)/(H-L)) );
    SV = IIf( (H==L), 0, (V*(H-C)/(H-L)));

    // starting of the day

    Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));

    StartBar = ValueWhen(TimeNum() == 091500, BarIndex());

    //total volume traded

    TodayVolume = Sum(V,Bars_so_far_today);
    TBUYVOL=Sum(BV,Bars_so_far_today);
    TSELVOL=Sum (SV,Bars_so_far_today);
    SVbull= TBUYVOL>= TSELVOL;
    SVbear=TSELVOL>=TBUYVOL;

    //PlotShapes(IIf(SVbull,shapeUpArrow, shapeNone),colorGreen, 0, L, Offset=85);
    //PlotShapes(IIf(SVbear,shapeDownArrow, shapeNone),colorRed, 0, L, Offset=-85);

    Title= " B :"+WriteVal(TBUYVOL/TodayVolume*100,2.2)+" S :"+WriteVal(TSELVOL/TodayVolume*100,2.2);

    VolBuy = Sum(BV,Bars_so_far_today);
    VolSell = Sum (SV,Bars_so_far_today);

    //**************************************************
    _SECTION_BEGIN("Vol Buy Sell");
    pColorVolBuy = ParamColor("Buy Color", colorGreen);
    pColorVolSell = ParamColor("Sell Color", colorRed);
    Plot(VolBuy, "", pColorVolBuy, ParamStyle("Style", styleLine | styleNoTitle));
    Plot(VolSell, "", pColorVolSell, ParamStyle("Style", styleLine | styleNoTitle));
    _SECTION_END();
    Rose2018lt2vietnam thích bài này.
  4. Sir_HuuLam

    Sir_HuuLam Thành viên rất tích cực Not Official

    Tham gia ngày:
    03/11/2016
    Đã được thích:
    211
  5. thanhhai7891

    thanhhai7891 Thành viên quen thuộc

    Tham gia ngày:
    04/06/2018
    Đã được thích:
    20
    e đã từ bỏ cái môn cờ bạc phái sinh để quay lại ckcs
    Rose2018 thích bài này.
  6. vanvanvovo

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

    Tham gia ngày:
    07/10/2013
    Đã được thích:
    1.750
    Bác chắc ăn đủ kiếm mớ bên PS ròi chứ gì ?
  7. TXViet08

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

    Tham gia ngày:
    19/01/2017
    Đã được thích:
    101
    Code Composite Index:

    [​IMG]

    /*

    Composite Index,

    */

    A=RSI() - Ref(RSI(),-9)+ MA(RSI(3),3);
    Plot(A,"Composite Index",colorYellow,styleThick);
    Plot(MA(A,13),"MA13",colorBlack,styleHistogram);
    Plot(MA(A,13),"MA13",colorBlue,styleArea);


    Plot(MA(A,33),"MA33",colorBlack,styleHistogram);
    Plot(MA(A,33),"MA33",colorRed,styleArea);

    Plot(100,"",colorRed,styleDots,styleArea);
    Plot(0,"",colorGreen,styleDots,styleArea);
    Overbought=100;
    Oversold=0;
    Plot(100,"",colorDarkTeal,styleArea);
    Plot(120,"",colorBlack,styleHistogram);
    Plot(120,"",colorRed,styleArea);
    Plot(-20,"",colorBlack,styleHistogram);
    Plot(-20,"",colorGreen,styleArea);
    Overbought=100;
    Oversold=-0;

    Buy = Cross(A, Oversold) AND A > Oversold;
    Sell = Cross(Overbought, A) AND A 0;
    Bear_Trend15=EMA(SwingTrd151,34)<0;
    TimeFrameRestore();
    Ribbon_kol15=IIf(TimeFrameExpand(Bull_Trend15,in15Minute),colorBlue, IIf

    (TimeFrameExpand(Bear_Trend15,in15Minute),colorRed, colorWhite));
    Plot(8, "ribbon", Ribbon_kol15, styleOwnScale|styleArea|styleNoLabel, -0.5,100);
    // End of Trend Filter

    _SECTION_BEGIN("color1");
    SetChartBkGradientFill( ParamColor("BgTop", ColorRGB( 172,172,172 )),

    ParamColor("BgBottom", ColorRGB( 172,172,172 )),ParamColor("titleblock",ColorRGB(

    172,172,172 )));

    _SECTION_END();
  8. TXViet08

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

    Tham gia ngày:
    19/01/2017
    Đã được thích:
    101
    Code mô hình Harmonic:

    [​IMG]


    GraphXSpace =7;

    Title = Date() + " C: " + WriteVal(C,1.2) + " O: " + WriteVal(O,1.2) + " L: " + WriteVal(L,1.2) + " H: " + WriteVal(H,1.2) ;colorHighliter = IIf(C >= O,27, 4);SetBarFillColor(colorHighliter);Plot(C, "Close", IIf(colorHighliter == 27,5, IIf(colorHighliter == 4, 17,29)), styleCandle, Null, Null, 0, 0, 1);

    _SECTION_BEGIN("Price");
    SetChartOptions(0,chartShowArrows|chartShowDates);
    _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
    Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
    _SECTION_END();


    _SECTION_END();

    _SECTION_BEGIN("Shark");

    SBmin = Param("Swing B Min.",0.34,0.3,1,0.01);
    SBmax = Param("Swing B Max.",0.95,0.4,1,0.01);
    SCmin = Param("Swing C Min.",1.0,1.0,1.2,0.01);
    SCmax = Param("Swing C Max.",1.7,1,2.7,0.01);
    SDmin = Param("Swing D Min.(XA)",0.7,0.7,1.2,0.01);
    SDmax = Param("Swing D Max.(XA)",1.2,1.0,2.7,0.01);

    _SECTION_END();

    _SECTION_BEGIN("Gartley");

    GBmin = Param("Swing B Min.",0.55,0.3,1,0.01);
    GBmax = Param("Swing B Max.",0.72,0.4,1,0.01);
    GCmin = Param("Swing C Min.",0.38,0.3,1.27,0.01);
    GCmax = Param("Swing C Max.",1.0,0.4,1.27,0.01);
    GDmin = Param("Swing D Min.(XA)",0.55,0.3,1,0.01);
    GDmax = Param("Swing D Max.(XA)",1.0,0.4,1.0,0.01);

    _SECTION_END();

    _SECTION_BEGIN("Bat");

    BatBmin = Param("Swing B Min.",0.38,0.3,1,0.01);
    BatBmax = Param("Swing B Max.",0.55,0.4,1,0.01);
    BatCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
    BatCmax = Param("Swing C Max.",1.27,0.4,1.62,0.01);
    BatDmin = Param("Swing D Min.(XA)",0.5,0.3,1,0.01);
    BatDmax = Param("Swing D Max.(XA)",1.0,0.4,1.0,0.01);

    _SECTION_END();

    _SECTION_BEGIN("Butterfly");

    BtBmin = Param("Swing B Min.",0.55,0.3,1,0.01);
    BtBmax = Param("Swing B Max.",0.9,0.4,1,0.01);
    BtCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
    BtCmax = Param("Swing C Max.",1.27,0.4,1.62,0.01);
    BtDmin = Param("Swing D Min.(XA)",1,1,1.8,0.01);
    BtDmax = Param("Swing D Max.(XA)",1.8,1,1.8,0.01);

    _SECTION_END();


    _SECTION_BEGIN("Crab");

    CBmin = Param("Swing B Min.",0.38,0.3,1,0.01);
    CBmax = Param("Swing B Max.",0.65,0.4,1,0.01);
    CCmin = Param("Swing C Min.",0.38,0.3,1.62,0.01);
    CCmax = Param("Swing C Max.",1.270,0.4,1.62,0.01);
    CDmin = Param("Swing D Min.(XA)",1.25,1,1.8,0.01);
    CDmax = Param("Swing D Max.(XA)",1.8,1,2,0.01);

    _SECTION_END();

    _SECTION_BEGIN("AB=CD");

    abcd_Cmin = Param("Swing C Min.",0.3, 0.3 , 1, 0.01);
    abcd_Cmax = Param("Swing C Max.",0.8, 0.8 , 1, 0.01);
    abcd_Dmin = Param("Swing D Min.",1.2, 1, 2.7, 0.01);
    abcd_Dmax = Param("Swing D Max.",3.7, 1, 4, 0.01);

    _SECTION_END();

    _SECTION_BEGIN("Patterns");

    //strength = Param("Strength",5,2,15,1); // Best use: 3, 4, 5
    strength = Param("BARS of each LINE",5,2,15,1); // So luong bar cho moi duong XA, AB, BC,
    bu = ParamToggle("Bullish Pattern","Off|On",1); // So bar/lines se quyet dinh. mo^ hinh` duoc ve the' nao`
    be = ParamToggle("Bearish Pattern","Off|On",1);

    bi = Cum(1)-1;

    function GetTop(bars) // Lay' gia' tri cao nhat' = di?nh
    {
    Top = H == HHV(H,2*bars) AND Ref(HHV(H,bars),bars) bars;
    return Top;
    }

    function GetValley(bars) // La'y gia tri thap' nhat' = day'
    {
    Valley = L == LLV(L,2*bars) AND Ref(LLV(L,bars),bars) > L;
    Valley = Valley AND LastValue(bi)-ValueWhen(Valley,bi) > bars;
    return Valley;
    }


    // Build fractals array

    P1 = GetTop(strength); // so' bar cho 1 duong` XA, AB, BC, CD
    V1 = GetValley(Strength);

    P1 = IIf(P1,IIf(ValueWhen(P1,bi,2) H,False,P1)),P1);
    P1 = IIf(P1 AND ValueWhen(P1,bi,0) > bi,IIf(ValueWhen(P1,bi,0) = H,False,P1),P1),P1);
    V1 = IIf(V1,IIf(ValueWhen(V1,bi,2) bi ,IIf(ValueWhen(V1,bi,0) V1Bar1 AND V1Bar1 > P1Bar2 AND P1bar2 > V1Bar2) AND P1; // Peaks and troughs are in order

    myAX = P1H2-V1L2;
    myAB = P1H2-V1L1;
    myBC = P1H1-V1L1;

    myAB_AX = myAB/ myAX;
    myBC_AB = myBC/ myAB;

    BullGartley4 = PTvalid AND ( myAB_AX > GBmin ) AND ( myAB_AX GCMin ) AND ( myBC_AB BatBmin ) AND ( myAB_AX BatCMin ) AND ( myBC_AB BtBmin ) AND ( myAB_AX BtCmin ) AND ( myBC_AB BtBmin AND (P1H2-V1L1)/(P1H2-V1L2) BtCmin AND (P1H1-V1L1)/(P1H2-V1L1) CBmin ) AND ( myAB_AX CCmin ) AND ( myBC_AB SBmin AND (P1H2-V1L1)/(P1H2-V1L2) SCMin AND (P1H1-V1L1)/(P1H2-V1L1) ValueWhen(BullShark4,P1H2)-(ValueWhen(BullShark4,P1H2)-ValueWhen(BullShark4,V1L2))*SDmax AND
    HighestSince(BullShark4,H) abcd_Cmin) AND ( myBC_AB min
    my_d_max = myCB * abcd_DMax ;
    my_Cd_min = myC - my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Cd_max = myC - my_d_max;

    BullABCD = IIf( ( dLow my_Cd_max )
    AND ( dHigh min
    my_d_max = myAX * GDMax;
    my_Ad_min = myA - my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Ad_max = myA - my_d_max;

    BullGartley = IIf( ( dLow my_Ad_max )
    AND ( dHigh min
    my_d_max = myAX * BatDmax ;
    my_Ad_min = myA - my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Ad_max = myA - my_d_max;

    BullBat = IIf( ( dLow my_Ad_max )
    AND ( dHigh min
    my_d_max = myAX * CDmax ;
    my_Ad_min = myA - my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Ad_max = myA - my_d_max;

    BullCrab = IIf( ( dLow my_Ad_max )
    AND ( dHigh min
    my_d_max = myAX * BtDmax ;
    my_Ad_min = myA - my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Ad_max = myA - my_d_max;

    BullButterfly = IIf( ( dLow my_Ad_max ) AND ( dHigh ValueWhen(BullButterfly4,P1H2)-(ValueWhen(BullButterfly4,P1H2)-ValueWhen(BullButterfly4,V1L2))*BtDmax AND HighestSince(BullButterfly4,H) bi ,False,BullHar),BullHar);

    A = ValueWhen(BullHar4,P1H2);
    Abar = ValueWhen(BullHar4,P1bar2);
    B = ValueWhen(BullHar4,V1L1);
    Bbar = ValueWhen(BullHar4,V1bar1);
    C1 = ValueWhen(BullHar4,P1H1);
    C1bar = ValueWhen(BullHar4,P1bar1);
    D = ValueWhen(BullHar,L);
    Dbar = ValueWhen(BullHar,bi);

    BCdAB = (C1-B)/(A-B);
    BCdCD = (C1-D)/(C1-B);

    PlotPattern = Dbar > C1bar;

    if(LastValue(PlotPattern) AND bu)
    {
    ColorX = colorGreen;
    // Ve cac duong AB, BC, CD
    Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"",ColorX ,styleDashed);
    Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",ColorX ,styleDashed);

    // Ve cac gia tri Fibo
    PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,ColorX );
    PlotText(NumToStr(LastValue(BCdCD),1.2),(LastValue(Bbar)+LastValue(Dbar))/2,(LastValue(B)+LastValue(D))/2,ColorX );

    //---------- Viet cac diem X, A, B, C, D: by binhnd---------------------
    xlech = 0;
    ylech = 2;
    PlotText("A",LastValue(Abar) + xlech, LastValue(A) + ylech, ColorX );
    PlotText("B",LastValue(Bbar) + xlech, LastValue(B) - ylech, ColorX );
    PlotText("C",LastValue(C1bar) + xlech, LastValue(C1) + ylech, ColorX );
    PlotText("D",LastValue(Dbar) + xlech, LastValue(D) - ylech, ColorX );

    //--------- Viet thuyet minh mo hinh: by binhnd--------------
    if (strPattern!="")
    {
    myStr = "Pattern: BULLISH AB=CD";
    toadoX = LastValue(Abar);
    toadoY = LastValue(D);

    PlotText(myStr,toadoX,toadoY,ColorX );
    }

    } // end of Ve duong` bullish abcd



    //==========================================================
    // VE DUONG CHO MO HINH BULLISH BAT, GARTLEY, BUTTERFLY, CRAB
    //==========================================================


    BullHar4 = BullGartley4 OR BullButterfly4 OR BullBat4 OR BullCrab4 OR BullShark4;
    BullHar = BullGartley OR BullButterfly OR BullBat OR BullCrab OR BullShark;

    Point4 = IIf(BullHar,ValueWhen(BullHar4,bi),Null);
    BullHar = IIf(BullHar, IIf(Point4 == ValueWhen(BullHar,point4,0) AND ValueWhen(BullHar,bi,0) > bi ,False,BullHar),BullHar);

    X = ValueWhen(BullHar4,V1L2);
    Xbar = ValueWhen(BullHar4,V1Bar2);
    A = ValueWhen(BullHar4,P1H2);
    Abar = ValueWhen(BullHar4,P1bar2);
    B = ValueWhen(BullHar4,V1L1);
    Bbar = ValueWhen(BullHar4,V1bar1);
    C1 = ValueWhen(BullHar4,P1H1);
    C1bar = ValueWhen(BullHar4,P1bar1);
    D = ValueWhen(BullHar,L);
    Dbar = ValueWhen(BullHar,bi);

    ABdXA = (A-B)/(A-X);
    BCdAB = (C1-B)/(A-B);
    ADdXA = (A-D)/(A-X);
    BCdCD = (C1-D)/(C1-B);

    PlotPattern = Dbar > C1bar;

    if(LastValue(PlotPattern) AND bu)
    {
    ColorX = colorBlue;
    // Ve cac duong XA, AB, BC, CD
    Plot( LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",ColorX,styleThick);
    Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",ColorX,styleThick);
    Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"",ColorX,styleThick);
    Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"",ColorX,styleThick);
    Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Bbar),LastValue(B)),"",ColorX,styleDashed);
    Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",ColorX,styleThick);
    Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"",ColorX,styleDashed);
    Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",ColorX,styleDashed);
    Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Dbar),LastValue(D)),"",ColorX,styleDashed);

    // Ve cac gia tri Fibo
    PlotText(NumToStr(LastValue(ABdXA),1.2),(LastValue(Bbar)+LastValue(Xbar))/2,(LastValue(B)+LastValue(X))/2,ColorX);
    PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,ColorX);
    PlotText(NumToStr(LastValue(ADdXA),1.2) ,(LastValue(Dbar)+LastValue(Xbar))/2,(LastValue(D)+LastValue(X))/2,ColorX);
    PlotText(NumToStr(LastValue(BCdCD),1.2),(LastValue(Bbar)+LastValue(Dbar))/2,(LastValue(B)+LastValue(D))/2,ColorX);

    //---------- Viet cac diem X, A, B, C, D: by binhnd---------------------
    xlech = 0;
    ylech = 2;
    PlotText("X",LastValue(Xbar) + xlech, LastValue(X) - ylech, ColorX);
    PlotText("A",LastValue(Abar) + xlech, LastValue(A) + ylech, ColorX);
    PlotText("B",LastValue(Bbar) + xlech, LastValue(B) - ylech, ColorX);
    PlotText("C",LastValue(C1bar) + xlech, LastValue(C1) + ylech, ColorX);
    PlotText("D",LastValue(Dbar) + xlech, LastValue(D) - ylech, ColorX);

    //--------- Viet thuyet minh mo hinh: by binhnd--------------
    if (strPattern!="")
    {
    strPattern = "Pattern: " + strPattern;
    toadoX = (LastValue(Dbar)+LastValue(Xbar))/2;
    toadoY = (LastValue(D)+LastValue(X))/2;

    PlotText(strPattern,toadoX,toadoY-2,ColorX);
    }

    } // end of Ve duong cho cac mo hinh Crab, Butterfly, Bat


    //=============================================================
    // BEARISH PATTERNS
    //=============================================================

    PTvalid = (V1Bar1 > P1Bar1 AND P1Bar1 > V1Bar2 AND V1Bar2 > P1Bar2) AND V1;

    myAX = P1H2-V1L2;
    myAB = P1H1-V1L2;
    myBC = P1H1-V1L1;

    myAB_AX = myAB/ myAX;
    myBC_AB = myBC/ myAB;

    BearGartley4 = PTvalid AND ( myAB_AX > GBmin ) AND ( myAB_AX GCMin ) AND ( myBC_AB BatBmin ) AND ( myAB_AX BatCMin ) AND ( myBC_AB BtBmin ) AND ( myAB_AX BtCmin ) AND ( myBC_AB BtBmin AND (P1H1-V1L2)/(P1H2-V1L2) BtCmin AND (P1H1-V1L1)/(P1H1-V1L2) CBmin ) AND ( myAB_AX CCmin ) AND ( myBC_AB SBmin AND (P1H1-V1L2)/(P1H2-V1L2) SCmin AND (P1H1-V1L1)/(P1H1-V1L2) ValueWhen(BearShark4,V1L2) + (ValueWhen(BearShark4,P1H2) - ValueWhen(BearShark4,V1L2))*SDmin AND
    HighestSince(bearShark4,H) = ValueWhen(BearShark4,V1L1 ) AND
    HighestSince(BearShark4,H) == H, True, False);
    BearShark = BearShark AND HighestSince(BearShark4,H) > ValueWhen(BearShark4,P1H1);


    BearABCD4 = PTvalid AND ( myBC_AB > abcd_Cmin) AND ( myBC_AB min
    my_d_max = myCB * abcd_DMax ;
    my_Cd_min = myC + my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Cd_max = myC + my_d_max;

    BearABCD = IIf( ( dHigh > my_Cd_min ) AND ( dHigh = myC ) AND ( dHigh == H),
    True, False
    );

    BearABCD = BearABCD AND (dHigh > myB);

    //=============================================================
    // BEARISH GARTLEY
    //=============================================================
    dHigh = HighestSince(BearGartley4,H); // Tinh' gia' tri min, max cua duong Ad. Duong Ad la duong con cua AD
    dLow = LowestSince(BearGartley4,L);

    myX = ValueWhen(BearGartley4,P1H2);
    myA = ValueWhen(BearGartley4,V1L2);
    myAX = myX - myA;

    myB = ValueWhen(BearGartley4,P1H1);
    myC = ValueWhen(BearGartley4,V1L1);


    my_d_min = myAX * GDmin; // Tinh' gia' tri cua duong Ad con. Khi gia' giam? tu` tre^n xuong' thi` max -> min
    my_d_max = myAX * GDMax;
    my_Ad_min = myA + my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Ad_max = myA + my_d_max;

    BearGartley = IIf( ( dHigh > my_Ad_min ) AND ( dHigh = myC ) AND ( dHigh == H),
    True, False
    );
    BearGartley = BearGartley AND (dHigh > myB); // diem D cao hon B
    strPattern = WriteIf(BearGartley ,"BEARISH GARTLEY",strPattern);

    //=============================================================
    // BEARISH BAT
    //=============================================================
    dHigh = HighestSince(BearBat4,H); // Tinh' gia' tri min, max cua duong Ad. Duong Ad la duong con cua AD
    dLow = LowestSince(BearBat4,L);

    myX = ValueWhen(BearBat4,P1H2);
    myA = ValueWhen(BearBat4,V1L2);
    myAX = myX - myA;

    myB = ValueWhen(BearBat4,P1H1);
    myC = ValueWhen(BearBat4,V1L1);


    my_d_min = myAX * BatDmin ; // Tinh' gia' tri cua duong Ad con. Khi gia' giam? tu` tre^n xuong' thi` max -> min
    my_d_max = myAX * BatDMax ;
    my_Ad_min = myA + my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Ad_max = myA + my_d_max;

    BearBat = IIf( ( dHigh > my_Ad_min ) AND ( dHigh = myC ) AND ( dHigh == H),
    True, False
    );
    BearBat = BearBat AND (dHigh > myB); // diem D cao hon B
    strPattern = WriteIf(BearBat ,"BEARISH BAT",strPattern);


    //=============================================================
    // BEARISH BUTTERFLY
    //=============================================================
    dHigh = HighestSince(BearButterfly4,H); // Tinh' gia' tri min, max cua duong Ad. Duong Ad la duong con cua AD
    dLow = LowestSince(BearButterfly4,L);

    myX = ValueWhen(BearButterfly4,P1H2);
    myA = ValueWhen(BearButterfly4,V1L2);
    myAX = myX - myA;

    myB = ValueWhen(BearButterfly4,P1H1);
    myC = ValueWhen(BearButterfly4,V1L1);


    my_d_min = myAX * BtDmin ; // Tinh' gia' tri cua duong Ad con. Khi gia' giam? tu` tre^n xuong' thi` max -> min
    my_d_max = myAX * BtDmax ;
    my_Ad_min = myA + my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Ad_max = myA + my_d_max;

    BearButterfly = IIf( ( dHigh > my_Ad_min ) AND ( dHigh = myC ) AND ( dHigh == H), True, False);
    BearButterfly = BearButterfly AND (dHigh > myX);

    BearButterfly = IIf(HighestSince(BearButterfly4,H) > ValueWhen(BearButterfly4,V1L2) + (ValueWhen(BearButterfly4,P1H2) - ValueWhen(BearButterfly4,V1L2))*BtDmin AND HighestSince(BearButterfly4,H) = ValueWhen(BearButterfly4,V1L1 ) AND HighestSince(BearButterfly4,H) == H, True, False);
    BearButterfly = BearButterfly AND HighestSince(BearButterfly4,H) > ValueWhen(BearButterfly4,P1H2);

    strPattern = WriteIf(BearButterfly ,"BEARISH BUTTERFLY",strPattern);



    //=============================================================
    // BEARISH CRAB
    //=============================================================
    dHigh = HighestSince(BearCrab4,H); // Tinh' gia' tri min, max cua duong Ad. Duong Ad la duong con cua AD
    dLow = LowestSince(BearCrab4,L);

    myX = ValueWhen(BearCrab4,P1H2);
    myA = ValueWhen(BearCrab4,V1L2);
    myAX = myX - myA;

    myB = ValueWhen(BearCrab4,P1H1);
    myC = ValueWhen(BearCrab4,V1L1);


    my_d_min = myAX * CDmin ; // Tinh' gia' tri cua duong Ad con. Khi gia' giam? tu` tre^n xuong' thi` max -> min
    my_d_max = myAX * CDmax ;
    my_Ad_min = myA + my_d_min; // Khoang dich chuyen cua duong Ad con.
    my_Ad_max = myA + my_d_max;

    BearCrab = IIf( ( dHigh > my_Ad_min ) AND ( dHigh = myC ) AND ( dHigh == H),
    True, False
    );
    BearCrab = BearCrab AND (dHigh > myX); // diem D cao hon X
    strPattern = WriteIf(BearCrab ,"BEARISH CRAB",strPattern);



    //==========================================================
    // VE DUONG CHO MO HINH BEARISH ABCD
    //==========================================================


    BearHar4 = BearABCD4;
    BearHar = BearABCD;

    Point4 = IIf(BearHar,ValueWhen(BearHar4,bi),Null);
    BearHar = IIf(BearHar, IIf(Point4 == ValueWhen(BearHar,point4,0) AND ValueWhen(BearHar,bi,0) > bi ,False,BearHar),BearHar);

    A = ValueWhen(BearHar4,V1L2);
    Abar = ValueWhen( BearHar4,V1bar2);
    B = ValueWhen(BearHar4,P1H1);
    Bbar = ValueWhen(BearHar4,P1bar1);
    C1 = ValueWhen(BearHar4,V1L1);
    C1bar = ValueWhen(BearHar4,V1bar1);
    D = ValueWhen(BearHar,H);
    Dbar = ValueWhen(BearHar,bi);

    BCdAB = (B-C1)/(B-A);
    BCdCD = (D-C1)/(B-C1);

    PlotPattern = Dbar > C1bar;

    //--------- Ve duong ------------------
    if(LastValue(Plotpattern) AND be)
    {
    ColorX = colorYellow;
    // Ve duong AB, BC
    Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"",ColorX ,styleDashed);
    Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",ColorX ,styleDashed);

    // Viet cac gia tri Fibo tren duong AB, BC
    PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,ColorX );
    PlotText(NumToStr(LastValue(BCdCD),1.2) ,(LastValue(Dbar)+LastValue(Bbar))/2,(LastValue(D)+LastValue(B))/2,ColorX );

    //---------- Viet cac diem A, B, C, D: by binhnd---------------------
    xlech = -1;
    ylech = 1;
    PlotText("A",LastValue(Abar) + xlech, LastValue(A) - ylech, ColorX );
    PlotText("B",LastValue(Bbar) + xlech, LastValue(B) + ylech, ColorX );
    PlotText("C",LastValue(C1bar) + xlech, LastValue(C1) - ylech, ColorX );
    PlotText("D",LastValue(Dbar) + xlech, LastValue(D) + ylech, ColorX );

    //--------- Viet thuyet minh mo hinh: by binhnd--------------
    if (strPattern!="")
    {
    myStr = "Pattern: BEARISH AB=CD";
    toadoaX = LastValue(Abar);
    toadoY = LastValue(D);

    PlotText(myStr,toadoaX,toadoY+1,ColorX );
    }

    } // end of VE DUONG CHO MO HINH BEARISH ABCD


    //==========================================================
    // VE DUONG CHO MO HINH BEARISH BAT, GARTLEY, BUTTERFLY, CRAB
    //==========================================================

    BearHar4 = BearGartley4 OR BearButterfly4 OR BearBat4 OR BearCrab4 OR BearShark4 ;
    BearHar = BearGartley OR BearButterfly OR BearBat OR BearCrab OR BearShark;

    Point4 = IIf(BearHar,ValueWhen(BearHar4,bi),Null);
    BearHar = IIf(BearHar, IIf(Point4 == ValueWhen(BearHar,point4,0) AND ValueWhen(BearHar,bi,0) > bi ,False,BearHar),BearHar);

    X = ValueWhen(BearHar4,P1H2);
    Xbar = ValueWhen(BearHar4,P1Bar2);
    A = ValueWhen(BearHar4,V1L2);
    Abar = ValueWhen( BearHar4,V1bar2);
    B = ValueWhen(BearHar4,P1H1);
    Bbar = ValueWhen(BearHar4,P1bar1);
    C1 = ValueWhen(BearHar4,V1L1);
    C1bar = ValueWhen(BearHar4,V1bar1);
    D = ValueWhen(BearHar,H);
    Dbar = ValueWhen(BearHar,bi);

    ABdXA = (B-A)/(X-A);
    BCdAB = (B-C1)/(B-A);
    ADdXA = (D-A)/(X-A);
    BCdCD = (D-C1)/(B-C1);

    PlotPattern = Dbar > C1bar;

    //--------- Ve duong ------------------
    if(LastValue(Plotpattern) AND be)
    {
    ColorX = colorRed;
    // Ve duong XA, AB, BC
    Plot( LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(Bbar),LastValue(B)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(C1bar),LastValue(C1)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(C1bar),LastValue(C1),LastValue(Dbar),LastValue(D)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Bbar),LastValue(B)),"",ColorX ,styleDashed);
    Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Abar),LastValue(A)),"",ColorX ,styleThick);
    Plot(LineArray(LastValue(Abar),LastValue(A),LastValue(C1bar),LastValue(C1)),"",ColorX ,styleDashed);
    Plot(LineArray(LastValue(Bbar),LastValue(B),LastValue(Dbar),LastValue(D)),"",ColorX ,styleDashed);
    Plot(LineArray(LastValue(Xbar),LastValue(X),LastValue(Dbar),LastValue(D)),"",ColorX ,styleDashed);

    // Viet cac gia tri Fibo tren duong XA, AB, BC
    PlotText(NumToStr(LastValue(ABdXA),1.2),(LastValue(Bbar)+LastValue(Xbar))/2,(LastValue(B)+LastValue(X))/2,ColorX );
    PlotText(NumToStr(LastValue(BCdAB),1.2),(LastValue(C1bar)+LastValue(Abar))/2,(LastValue(C1)+LastValue(A))/2,ColorX );
    PlotText(NumToStr(LastValue(BCdCD),1.2) ,(LastValue(Dbar)+LastValue(Bbar))/2,(LastValue(D)+LastValue(B))/2,ColorX );
    PlotText(NumToStr(LastValue(ADdXA),1.2) ,(LastValue(Dbar)+LastValue(Xbar))/2,(LastValue(D)+LastValue(X))/2,ColorX );

    //---------- Viet cac diem X, A, B, C, D: by binhnd---------------------
    xlech = -1;
    ylech = 1;
    PlotText("X",LastValue(Xbar) + xlech, LastValue(X) + ylech, ColorX );
    PlotText("A",LastValue(Abar) + xlech, LastValue(A) - ylech, ColorX );
    PlotText("B",LastValue(Bbar) + xlech, LastValue(B) + ylech, ColorX );
    PlotText("C",LastValue(C1bar) + xlech, LastValue(C1) - ylech, ColorX );
    PlotText("D",LastValue(Dbar) + xlech, LastValue(D) + ylech, ColorX );

    //--------- Viet thuyet minh mo hinh: by binhnd--------------
    if (strPattern!="")
    {
    strPattern = "Pattern: " + strPattern;
    toadoaX = (LastValue(Dbar)+LastValue(Xbar))/2;
    toadoY = (LastValue(D)+LastValue(X))/2;

    PlotText(strPattern,toadoaX,toadoY+1,ColorX );
    }

    } // end of VE DUONG CHO MO HINH BEARISH BAT, GARTLEY, BUTTERFLY, CRAB

    //=================================
    // Show diem ho^~ tro. va` khang' cu. ko?
    //=================================

    plotFractals = ParamToggle("Plot Fractals","Off|On",1);
    if(PlotFractals)
    {
    }
    //==============================================
    // DAT DIEU KIEN cho TIM KIEM BULL
    //==============================================
    dkBull = False;
    ListBull = ParamList("Type of Bullish", "None|AB=CD|Gartley|Butterfly|Bat|Crab|All Patterns", 6);
    if ( ListBull == "None" ) dkBull = True;
    if ( ListBull =="AB=CD" ) dkBull = BullABCD ;
    if ( ListBull =="Gartley" ) dkBull = BullGartley ;
    if ( ListBull =="Butterfly" ) dkBull = BullButterfly ;
    if ( ListBull =="Bat" ) dkBull = BullBat ;
    if ( ListBull =="Crab" ) dkBull = BullCrab ;
    if ( ListBull =="All Patterns") dkBull = (BullABCD) OR (BullGartley) OR (BullButterfly ) OR (BullBat ) OR (BullCrab);

    //==============================================
    // DAT DIEU KIEN cho TIM KIEM BEAR
    //==============================================
    dkBear = False;
    ListBear = ParamList("Type of Bearish", "None|AB=CD|Gartley|Butterfly|Bat|Crab|All Patterns", 0);
    if ( ListBear == "None" ) dkBear = True;
    if ( ListBear =="AB=CD" ) dkBear = BearABCD ;
    if ( ListBear =="Gartley" ) dkBear = BearGartley ;
    if ( ListBear =="Butterfly" ) dkBear = BearButterfly ;
    if ( ListBear =="Bat" ) dkBear = BearBat ;
    if ( ListBear =="Crab" ) dkBear = BearCrab ;
    if ( ListBear =="All Patterns") dkBear = (BearABCD ) OR (BearGartley ) OR (BearButterfly ) OR (BearBat ) OR (BearCrab );
    //===============================
    PlotShapes(shapeSmallCircle*P1,12,0,H,5);
    PlotShapes(shapeSmallCircle*V1,11,0,L,-5);

    PlotShapes(shapeSmallCircle*(Bullbat OR bullcrab OR bullbutterfly OR bullgartley OR bullabcd),5,0,L,-25);
    PlotShapes(shapeSmallCircle*(Bearbat OR bearcrab OR bearbutterfly OR beargartley OR bearabcd),40,0,H,25);
    PlotShapes(shapeStar*(BullABCD),5,0,L,-15);
    PlotShapes(shapeStar*(BearABCD),40,0,H,15);
    PlotShapes(shapeUpArrow*(Bullhar) ,29,0,L, -25);
    PlotShapes(shapeDownArrow*(Bearhar),17,0,H, -25);
    bullpat = (Bullbat OR bullcrab OR bullbutterfly OR bullgartley OR BullShark);
    bearpat = (Bearbat OR bearcrab OR bearbutterfly OR beargartley OR BearShark);

    bullhabcd = bullhar AND bullabcd;
    bearhabcd = bearhar AND bearabcd;

    LatPattern = bullHar OR bearHar OR bullhabcd OR bearhabcd;
    Lastpattern = LastValue(ValueWhen(LatPattern,IIf(BullGartley,1,IIf(BearGartley,-1,IIf(BullBat,2,IIf(BearBat,-2,
    IIf(BullButterfly,3,IIf(BearButterfly,-3,IIf(BullCrab,4,IIf(BearCrab,-4,IIf(BullShark,5,IIf(BearShark,-5,Null))))))))))));

    PatternName = WriteIf(LastPattern == 1,"Bullish Gartley",WriteIf(LastPattern == -1,"Bearish Gartley",WriteIf(LastPattern == 2,"Bullish Bat",
    WriteIf(LastPattern == -2,"Bearish Bat",WriteIf(LastPattern == 3,"Bullish Butterfly",WriteIf(LastPattern == -3,"Bearish Butterfly",
    WriteIf(LastPattern == 4,"Bullish Crab",WriteIf(LastPattern == -4,"Bearish Crab",WriteIf(LastPattern == 5,"Bullish Shark",WriteIf(LastPattern == -5,"Bearish Shark"," ")))))))))) ;

    Filter =V>=10
    AND (bullpat OR bearpat OR bearabcd OR bullabcd)
    ;
    Last edited: 05/06/2018
    PDL, Nguyenbinh234, Rose20181 người khác thích bài này.
  9. ThanhToan_CEO

    ThanhToan_CEO Thành viên này đang bị tạm khóa Đang bị khóa Not Official

    Tham gia ngày:
    23/10/2017
    Đã được thích:
    1.709
    Kết phiên nay chính thức xác nhận
    Mai TT chính thức ván mới nhé các bác
    :-B
  10. Tony_Matrix

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

    Tham gia ngày:
    08/05/2017
    Đã được thích:
    77
    suốt ngày phân tích vậy mà chơi vẫn thua. ra làm con đề cho nhanh đỡ đau đầu

Chia sẻ trang này