Interesting LT system for Candlestick Aficionados

Discussion in 'Strategy Development' started by andrasnm, Dec 4, 2005.

  1. When Chikou and others are red - the market is selling off
    when it is green you should be long...
    [​IMG]
     
  2. var A, B, C, D, E, F, G, H, I, J,K: float;
    var TENKANSEN, KIJUNSEN, SENA, SENB, CHIKOU, BAR, x: integer;
    var per1,per2,per3:integer ;
    TenkanSen := CreateSeries;
    KijunSen := CreateSeries;
    SenA := CreateSeries;
    SenB := CreateSeries;
    Chikou := CreateSeries;
    setbarcolors(#white,#white);
    hidevolume;
    per1:=7;
    per2:=22;
    per3:=44;
    for Bar := 45 to BarCount -1 do
    begin //1

    a := @HighestSeries(#High, per1)[Bar];
    b := @LowestSeries(#Low, per1)[Bar];
    c := (a+b)/2;
    d := @HighestSeries(#High,per2)[Bar];
    e := @LowestSeries(#Low, per2)[Bar];
    f := (d+e)/2;
    g := (c+f)/2;
    h := @HighestSeries(#High, per3)[Bar];
    i := @LowestSeries(#Low, per3)[Bar];
    j := (h+i)/2;
    k := priceclose(bar);
    @TenkanSen[Bar] := c;
    @KijunSen[Bar] := f;
    @SenA[Bar] := g;
    @SenB[Bar] := j;
    @Chikou[Bar] := k;
    end; // 1end


    var TEN_OFF,KI_OFF,A_OFF,B_OFF,CI_OFF:integer ;
    var H_OFF,L_OFF,O_OFF,C_OFF:integer;
    var OFF_PANE:integer;
    var FIX:float;
    TEN_OFF:=createseries;
    KI_OFF:=createseries;
    A_OFF:=createseries;
    B_OFF:=createseries;
    CI_OFF:=createseries;
    H_OFF :=createseries;
    L_OFF:=createseries;
    O_OFF:=createseries;
    C_OFF:=createseries;
    //Cikou 2*22 nach hinten
    for bar:=44 to barcount -1 do begin //2
    if bar<barcount-2*per2 then begin //3
    setseriesvalue(bar,CI_OFF,@Chikou[bar+2*per2]);
    FIX:=Priceclose(bar);
    end //3end
    else begin //4
    setseriesvalue(bar,CI_OFF,FIX) ;
    end; //4end
    end; //2end
    //colour last 2*per2 bars White
    for Bar := 0 to BarCount - 1 do
    if bar<barcount-2*per2 then
    SetSeriesBarColor( Bar, CI_OFF, #lime)
    else
    SetSeriesBarColor( Bar, CI_OFF, #white );
    ///Chihou END

    ///OHLC SET per2 BARS LEFT
    for bar:=44 to barcount -1 do begin //5
    if bar<barcount-per2 then begin //6
    setseriesvalue(bar,C_OFF,@#Close[bar+per2]);
    setseriesvalue(bar,O_OFF,@#Open[bar+per2]);
    setseriesvalue(bar,L_OFF,@#Low[bar+per2]);
    setseriesvalue(bar,H_OFF,@#HIGH[bar+per2]);
    setseriesvalue(bar,TEN_OFF,@TenkanSen[bar+per2]);
    setseriesvalue(bar,KI_OFF,@KijunSen[bar+per2]);
    FIX:=Priceclose(bar);
    end //6end
    else begin //7
    setseriesvalue(bar,C_OFF,FIX);
    setseriesvalue(bar,O_OFF,FIX);
    setseriesvalue(bar,H_OFF,FIX);
    setseriesvalue(bar,L_OFF,FIX);
    setseriesvalue(bar,TEN_OFF,FIX);
    setseriesvalue(bar,KI_OFF,FIX);
    end; //7end
    end; //5end

    //colour last per2 bars White
    for Bar := 0 to BarCount - 1 do
    if bar<barcount-per2 then begin //8
    SetSeriesBarColor( Bar, C_OFF, #black) ;
    SetSeriesBarColor( Bar, O_OFF, #black) ;
    SetSeriesBarColor( Bar, L_OFF, #black) ;
    SetSeriesBarColor( Bar, H_OFF, #black) ;
    SetSeriesBarColor( Bar, TEN_OFF, #blue) ;
    SetSeriesBarColor( Bar, KI_OFF, #red) ;
    end //8end
    else
    begin //9
    SetSeriesBarColor( Bar, C_OFF, #white );
    SetSeriesBarColor( Bar, C_OFF, #white );
    SetSeriesBarColor( Bar, C_OFF, #white );
    SetSeriesBarColor( Bar, C_OFF, #white );
    SetSeriesBarColor( Bar, TEN_OFF,#white) ;
    SetSeriesBarColor( Bar, KI_OFF, #white) ;
    end; //9end
    PlotSyntheticSymbol('OHLC_OFF',O_OFF,H_OFF,L_OFF,C_OFF,0,#black,#ohlc);


    VAR T1,T2,T3,T4,T5,T1_pane,T2_pane,T3_Pane,T4_pane,T5_pane:integer;
    T1:=createseries;
    T2:=createseries;
    T3:=createseries;
    T4:=createseries;
    T5:=createseries;
    //CLOSE ABOVE CLOUD ?
    for bar:=44 to barcount -per2-1 do begin //10
    if (getseriesvalue(bar,C_OFF)>Getseriesvalue(bar,SenA)) and
    (getseriesvalue(bar,C_OFF)>Getseriesvalue(bar,SenB))then
    begin //11
    setseriesvalue(bar,T1,10) ;
    setseriesbarcolor(bar,T1,#green);
    end; //11end
    if (getseriesvalue(bar,C_OFF)<Getseriesvalue(bar,SenA)) and
    (getseriesvalue(bar,C_OFF)<Getseriesvalue(bar,SenB))then
    begin //12
    setseriesvalue(bar,T1,-10) ;
    setseriesbarcolor(bar,T1,#red);
    end;
    //TEN>KI ? //12end
    if Getseriesvalue(bar,TEN_OFF)>Getseriesvalue(bar,KI_OFF) then
    begin
    Setseriesvalue(bar,T2,10) ;
    setseriesbarcolor(bar,T2,#green);
    end
    else begin
    Setseriesvalue(bar,T2,-10);
    setseriesbarcolor(bar,T2,#red);
    end;
    //TEN & KI > CLOUD ?
    if (Getseriesvalue(bar,TEN_OFF) > Getseriesvalue(bar,SENA)) AND
    (Getseriesvalue(bar,TEN_OFF) > Getseriesvalue(bar,SENB)) AND
    (Getseriesvalue(bar,KI_OFF) > Getseriesvalue(bar,SENA)) AND
    (Getseriesvalue(bar,KI_OFF) > Getseriesvalue(bar,SENB))
    then begin
    Setseriesvalue(bar,T3,10) ;
    setseriesbarcolor(bar,T3,#green);
    end;
    if (Getseriesvalue(bar,TEN_OFF) < Getseriesvalue(bar,SENA)) AND
    (Getseriesvalue(bar,TEN_OFF) < Getseriesvalue(bar,SENB)) AND
    (Getseriesvalue(bar,KI_OFF) < Getseriesvalue(bar,SENA)) AND
    (Getseriesvalue(bar,KI_OFF) < Getseriesvalue(bar,SENB))
    then begin
    Setseriesvalue(bar,T3,-10) ;
    setseriesbarcolor(bar,T3,#red);
    end;
    //Chikou
    if (getseriesvalue(bar,C_OFF)>Getseriesvalue(bar,#close)) then
    begin //11
    setseriesvalue(bar,T4,10) ;
    setseriesbarcolor(bar,T4,#green);
    end
    else //11end
    begin //12
    setseriesvalue(bar,T4,-10) ;
    setseriesbarcolor(bar,T4,#red);
    end;

    end; //10end

    T1_pane:=createpane(20,true,true);
    T2_pane:=createpane(20,true,true);
    T3_pane:=createpane(20,true,true);
    T4_pane:=createpane(20,true,true);

    Plotserieslabel(T1,T1_pane,0,#thickhist,' Close above Cloud ?');
    Plotserieslabel(T2,T2_pane,0,#thickhist,' TEN>KI ?');
    Plotserieslabel(T3,T3_pane,0,#thickhist,' TEN & KI > Cloud ?');
    Plotserieslabel(T4,T4_pane,0,#thickhist,' Chikou');
    PlotSeries(SenA, 0, #Black, #thin);
    PlotSeries(TEN_OFF, 0, #blue, #thin);
    PlotSeries(KI_OFF, 0, #blue, #thin);
    PlotSeries(SenB, 0, #Black, #Dotted);
    PlotSeries(CI_OFF, 0,-1, #thin) ;

    //====== HEIKIN-ASHI ================================================
    //var bar:integer;
    var O3, H3, L3, C3, O1, C1: float;
    var HO, HH, HL, HC, HPANE, HADIFFCO, HAINDPANE: integer;
    var H_SIG,H_SIG_PANE:integer;
    hPane := CreatePane( 200, true, true );
    { Create Heikin-Ashi OHLC Price Series }
    HO := CreateSeries;
    HH := CreateSeries;
    HL := CreateSeries;
    HC := CreateSeries;
    H_SIG:=createseries;
    { Initialize first bar to values of price }
    @HO[0] := PriceOpen( 0 );
    @HH[0] := PriceHigh( 0 );
    @HL[0] := PriceLow( 0 );
    @HC[0] := PriceClose( 0 );

    { Populate Heikin-Ashi Chart }
    for Bar := 1 to BarCount - 1 do
    begin
    o3 := PriceOpen( Bar );
    h3 := PriceHigh( Bar );
    l3 := PriceLow( Bar );
    c3 := PriceClose( Bar );

    o1 := @HO[ Bar - 1 ];
    c1 := @HC[ Bar - 1 ];

    @HC[Bar] := ( o3 + h3 + l3 + c3 ) / 4;
    @HO[Bar] := ( o1 + c1 ) / 2;
    @HH[Bar] := Max( Max( o1, c1 ), h3 );
    @HL[Bar] := Min( Min( o1, c1 ), l3 );
    end;
    PlotSyntheticSymbol( 'heikin-ashi', HO, HH, HL, HC,hpane, #Navy, #candle );