커뮤니티

문의드립니다.

프로필 이미지
as8282
2020-06-06 04:40:57
2028
글번호 139590
답변완료
예스수식으로 부탁드립니다. rsiSource = input(title="RSI Source", type=input.source, defval=close) rsiLength = input(title="RSI Length", type=input.integer, defval=12) rsiOverbought = input(title="RSI Overbought", type=input.integer, defval=70, minval=50, maxval=100) rsiOvesold = input(title="RSI Oversold", type=input.integer, defval=30, minval=1, maxval=50) // RSI value based on inbuilt RSI rsiValue = rsi(rsiSource, rsiLength) // Get the current state isOverbought = rsiValue >= rsiOverbought isOversold = rsiValue <= rsiOvesold // State of the last extreme 0 for initialization, 1 = overbought, 2 = oversold var laststate = 0 // Highest and Lowest prices since the last state change var hh = low var ll = high // Labels var label labelll = na var label labelhh = na // Swing lines var line line_up = na var line line_down = na // We go from overbought straight to oversold NEW DRAWINGS CREATED HERE if(laststate == 1 and isOversold) ll := low labelll := label.new(bar_index, low, style=label.style_label_up, color=color.green, size=size.tiny) labelhh_low = label.get_x(labelhh) labelhh_pos = label.get_y(labelhh) line_down := line.new(bar_index, high, labelhh_low, labelhh_pos, width=2) // We go from oversold straight to overbought NEW DRAWINGS CREATED HERE if(laststate == 2 and isOverbought) hh := high labelhh := label.new(bar_index, high, style=label.style_label_down, color=color.red, size=size.tiny) labelll_low = label.get_x(labelll) labelll_pos = label.get_y(labelll) line_up := line.new(bar_index, high, labelll_low, labelll_pos, width=2) // If we are overbought if(isOverbought) if(high >= hh) hh := high label.set_x(labelhh, bar_index) label.set_y(labelhh, high) line.set_x1(line_up, bar_index) line.set_y1(line_up, high) laststate := 1 // If we are oversold if(isOversold) if(low <= ll) ll := low label.set_x(labelll, bar_index) label.set_y(labelll, low) line.set_x1(line_down, bar_index) line.set_y1(line_down, low) laststate := 2 // If last state was overbought and we are overbought if(laststate == 1 and isOverbought) if(hh <= high) hh := high label.set_x(labelhh, bar_index) label.set_y(labelhh, high) line.set_x1(line_up, bar_index) line.set_y1(line_up, high) //If we are oversold and the last state was oversold, move the drawings to the lowest price if(laststate == 2 and isOversold) if(low <= ll) ll := low label.set_x(labelll, bar_index) label.set_y(labelll, low) line.set_x1(line_down, bar_index) line.set_y1(line_down, low) // If last state was overbought if(laststate == 1) if(hh <= high) hh := high label.set_x(labelhh, bar_index) label.set_y(labelhh, high) line.set_x1(line_up, bar_index) line.set_y1(line_up, high) // If last stare was oversold if(laststate == 2) if(ll >= low) ll := low label.set_x(labelll, bar_index) label.set_y(labelll, low) line.set_x1(line_down, bar_index) line.set_y1(line_down, low)
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-06-08 11:15:30

안녕하세요 예스스탁입니다. 올려주신 타사 수식에 기능을 알수 없는 함수들이 있어 변환을 해드릴수 없습니다. 도움을 드리지 못해 죄송합니다. 즐거운 하루되세요 > as8282 님이 쓴 글입니다. > 제목 : 문의드립니다. > 예스수식으로 부탁드립니다. rsiSource = input(title="RSI Source", type=input.source, defval=close) rsiLength = input(title="RSI Length", type=input.integer, defval=12) rsiOverbought = input(title="RSI Overbought", type=input.integer, defval=70, minval=50, maxval=100) rsiOvesold = input(title="RSI Oversold", type=input.integer, defval=30, minval=1, maxval=50) // RSI value based on inbuilt RSI rsiValue = rsi(rsiSource, rsiLength) // Get the current state isOverbought = rsiValue >= rsiOverbought isOversold = rsiValue <= rsiOvesold // State of the last extreme 0 for initialization, 1 = overbought, 2 = oversold var laststate = 0 // Highest and Lowest prices since the last state change var hh = low var ll = high // Labels var label labelll = na var label labelhh = na // Swing lines var line line_up = na var line line_down = na // We go from overbought straight to oversold NEW DRAWINGS CREATED HERE if(laststate == 1 and isOversold) ll := low labelll := label.new(bar_index, low, style=label.style_label_up, color=color.green, size=size.tiny) labelhh_low = label.get_x(labelhh) labelhh_pos = label.get_y(labelhh) line_down := line.new(bar_index, high, labelhh_low, labelhh_pos, width=2) // We go from oversold straight to overbought NEW DRAWINGS CREATED HERE if(laststate == 2 and isOverbought) hh := high labelhh := label.new(bar_index, high, style=label.style_label_down, color=color.red, size=size.tiny) labelll_low = label.get_x(labelll) labelll_pos = label.get_y(labelll) line_up := line.new(bar_index, high, labelll_low, labelll_pos, width=2) // If we are overbought if(isOverbought) if(high >= hh) hh := high label.set_x(labelhh, bar_index) label.set_y(labelhh, high) line.set_x1(line_up, bar_index) line.set_y1(line_up, high) laststate := 1 // If we are oversold if(isOversold) if(low <= ll) ll := low label.set_x(labelll, bar_index) label.set_y(labelll, low) line.set_x1(line_down, bar_index) line.set_y1(line_down, low) laststate := 2 // If last state was overbought and we are overbought if(laststate == 1 and isOverbought) if(hh <= high) hh := high label.set_x(labelhh, bar_index) label.set_y(labelhh, high) line.set_x1(line_up, bar_index) line.set_y1(line_up, high) //If we are oversold and the last state was oversold, move the drawings to the lowest price if(laststate == 2 and isOversold) if(low <= ll) ll := low label.set_x(labelll, bar_index) label.set_y(labelll, low) line.set_x1(line_down, bar_index) line.set_y1(line_down, low) // If last state was overbought if(laststate == 1) if(hh <= high) hh := high label.set_x(labelhh, bar_index) label.set_y(labelhh, high) line.set_x1(line_up, bar_index) line.set_y1(line_up, high) // If last stare was oversold if(laststate == 2) if(ll >= low) ll := low label.set_x(labelll, bar_index) label.set_y(labelll, low) line.set_x1(line_down, bar_index) line.set_y1(line_down, low)