답변완료
문의드립니다.
inp_BB_Length = input(20, minval = 1, title = "BB: Periods")
inp_BB_Deviations = input(2, minval = 0.0001, title = "BB: Deviations")
inp_MACD_Fast = input(12, title = "MACD: Fast EMA", minval = 1)
inp_MACD_Slow = input(26, title = "MACD: Slow EMA", minval = 1)
inp_MACD_Signal = input(9, title = "MACD: Signal MA", minval = 1)
inp_Filter_High = input(10, title = "Filter: High", step = 0.1)
inp_Filter_Low = input(-10, title = "Filter: Low", step = 0.1)
MA_Fast = ema(close, inp_MACD_Fast)
MA_Slow = ema(close, inp_MACD_Slow)
MACD = MA_Fast - MA_Slow
St_Dev = stdev(MACD, inp_BB_Length)
Upper = (St_Dev * inp_BB_Deviations + (sma(MACD, inp_BB_Length)))
Lower = ((sma(MACD, inp_BB_Length)) - (St_Dev * inp_BB_Deviations))
Source_Line = 0.0
Source_Line := MACD
f_Angle(Source, ATR_Period) =>
Rad_To_Degree = 180 / 3.14159265359
Angle = Rad_To_Degree * atan((Source[0] - Source[1]) / atr(ATR_Period))
Angle = f_Angle(Source_Line, 40)
Line_Color = Angle > inp_Filter_High ? color.aqua : Angle < inp_Filter_Low ? color.yellow : color.gray
hline(inp_Filter_High, title = "Filter Top", color = color.gray, linewidth = 1)
hline(inp_Filter_Low, title = "Filter Bottom", color = color.gray, linewidth = 1)
plot(Angle, color = Line_Color, linewidth = 2, title = "Slope Angle", transp = 0)
변환 문의드립니다. 항상 감사드립니다.
2020-04-22
356
글번호 138234
지표
답변완료
문의드립니다
안녕하세요?
아래수식의 plot1과plot2가 작동할시 직전봉에만 추세선이있을시만 알림음을받고싶습니다
도움주셔서 감사합니다
1.
Input : af(0.02), maxAF(0.2);
var1 = SAR(af,maxAF);
if crossup(c,var1) Then
{
value1 = var1;
}
if CrossDown(c,var1) Then
{
value2 = var1;
}
plot1(value1);
plot2(value2);
2.
input : Left(5),right(5),표시소숫점자리(2),굵기(1),연장(0);
var : T(0),cnt(0),TL(0),HTL1(0),HTL2(0),LTL1(0),LTL2(0);
Array : SHD[5](0),SHT[5](0),SHV[5](0),SHTL[100](0),SHTX[100](0);
Array : SLD[5](0),SLT[5](0),SLV[5](0),SLTL[100](0),SLTX[100](0);
if SwingHigh(1,H,Left,Right,Left+Right+1) != -1 then
{
var2 = 0;
var1 = var1+1;
if var1 == 1 then
{
SHD[0] = sdate[right];
SHT[0] = stime[right];
SHV[0] = H[right];
for cnt = 1 to 4
{
SHD[cnt] = SHD[cnt-1][1];
SHT[cnt] = SHT[cnt-1][1];
SHV[cnt] = SHV[cnt-1][1];
}
if SLV[0] > 0 Then
{
TL = TL_New(SLD[0],SLT[0],SLV[0],SHD[0],SHT[0],SHV[0]);
TL_SetSize(TL,굵기);
TL_SetColor(TL,red);
}
if SHV[1] > 0 Then
{
#TL_Delete(HTL1);
HTL1 = TL_New(SHD[1],SHT[1],SHV[1],SHD[0],SHT[0],SHV[0]);
TL_SetColor(HTL1,RED);
TL_SetSize(HTL1,굵기);
}
}
if var1 >= 2 and H[right] > SHV[0] then
{
SHD[0] = sdate[right];
SHT[0] = stime[right];
SHV[0] = H[right];
if SLV[0] > 0 Then
{
TL_Delete(TL);
TL = TL_New(SLD[0],SLT[0],SLV[0],SHD[0],SHT[0],SHV[0]);
TL_SetSize(TL,굵기);
TL_SetColor(TL,red);
}
if SHV[1] > 0 Then
{
#TL_Delete(HTL1);
HTL1 = TL_New(SHD[1],SHT[1],SHV[1],SHD[0],SHT[0],SHV[0]);
TL_SetColor(HTL1,RED);
TL_SetSize(HTL1,굵기);
}
}
SHTL[0] = TL_New(sdate[right],stime[right],H[right],sdate,stime,H[right]);
TL_SetColor(SHTL[0],RED);
TL_SetSize(SHTL[0],굵기);
SHTX[0] = Text_New(sdate,stime,H[right],NumToStr(H[right],표시소숫점자리));
Text_SetColor(SHTX[0],RED);
Text_SetStyle(SHTX[0],2,1);
for cnt = 1 to 99
{
SHTL[cnt] = SHTL[cnt-1][1];
SHTX[cnt] = SHTX[cnt-1][1];
}
}
if SwingLow(1,L,Left,Right,Left+Right+1) != -1 then
{
#plot2(L,"2",blue);
var1 = 0;
var2 = var2+1;
if var2 == 1 then
{
SLD[0] = sdate[right];
SLT[0] = stime[right];
SLV[0] = L[right];
for cnt = 1 to 4
{
SLD[cnt] = SLD[cnt-1][1];
SLT[cnt] = SLT[cnt-1][1];
SLV[cnt] = SLV[cnt-1][1];
}
if SHV[0] > 0 Then
{
TL = TL_New(SHD[0],SHT[0],SHV[0],SLD[0],SLT[0],SLV[0]);
TL_SetSize(TL,굵기);
TL_SetColor(TL,BLUE);
}
if SLV[1] > 0 Then
{
#TL_Delete(LTL1);
LTL1 = TL_New(SLD[1],SLT[1],SLV[1],SLD[0],SLT[0],SLV[0]);
TL_SetColor(LTL1,BLUE);
TL_SetSize(LTL1,굵기);
}
}
if var2 >= 2 and L[right] < SLV[0] then
{
SLD[0] = sdate[right];
SLT[0] = stime[right];
SLV[0] = L[right];
TL_Delete(TL);
if SHV[0] > 0 Then
{
TL = TL_New(SHD[0],SHT[0],SHV[0],SLD[0],SLT[0],SLV[0]);
TL_SetSize(TL,굵기);
TL_SetColor(TL,blue);
}
if SLV[1] > 0 Then
{
#TL_Delete(LTL1);
LTL1 = TL_New(SLD[1],SLT[1],SLV[1],SLD[0],SLT[0],SLV[0]);
TL_SetColor(LTL1,BLUE);
TL_SetSize(LTL1,굵기);
}
}
SLTL[0] = TL_New(sdate[right],stime[right],L[right],sdate,stime,L[right]);
TL_SetColor(SLTL[0],BLUE);
TL_SetSize(SLTL[0],굵기);
SLTX[0] = Text_New(sdate,stime,L[right],NumToStr(L[right],표시소숫점자리));
Text_SetColor(SLTX[0],BLUE);
Text_SetStyle(SLTX[0],2,0);
for cnt = 1 to 99
{
SLTL[cnt] = SLTL[cnt-1][1];
SLTX[cnt] = SLTX[cnt-1][1];
}
}
for cnt = 0 to 99
{
if SHTL[cnt] > 0 then
{
TL_SetEnd(SHTL[cnt],sdate,stime,TL_GetBeginVal(SHTL[cnt]));
if H >= TL_GetBeginVal(SHTL[cnt]) Then
SHTL[cnt] = 연장;
}
if SLTL[cnt] > 0 then
{
TL_SetEnd(SLTL[cnt],sdate,stime,TL_GetBeginVal(SLTL[cnt]));
if L <= TL_GetBeginVal(SLTL[cnt]) Then
SLTL[cnt] = 연장;
}
if SHTL[cnt] > 0 Then
{
Text_SetLocation(SHTX[cnt],sdate,stime,TL_GetBeginVal(SHTL[cnt]));
}
if SLTL[cnt] > 0 Then
{
Text_SetLocation(SLTX[cnt],sdate,stime,TL_GetBeginVal(SLTL[cnt]));
}
}
2020-04-22
444
글번호 138231
지표
답변완료
문의드립니다.
inp_BB_Length = input(20, minval = 1, title = "BB: Periods")
inp_BB_Deviations = input(2, minval = 0.0001, title = "BB: Deviations")
inp_MACD_Fast = input(12, title = "MACD: Fast EMA", minval = 1)
inp_MACD_Slow = input(26, title = "MACD: Slow EMA", minval = 1)
inp_MACD_Signal = input(9, title = "MACD: Signal MA", minval = 1)
inp_Filter_High = input(10, title = "Filter: High", step = 0.1)
inp_Filter_Low = input(-10, title = "Filter: Low", step = 0.1)
MA_Fast = ema(close, inp_MACD_Fast)
MA_Slow = ema(close, inp_MACD_Slow)
MACD = MA_Fast - MA_Slow
St_Dev = stdev(MACD, inp_BB_Length)
Upper = (St_Dev * inp_BB_Deviations + (sma(MACD, inp_BB_Length)))
Lower = ((sma(MACD, inp_BB_Length)) - (St_Dev * inp_BB_Deviations))
Source_Line = 0.0
Source_Line :=(Upper + Lower) / 2
f_Angle(Source, ATR_Period) =>
Rad_To_Degree = 180 / 3.14159265359
Angle = Rad_To_Degree * atan((Source[0] - Source[1]) / atr(ATR_Period))
Angle = f_Angle(Source_Line, 40)
Line_Color = Angle > inp_Filter_High ? color.aqua : Angle < inp_Filter_Low ? color.yellow : color.gray
hline(inp_Filter_High, title = "Filter Top", color = color.gray, linewidth = 1)
hline(inp_Filter_Low, title = "Filter Bottom", color = color.gray, linewidth = 1)
plot(Angle, color = Line_Color, linewidth = 2, title = "Slope Angle", transp = 0)
변환 문의드립니다. 감사합니다.
2020-04-22
241
글번호 138221
지표