커뮤니티

수식 부탁드립니다

프로필 이미지
사노소이
2023-12-13 09:25:24
865
글번호 174085
답변완료
안녕하세요. 트레이딩뷰 수식인데요. 지표(강조)식과 시스템식으로 2가지 부탁드려도 될까요? 감사합니다. //@version=4 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // &#169; ceyhun study("Top Bottom ", overlay=true) per = input(14, title="Bottom Period") loc = low < lowest(low[1], per) and low <= lowest(low[per], per) bottom = barssince(loc) per2 = input(14, title="Top Period") loc2 = high > highest(high[1], per2) and high >= highest(high[per2], per2) top = barssince(loc2) /////BUY-SELL///// Buy = crossover(bottom, top) Sell = crossunder(bottom, top) plotshape(Buy,"BUY", shape.labelup, location.belowbar, color.green, text="BUY",textcolor=color.black) plotshape(Sell,"SELL", shape.labeldown, location.abovebar, color.red, text="SELL",textcolor=color.black) background = top < bottom ? color.new(#0000FF,85) : top > bottom ? color.new(#FF0000,85) : na bgcolor(color=background) alertcondition(Buy, title="Buy Signal", message="Buy") alertcondition(Sell, title="Sell Signal", message="Sell")
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-11-16 14:14:39

안녕하세요 예스스탁입니다. 1 지표 input : per(14),per2(14); var : loc(False),bottom(-1); var : loc2(False),top(-1); loc = low < lowest(low, per)[1] and low <= lowest(low, per)[per]; loc2 = high > highest(high, per2)[1] and high >= highest(high, per2)[per2]; if loc == true then bottom = 0; Else { if bottom >= 0 Then bottom = bottom+1; } if loc2 == true then top = 0; Else { if top >= 0 Then top = top+1; } Plot1(Bottom); Plot2(top); 2 강조 input : per(14),per2(14); var : loc(False),bottom(-1); var : loc2(False),top(-1); loc = low < lowest(low[1], per) and low <= lowest(low[per], per); loc2 = high > highest(high[1], per2) and high >= highest(high[per2], per2); if loc == true then bottom = 0; Else { if bottom >= 0 Then bottom = bottom+1; } if loc2 == true then top = 0; Else { if top >= 0 Then top = top+1; } if CrossUp(bottom,top) Then PlotPaintBar(H,L,"강조",Magenta); if CrossDown(bottom,top) Then PlotPaintBar(H,L,"강조",Cyan); 3 시스템 input : per(14),per2(14); var : loc(False),bottom(-1); var : loc2(False),top(-1); loc = low < lowest(low[1], per) and low <= lowest(low[per], per); loc2 = high > highest(high[1], per2) and high >= highest(high[per2], per2); if loc == true then bottom = 0; Else { if bottom >= 0 Then bottom = bottom+1; } if loc2 == true then top = 0; Else { if top >= 0 Then top = top+1; } if CrossUp(bottom,top) Then Buy(); if CrossDown(bottom,top) Then Sell(); 즐거운 하루되세요 > 사노소이 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다 > 안녕하세요. 트레이딩뷰 수식인데요. 지표(강조)식과 시스템식으로 2가지 부탁드려도 될까요? 감사합니다. //@version=4 // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // &#169; ceyhun study("Top Bottom ", overlay=true) per = input(14, title="Bottom Period") loc = low < lowest(low[1], per) and low <= lowest(low[per], per) bottom = barssince(loc) per2 = input(14, title="Top Period") loc2 = high > highest(high[1], per2) and high >= highest(high[per2], per2) top = barssince(loc2) /////BUY-SELL///// Buy = crossover(bottom, top) Sell = crossunder(bottom, top) plotshape(Buy,"BUY", shape.labelup, location.belowbar, color.green, text="BUY",textcolor=color.black) plotshape(Sell,"SELL", shape.labeldown, location.abovebar, color.red, text="SELL",textcolor=color.black) background = top < bottom ? color.new(#0000FF,85) : top > bottom ? color.new(#FF0000,85) : na bgcolor(color=background) alertcondition(Buy, title="Buy Signal", message="Buy") alertcondition(Sell, title="Sell Signal", message="Sell")