커뮤니티

수식 부탁드립니다

프로필 이미지
오이도인
2022-05-16 10:01:30
946
글번호 158865
답변완료

첨부 이미지

수고하십니다. 아래 식에서 1]첨부 그림 처럼 같은 종류의 다음 번 신호가 나올 때까지 신호봉의 고가/저가 기준 우측 연장 일자 라인을 그리고 싶습니다. 2] data2 차트에 적용하려면 어떻게 수정을 해야하는지요...? 늘 감사 드립니다.. 수고하세요.. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 변환 문의 > 안녕하세요 예스스탁입니다. input : SFactor(6.138),SPd(10),lenColoured(36),lenSlow(178),hideSuperTrend(true); var : src(0),len(0),ma_coloured(0),ma_slow(0),clrdirection(0); src = close; len = lenColoured; ma_coloured = wma(2 * wma(src, len / 3) - wma(src, len), round(sqrt(len),0)); ma_slow = Ema(src,lenslow); if ma_coloured > ma_coloured[13] then clrdirection = 1; else if ma_coloured < ma_coloured[13] then clrdirection = -1; else clrdirection = clrdirection; var : hl2(0),ATRV(0),SUp(0),SDn(0),STrendUp(0),STrendDown(0); var : STrend(0),stbuy(0),stsell(0),long(False),short(False); var : LongLineMarker(0),ShortLineMarker(0),tx(0); hl2 = (H+L)/2; ATRV = ATR(SPd); SUp = hl2-(SFactor*atrv); SDn = hl2+(SFactor*atrv); if C[1] > STrendUp[1] Then STrendUp = max(SUp,iff(isnan(STrendUp[1])==False,STrendUp[1],0)); else STrendUp = SUp; if close[1] < STrendDown[1] then STrendDown = min(SDn,iff(isnan(STrendDown[1]) == False,STrendDown[1],0)); else STrendDown = SDn; if close > IFf(IsNan(STrendDown[1]) == False, STrendDown[1],0) then STrend = 1; else if close< IFf(IsNan(STrendUp[1]) == False, STrendUp[1],0) then STrend = -1; else STrend = IFf(IsNan(STrend[1]) == False, STrend[1],1); if clrdirection == 1 and STrend==1 then stbuy = stbuy +1; else stbuy = 0; if clrdirection ==-1 and STrend==-1 then stsell = stsell+1 ; else stsell = 0; If stbuy == 1 then long = true; else long = False; if stSell == 1 then short = true; else short = False ; if long then { LongLineMarker = low; tx = Text_New(sDate,sTime,LongLineMarker,"▲"); Text_SetColor(tx,Green); Text_SetStyle(tx,2,0); } Else LongLineMarker = Nan; if short then { ShortLineMarker = High; tx = Text_New(sDate,sTime,ShortLineMarker,"▼"); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); } Else ShortLineMarker = Nan; 즐거운 하루되세요
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-05-16 10:22:34

안녕하세요 예스스탁입니다. 1 input : SFactor(6.138),SPd(10),lenColoured(36),lenSlow(178),hideSuperTrend(true); var : src(0),len(0),ma_coloured(0),ma_slow(0),clrdirection(0); var : TL1(0),TL2(0),v1(0),v2(0); src = close; len = lenColoured; ma_coloured = wma(2 * wma(src, len / 3) - wma(src, len), round(sqrt(len),0)); ma_slow = Ema(src,lenslow); if ma_coloured > ma_coloured[13] then clrdirection = 1; else if ma_coloured < ma_coloured[13] then clrdirection = -1; else clrdirection = clrdirection; var : hl2(0),ATRV(0),SUp(0),SDn(0),STrendUp(0),STrendDown(0); var : STrend(0),stbuy(0),stsell(0),long(False),short(False); var : LongLineMarker(0),ShortLineMarker(0),tx(0); hl2 = (H+L)/2; ATRV = ATR(SPd); SUp = hl2-(SFactor*atrv); SDn = hl2+(SFactor*atrv); if C[1] > STrendUp[1] Then STrendUp = max(SUp,iff(isnan(STrendUp[1])==False,STrendUp[1],0)); else STrendUp = SUp; if close[1] < STrendDown[1] then STrendDown = min(SDn,iff(isnan(STrendDown[1]) == False,STrendDown[1],0)); else STrendDown = SDn; if close > IFf(IsNan(STrendDown[1]) == False, STrendDown[1],0) then STrend = 1; else if close< IFf(IsNan(STrendUp[1]) == False, STrendUp[1],0) then STrend = -1; else STrend = IFf(IsNan(STrend[1]) == False, STrend[1],1); if clrdirection == 1 and STrend==1 then stbuy = stbuy +1; else stbuy = 0; if clrdirection ==-1 and STrend==-1 then stsell = stsell+1 ; else stsell = 0; If stbuy == 1 then long = true; else long = False; if stSell == 1 then short = true; else short = False ; if long then { LongLineMarker = low; tx = Text_New(sDate,sTime,LongLineMarker,"▲"); Text_SetColor(tx,Green); Text_SetStyle(tx,2,0); v1 = LongLineMarker; TL1 = TL_New(sDate,sTime,v1,NextBarSdate,NextBarStime,v1); TL_SetColor(TL1,Green); } Else { LongLineMarker = Nan; TL_SetEnd(TL1,sDate,sTime,v1); } if short then { ShortLineMarker = High; tx = Text_New(sDate,sTime,ShortLineMarker,"▼"); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); v2 = ShortLineMarker; TL2 = TL_New(sDate,sTime,v2,NextBarSdate,NextBarStime,v2); TL_SetColor(TL2,Red); } Else { ShortLineMarker = Nan; TL_SetEnd(TL2,sDate,sTime,V2); } 2 data2에 적용하는 수식은 아래와 같습니다. 다만 수식이 바로 참조데이타 위에 적용되게 설정이 가능하지 않습니다. 적용 후에 마우스로 끌어 data2위에 올리셔야 하는데 해당식 추세선으로만 출력되어 마우스로 잡아 끌수 있는 plot지표가 없습니다. 마우스로 잡아 끌수 있게 당일시초가선을 추가해 드립니다. 시초가선을 잡고 data2위에 올리시면 됩니다. input : SFactor(6.138),SPd(10),lenColoured(36),lenSlow(178),hideSuperTrend(true); var : src(0,Data2),len(0,Data2),ma_coloured(0,Data2),ma_slow(0,Data2),clrdirection(0,Data2); var : TL1(0,Data2),TL2(0,Data2),v1(0,Data2),v2(0,Data2); src = data2(close); len = lenColoured; ma_coloured = data2(wma(2 * wma(src, len / 3) - wma(src, len), round(sqrt(len),0))); ma_slow = data2(Ema(src,lenslow)); if ma_coloured > ma_coloured[13] then clrdirection = 1; else if ma_coloured < ma_coloured[13] then clrdirection = -1; else clrdirection = clrdirection; var : hl2(0,Data2),ATRV(0,data2),SUp(0,data2),SDn(0,data2),STrendUp(0,data2),STrendDown(0,data2); var : STrend(0,data2),stbuy(0,data2),stsell(0,data2),long(False,data2),short(False,data2); var : LongLineMarker(0,data2),ShortLineMarker(0,data2),tx(0,data2); hl2 = Data2((H+L)/2); ATRV = data2(ATR(SPd)); SUp = hl2-(SFactor*atrv); SDn = hl2+(SFactor*atrv); if data2(C[1] > STrendUp[1]) Then STrendUp = data2(max(SUp,iff(isnan(STrendUp[1])==False,STrendUp[1],0))); else STrendUp = SUp; if data2(close[1] < STrendDown[1]) then STrendDown = data2(min(SDn,iff(isnan(STrendDown[1]) == False,STrendDown[1],0))); else STrendDown = SDn; if data2(close > IFf(IsNan(STrendDown[1]) == False, STrendDown[1],0)) then STrend = 1; else if data2(close< IFf(IsNan(STrendUp[1]) == False, STrendUp[1],0)) then STrend = -1; else STrend = data2(IFf(IsNan(STrend[1]) == False, STrend[1],1)); if clrdirection == 1 and STrend==1 then stbuy = stbuy +1; else stbuy = 0; if clrdirection ==-1 and STrend==-1 then stsell = stsell+1 ; else stsell = 0; If stbuy == 1 then long = true; else long = False; if stSell == 1 then short = true; else short = False ; if long then { LongLineMarker = data2(low); tx = data2(Text_New_Self(sDate,sTime,LongLineMarker,"▲")); Text_SetColor(tx,Green); Text_SetStyle(tx,2,0); v1 = LongLineMarker; TL1 = data2(TL_New_Self(sDate,sTime,v1,NextBarSdate,NextBarStime,v1)); TL_SetColor(TL1,Green); } Else { LongLineMarker = Nan; data2(TL_SetEnd(TL1,sDate,sTime,v1)); } if short then { ShortLineMarker = data2(High); tx = data2(Text_New_Self(sDate,sTime,ShortLineMarker,"▼")); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); v2 = ShortLineMarker; TL2 = data2(TL_New_Self(sDate,sTime,v2,NextBarSdate,NextBarStime,v2)); TL_SetColor(TL2,Red); } Else { ShortLineMarker = Nan; data2(TL_SetEnd(TL2,sDate,sTime,V2)); } Plot1(Data2(Opend(0))); 즐거운 하루되세요 > 오이도인 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다 > 수고하십니다. 아래 식에서 1]첨부 그림 처럼 같은 종류의 다음 번 신호가 나올 때까지 신호봉의 고가/저가 기준 우측 연장 일자 라인을 그리고 싶습니다. 2] data2 차트에 적용하려면 어떻게 수정을 해야하는지요...? 늘 감사 드립니다.. 수고하세요.. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 변환 문의 > 안녕하세요 예스스탁입니다. input : SFactor(6.138),SPd(10),lenColoured(36),lenSlow(178),hideSuperTrend(true); var : src(0),len(0),ma_coloured(0),ma_slow(0),clrdirection(0); src = close; len = lenColoured; ma_coloured = wma(2 * wma(src, len / 3) - wma(src, len), round(sqrt(len),0)); ma_slow = Ema(src,lenslow); if ma_coloured > ma_coloured[13] then clrdirection = 1; else if ma_coloured < ma_coloured[13] then clrdirection = -1; else clrdirection = clrdirection; var : hl2(0),ATRV(0),SUp(0),SDn(0),STrendUp(0),STrendDown(0); var : STrend(0),stbuy(0),stsell(0),long(False),short(False); var : LongLineMarker(0),ShortLineMarker(0),tx(0); hl2 = (H+L)/2; ATRV = ATR(SPd); SUp = hl2-(SFactor*atrv); SDn = hl2+(SFactor*atrv); if C[1] > STrendUp[1] Then STrendUp = max(SUp,iff(isnan(STrendUp[1])==False,STrendUp[1],0)); else STrendUp = SUp; if close[1] < STrendDown[1] then STrendDown = min(SDn,iff(isnan(STrendDown[1]) == False,STrendDown[1],0)); else STrendDown = SDn; if close > IFf(IsNan(STrendDown[1]) == False, STrendDown[1],0) then STrend = 1; else if close< IFf(IsNan(STrendUp[1]) == False, STrendUp[1],0) then STrend = -1; else STrend = IFf(IsNan(STrend[1]) == False, STrend[1],1); if clrdirection == 1 and STrend==1 then stbuy = stbuy +1; else stbuy = 0; if clrdirection ==-1 and STrend==-1 then stsell = stsell+1 ; else stsell = 0; If stbuy == 1 then long = true; else long = False; if stSell == 1 then short = true; else short = False ; if long then { LongLineMarker = low; tx = Text_New(sDate,sTime,LongLineMarker,"▲"); Text_SetColor(tx,Green); Text_SetStyle(tx,2,0); } Else LongLineMarker = Nan; if short then { ShortLineMarker = High; tx = Text_New(sDate,sTime,ShortLineMarker,"▼"); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); } Else ShortLineMarker = Nan; 즐거운 하루되세요