커뮤니티

수식 변환 문의

프로필 이미지
오이도인
2022-05-15 14:12:00
1453
글번호 158814
답변완료
수고하십니다. 아래 식을 yes language로 변환 가능한지요? 수고하세요... ##s.cript는 쓰기금지 단어라고 해서 s 다음에 점을 추가했으니 제외해 주세요## 혹시 몰라서 엑셀 파일로도 첨부 합니다 ########### input SFactor = 3.618; #SuperTrend Factor input SPd = 5; #SuperTrend Length input lenColoured = 18; input lenSlow = 89; #Slow MA Length input hideSuperTrend = yes; def na = Double.Nan; s.cript nz { ##s.cript는 쓰기금지 단어라고 해서 s 다음에 점을 추가했으니 제외해 주세요## input data = 0; input data2 = -1; def ret_val = if IsNaN(data) then if data2 == -1 then 0 else data2 else data; plot nz = ret_val; } def src = close; def len = lenColoured; plot ma_coloured = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len))) ; # Hull WMA = (2*WMA (n/2) ? WMA (n)), sqrt (n)) ma_coloured.setHiding(hideSuperTrend); plot ma_slow = Expaverage(src,lenslow); def clrdirection = if ma_coloured > ma_coloured[3] then 1 else if ma_coloured < ma_coloured[3] then -1 else nz(clrdirection[1],1); # Supertrend Calculations def SUp=hl2-(SFactor*atr(SPd)); def SDn=hl2+(SFactor*atr(SPd)); def STrendUp = if close[1] > nz(STrendUp[1],0) then max(SUp,nz(STrendUp[1],0)) else SUp; def STrendDown = if close[1] < nz(STrendDown[1],0) then min(SDn,nz(STrendDown[1],0)) else SDn; def STrend = if close > nz(STrendDown[1],0) then 1 else if close< nz(STrendUp[1],0) then -1 else nz(STrend[1],1); def stbuy = if clrdirection == 1 and STrend==1 then nz(stbuy[1])+1 else 0; def stsell = if clrdirection ==-1 and STrend==-1 then nz(stsell[1])+1 else 0; plot long = If stbuy == 1 then Yes else no ; long.hide(); plot short = if stSell == 1 then yes else no ; short.hide(); plot LongLineMarker = if long then low else na; LongLineMarker.SetPaintingStrategy(PaintingStrategy.ARROW_UP); LongLineMarker.SetDefaultColor(Color.Green); plot ShortLineMarker = if short then High else na; ShortLineMarker.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); ShortLineMarker.SetDefaultColor(Color.Red);
지표
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2022-05-13 10:34:45

안녕하세요 예스스탁입니다. input : SFactor(3.618),SPd(5),lenColoured(18),lenSlow(89),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 / 2) - wma(src, len), round(sqrt(len),0)); ma_slow = Ema(src,lenslow); plot1(ma_coloured); plot2(ma_slow); if ma_coloured > ma_coloured[3] then clrdirection = 1; else if ma_coloured < ma_coloured[3] then clrdirection = -1; else clrdirection = clrdirection; # Supertrend Calculations 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; 즐거운 하루되세요 > 오이도인 님이 쓴 글입니다. > 제목 : 수식 변환 문의 > 수고하십니다. 아래 식을 yes language로 변환 가능한지요? 수고하세요... ##s.cript는 쓰기금지 단어라고 해서 s 다음에 점을 추가했으니 제외해 주세요## 혹시 몰라서 엑셀 파일로도 첨부 합니다 ########### input SFactor = 3.618; #SuperTrend Factor input SPd = 5; #SuperTrend Length input lenColoured = 18; input lenSlow = 89; #Slow MA Length input hideSuperTrend = yes; def na = Double.Nan; s.cript nz { ##s.cript는 쓰기금지 단어라고 해서 s 다음에 점을 추가했으니 제외해 주세요## input data = 0; input data2 = -1; def ret_val = if IsNaN(data) then if data2 == -1 then 0 else data2 else data; plot nz = ret_val; } def src = close; def len = lenColoured; plot ma_coloured = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len))) ; # Hull WMA = (2*WMA (n/2) ? WMA (n)), sqrt (n)) ma_coloured.setHiding(hideSuperTrend); plot ma_slow = Expaverage(src,lenslow); def clrdirection = if ma_coloured > ma_coloured[3] then 1 else if ma_coloured < ma_coloured[3] then -1 else nz(clrdirection[1],1); # Supertrend Calculations def SUp=hl2-(SFactor*atr(SPd)); def SDn=hl2+(SFactor*atr(SPd)); def STrendUp = if close[1] > nz(STrendUp[1],0) then max(SUp,nz(STrendUp[1],0)) else SUp; def STrendDown = if close[1] < nz(STrendDown[1],0) then min(SDn,nz(STrendDown[1],0)) else SDn; def STrend = if close > nz(STrendDown[1],0) then 1 else if close< nz(STrendUp[1],0) then -1 else nz(STrend[1],1); def stbuy = if clrdirection == 1 and STrend==1 then nz(stbuy[1])+1 else 0; def stsell = if clrdirection ==-1 and STrend==-1 then nz(stsell[1])+1 else 0; plot long = If stbuy == 1 then Yes else no ; long.hide(); plot short = if stSell == 1 then yes else no ; short.hide(); plot LongLineMarker = if long then low else na; LongLineMarker.SetPaintingStrategy(PaintingStrategy.ARROW_UP); LongLineMarker.SetDefaultColor(Color.Green); plot ShortLineMarker = if short then High else na; ShortLineMarker.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); ShortLineMarker.SetDefaultColor(Color.Red);
프로필 이미지

오이도인

2022-05-15 11:15:47

오이도인 님에 의해 삭제된 답변입니다.