1. THÔNG BÁO VỀ VIỆC TUÂN THỦ QUY ĐỊNH PHÁP LUẬT KHI THAM GIA DIỄN ĐÀN

    Đề nghị toàn thể thành viên diễn đàn nghiêm túc tuân thủ Luật Chứng khoán, các quy định của Ủy ban Chứng khoán Nhà nước, đồng thời tuân thủ các quy định pháp luật liên quan đến an ninh mạng, giao dịch điện tử và trách nhiệm cá nhân khi đăng tải, chia sẻ thông tin trên môi trường mạng, bao gồm các quy định tại Nghị định 174/2026/NĐ-CP. xem thêm

Xin code Candles

Discussion in 'Thị trường chứng khoán' started by MrLeo, Jan 3, 2020.

Có 1742 người đang online, trong đó có 93 thành viên. 11:45 (UTC+07:00) Bangkok, Hanoi, Jakarta
  1. Có 1 người đang xem box này(Thành viên: 0, Khách: 1)
thread_has_x_view_and_y_reply
  1. MrLeo

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

    Joined:
    Dec 24, 2017
    Likes Received:
    47
    Có cao thủ nào có code nến dạng này không cho mình xin với. Cảm ơn.

    [​IMG]
    --- Gộp bài viết, Jan 3, 2020, Bài cũ: Jan 3, 2020 ---
    Có ai có không nhỉ...:bz:bz:bz
  2. VPBankQuan

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

    Joined:
    Jun 22, 2015
    Likes Received:
    11,908
  3. MrLeo

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

    Joined:
    Dec 24, 2017
    Likes Received:
    47
    Chỉ có 3 màu xanh, đỏ, trắng mà đâu có vàng.
    MrLeo đã loan bài này
  4. romitna

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

    Joined:
    Jul 31, 2019
    Likes Received:
    98
    Code được, quan trọng là rule như thế nào.
    MrLeo likes this.
  5. MrLeo

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

    Joined:
    Dec 24, 2017
    Likes Received:
    47
    Bác xem đoạn này thử giúp em. Cảm ơn:
    ======

    #include_once

    _SECTION_BEGIN("MACD Trend");
    if (Nz(VarGet("runonce_Basic")) == 0) {
    VarSet("runonce_Basic",1);
    CellHeight = Param("Cell Height",20,5,200,1);
    CellWidth = Param("Cell Width",120,5,200,1);
    PanelYoffset = Param("Cell Row Offset (px)",15,0,Status("pxheight"),1);
    PanelXoffset = Param("Cell Column Offset (px)",10,0,Status("pxwidth"),1);
    FontRatio = Param("Font: CellHeight ratio",2,1,20,0.1);
    Triger =1;


    Column_Begin( "1");
    Triger = TriggerCell( "TEST MODUS OFF", "TEST MODUS ON", colorRed, colorBrightGreen, colorBlack);
    Column_End( );

    TestModus = Nz(StaticVarGet("TestModus"), OFF);

    TP = LastValue(C);
    PV = StaticVarGet("PV");
    PV = IIf(IsNull(PV), V, PV);

    if (Triger == 0)
    {
    if ( GetCursorMouseButtons() & 9 )
    {
    TP = Nz(GetCursorYPosition(),Nz(StaticVarGet("TestPrice"),LastValue(C)));

    StaticVarSet("TestPrice", TP);
    }
    else {
    TP = Nz(StaticVarGet("TestPrice"),LastValue(C));
    }
    }
    else
    TP = LastValue(C);

    if (TestModus==OFF) {
    TP = LastValue(C);
    PC = C;
    PH = H;
    PL = L;
    PTypical = Avg;
    }
    else {
    PC = FA_Price(3);
    PH = FA_Price(1);
    PL = FA_Price(2);
    PTypical = FA_Price(5);
    }

    StaticVarSet("TP", TP );
    StaticVarSet("PC", PC );
    StaticVarSet("PL", PL );
    StaticVarSet("PH", PH );
    StaticVarSet("PTypical", PTypical);

    SetChartOptions(0,chartShowArrows|chartShowDates);


    _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( PV, 1.0 ) +" {{VALUES}}", O, PH, PL, PC, SelectedValue( ROC( PC, 1 )) ));

    PriceStyle = GetPriceStyle();
    PriceStyleOpt = ParamStyle("Price Style")|PriceStyle;


    Type = ParamList("Type", "Simple,Exponential,Double Exponential,Tripple Exponential,Wilders,Weighted,Least Squares,Time Series Forecast");

    r1 = Param( "Fast avg", 12, 2, 200, 1 );
    r2 = Param( "Slow avg", 26, 2, 200, 1 );
    r3 = Param( "Signal avg", 9, 2, 200, 1 );

    if( Type == "Simple" ) Option = 1;
    if( Type == "Exponential" ) Option = 2;
    if( Type == "Double Exponential" ) Option = 3;
    if( Type == "Tripple Exponential" ) Option = 4;
    if( Type == "Wilders" ) Option = 5;
    if( Type == "Weighted" ) Option = 6;
    if( Type == "Least Squares" ) Option = 7;
    if( Type == "Time Series Forecast" ) Option = 8;

    m = FA_MACD(r1,r2);
    s = FA_Signal(m,r3, Option);

    trendup = m > 0 AND m > s;
    trenddown = m < 0 AND m < s;

    upColor = IIf(trendup , colorGreen, colorWhite);

    trendcolor = IIf(trenddown, colorRed, upColor );


    shape = trendup * shapeSmallUpTriangle + trenddown * shapeSmallDownTriangle;

    if (PriceStyle==styleCandle)
    Plot( PC, "Close", IIf( trendup, colorGreen, IIf(trenddown, colorRed ,colorWhite)), styleNoTitle | ParamStyle("Style") | PriceStyleOpt );
    else
    Plot( PC, "Close", IIf( trendup, colorGreen, IIf(trenddown, colorRed ,colorWhite)), styleLine);
    }
    _SECTION_END();
    MrLeo đã loan bài này
  6. romitna

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

    Joined:
    Jul 31, 2019
    Likes Received:
    98
    Ví dụ theo cái Rule đơn giản

    m =MACD(r1,r2);
    s = Signal(r1,r2,r3);
    trendup = m > 0 AND m > s;
    trenddown = m 0 AND m > s;
    trenddown = m < 0 AND m < s;
    Plot(C, "Close", IIf( trendup, colorGreen, IIf(trenddown, colorRed ,colorWhite)), styleNoTitle | styleCandle );
    _SECTION_END();

    Quan trọng là rule thế nào thôi mà
    MrLeo likes this.
  7. MrLeo

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

    Joined:
    Dec 24, 2017
    Likes Received:
    47
    Kết quả cũng gần giống nhỉ. Cảm ơn Bác nhiều.
    Last edited: Jan 7, 2020

Share This Page