Inputs:
LineR(255),
LineG(255),
LineB(0),
FuzzR(255),
FuzzG(0),
FuzzB(0),
ShowDC(1);
Vars:
price(0),
delta(0.1),
gamma(0),
alpha(0),
beta(0),
N(0),
Period(0),
MaxAmpl(0),
Num(0),
Denom(0),
DC(0),
DomCyc(0),
Color1(0),
Color2(0),
Color3(0),
alpha1(0),
HP(0),
SmoothHP(0);
Arrays:
II[60](0),
OldI[60](0),
OlderI[60](0),
Q[60](0),
OldQ[60](0),
OlderQ[60](0),
Real[60](0),
OldReal[60](0),
OlderReal[60](0),
Imag[60](0),
OldImag[60](0),
OlderImag[60](0),
Ampl[60](0),
OldAmpl[60](0),
DB[65](0),
OldDB[60](0);
if Currentbar > 1 then {
Price = (H+L)/2;
alpha1 = (1 - Sine (360 / 30)) / Cosine(360 / 30);
HP = 0.5*(1 + alpha1)*(Price - Price[1]) + alpha1*HP[1];
SmoothHP = (HP + 2*HP[1] + 3*HP[2] + 3*HP[3] + 2*HP[4] + HP[5]) / 12;
}
IF CurrentBar < 7 Then SmoothHP = Price - Price[1];
IF CurrentBar == 1 THEN SmoothHP = 0;
delta = -0.015*CurrentBar + 0.5;
If delta < 0.1 then delta = 0.1;
If CurrentBar > 12 Then {
For N = 12 to 60 {
beta = Cosine(720 / N);
gamma = 1 / Cosine(1440*delta / N);
alpha = gamma - SquareRoot(gamma*gamma - 1);
Q[N] = (0.5*N / 6.28318)*(SmoothHP - SmoothHP[1]);
II[N] = SmoothHP;
Real[N] = 0.5*(1 - alpha)*(II[N] - OlderI[N]) + beta*(1 + alpha)*OldReal[N] - alpha*OlderReal[N];
Imag[N] = 0.5*(1 - alpha)*(Q[N] - OlderQ[N]) + beta*(1 + alpha)*OldImag[N] - alpha*OlderImag[N];
Ampl[N] = (Real[N]*Real[N] + Imag[N]*Imag[N]);
}
}
For N = 12 to 60 {
OlderI[N] = OldI[N];
OldI[N] = II[N];
OlderQ[N] = OldQ[N];
OldQ[N] = Q[N];
OlderReal[N] = OldReal[N];
OldReal[N] = Real[N];
OlderImag[N] = OldImag[N];
OldImag[N] = Imag[N];
OldAmpl[N] = Ampl[N];
OldDB[N] = DB[N];
}
MaxAmpl = Ampl[12];
For N = 12 to 60 {
If Ampl[N] > MaxAmpl then MaxAmpl = Ampl[N];
}
For N = 12 to 60 {
//IF MaxAmpl <> 0 AND (Ampl[N] / MaxAmpl) > 0 THEN DB[N] = -60*Log(Ampl[N] / MaxAmpl) / Log(10);
IF MaxAmpl <> 0 AND (Ampl[N] / MaxAmpl) > 0 THEN DB[N] = -10*Log(0.01 / (1 - 0.99*Ampl[N] / MaxAmpl)) / Log(10);
DB[N] = 0.33*DB[N] + 0.67*OldDB[N];
If DB[N] > 20 then DB[N] = 20;
}
Num = 0;
Denom = 0;
For N = 12 to 60 {
If DB[N] <= 6 Then {
Num = Num + N*(20 - DB[N]);
Denom = Denom + (20 - DB[N]);
}
If Denom <> 0 Then DC = 0.5*Num / Denom;
}
DomCyc = median(DC, 5);
If ShowDC == True Then {
Plot1(DomCyc, "DC", RGB(LineR, LineG, LineB),0,2);
Plot61(DomCyc, "DC", RGB(LineR, LineG, LineB),0,2);
}
For N = 12 to 60 {
IF DB[N] <= 10 THEN {
Color1 = LineR + DB[N]*(FuzzR - LineR) / 10;
Color2 = LineG + DB[N]*(FuzzG - LineG) / 10;
Color3 = LineB + DB[N]*(FuzzB - LineB) / 10;
}
IF DB[N] > 10 THEN {
Color1 = FuzzR*(2 - DB[N] / 10);
Color2 = FuzzG*(2 - DB[N] / 10);
Color3 = FuzzB*(2 - DB[N] / 10);
}
If N == 12 Then Plot60(N/2, "S12", RGB(Color1, Color2, Color3),0,5);
If N == 13 Then Plot59(N/2, "S13", RGB(Color1, Color2, Color3),0,5);
If N == 14 Then Plot58(N/2, "S14", RGB(Color1, Color2, Color3),0,5);
If N == 15 Then Plot57(N/2, "S15", RGB(Color1, Color2, Color3),0,5);
If N == 16 Then Plot56(N/2, "S16", RGB(Color1, Color2, Color3),0,5);
If N == 17 Then Plot55(N/2, "S17", RGB(Color1, Color2, Color3),0,5);
If N == 18 Then Plot54(N/2, "S18", RGB(Color1, Color2, Color3),0,5);
If N == 19 Then Plot53(N/2, "S19", RGB(Color1, Color2, Color3),0,5);
If N == 20 Then Plot52(N/2, "S20", RGB(Color1, Color2, Color3),0,5);
If N == 21 Then Plot51(N/2, "S21", RGB(Color1, Color2, Color3),0,5);
If N == 22 Then Plot50(N/2, "S22", RGB(Color1, Color2, Color3),0,5);
If N == 23 Then Plot49(N/2, "S23", RGB(Color1, Color2, Color3),0,5);
If N == 24 Then Plot48(N/2, "S24", RGB(Color1, Color2, Color3),0,5);
If N == 25 Then Plot47(N/2, "S25", RGB(Color1, Color2, Color3),0,5);
If N == 26 Then Plot46(N/2, "S26", RGB(Color1, Color2, Color3),0,5);
If N == 27 Then Plot45(N/2, "S27", RGB(Color1, Color2, Color3),0,5);
If N == 28 Then Plot44(N/2, "S28", RGB(Color1, Color2, Color3),0,5);
If N == 29 Then Plot43(N/2, "S29", RGB(Color1, Color2, Color3),0,5);
If N == 30 Then Plot42(N/2, "S30", RGB(Color1, Color2, Color3),0,5);
If N == 31 Then Plot41(N/2, "S31", RGB(Color1, Color2, Color3),0,5);
If N == 32 Then Plot40(N/2, "S32", RGB(Color1, Color2, Color3),0,5);
If N == 33 Then Plot39(N/2, "S33", RGB(Color1, Color2, Color3),0,5);
If N == 34 Then Plot38(N/2, "S34", RGB(Color1, Color2, Color3),0,5);
If N == 35 Then Plot37(N/2, "S35", RGB(Color1, Color2, Color3),0,5);
If N == 36 Then Plot36(N/2, "S36", RGB(Color1, Color2, Color3),0,5);
If N == 37 Then Plot35(N/2, "S37", RGB(Color1, Color2, Color3),0,5);
If N == 38 Then Plot34(N/2, "S38", RGB(Color1, Color2, Color3),0,5);
If N == 39 Then Plot33(N/2, "S39", RGB(Color1, Color2, Color3),0,5);
If N == 40 Then Plot32(N/2, "S40", RGB(Color1, Color2, Color3),0,5);
If N == 41 Then Plot31(N/2, "S41", RGB(Color1, Color2, Color3),0,5);
If N == 42 Then Plot30(N/2, "S42", RGB(Color1, Color2, Color3),0,5);
If N == 43 Then Plot29(N/2, "S43", RGB(Color1, Color2, Color3),0,5);
If N == 44 Then Plot28(N/2, "S44", RGB(Color1, Color2, Color3),0,5);
If N == 45 Then Plot27(N/2, "S45", RGB(Color1, Color2, Color3),0,5);
If N == 46 Then Plot26(N/2, "S46", RGB(Color1, Color2, Color3),0,5);
If N == 47 Then Plot25(N/2, "S47", RGB(Color1, Color2, Color3),0,5);
If N == 48 Then Plot24(N/2, "S48", RGB(Color1, Color2, Color3),0,5);
If N == 49 Then Plot23(N/2, "S49", RGB(Color1, Color2, Color3),0,5);
If N == 50 Then Plot22(N/2, "S50", RGB(Color1, Color2, Color3),0,5);
If N == 51 Then Plot21(N/2, "S51", RGB(Color1, Color2, Color3),0,5);
If N == 52 Then Plot20(N/2, "S52", RGB(Color1, Color2, Color3),0,5);
If N == 53 Then Plot19(N/2, "S53", RGB(Color1, Color2, Color3),0,5);
If N == 54 Then Plot18(N/2, "S54", RGB(Color1, Color2, Color3),0,5);
If N == 55 Then Plot17(N/2, "S55", RGB(Color1, Color2, Color3),0,5);
If N == 56 Then Plot16(N/2, "S56", RGB(Color1, Color2, Color3),0,5);
If N == 57 Then Plot15(N/2, "S57", RGB(Color1, Color2, Color3),0,5);
If N == 58 Then Plot14(N/2, "S58", RGB(Color1, Color2, Color3),0,5);
If N == 59 Then Plot13(N/2, "S59", RGB(Color1, Color2, Color3),0,5);
If N == 60 Then Plot12(N/2, "S50", RGB(Color1, Color2, Color3),0,5);
}
'∎ 매매의 기술 [ K ] > 지표편집' 카테고리의 다른 글
[trader'stip]_corona_snr (0) | 2015.01.27 |
---|---|
마켓프로파일 지표 (0) | 2015.01.23 |
MACD 표현 (0) | 2015.01.22 |
댓글