이 문제를 해결하는 데 정말 어려움을 겪었으며 도움을 주시면 감사하겠습니다. 루프를 일찍 끊을 때 루프에서 값을 얻으려면 어떻게해야합니까?
이것은 우리가 정말로 성취하고자하는 것의 훨씬 더 간단한 예이지만, 그 아이디어가 전달되기를 바랍니다.
현재는 런타임 오류가 발생합니다.
//@version=4
study("Test barssince", overlay=true)
// NOTE: run on the daily chart
n = input(1)
sundayHigh = dayofweek == dayofweek.sunday ? high : na
bgcolor(sundayHigh ? color.green : na)
someHighPrice = valuewhen(sundayHigh, sundayHigh, n) // value of the nth previous sundayHigh
mybarssince(ser, val) =>
int bars = na
for i=0 to 99
bars := i
if ser[i] == val
break
bars
int sbars = mybarssince(high, someHighPrice) // Runtime error.
if dayofweek == dayofweek.wednesday
// connect this bar (wednesday) with the nth previous sunday
line.new(bar_index-sbars, high[sbars], bar_index, high, color=color.orange, width=3)
어떤 도움이라도 대단히 감사합니다 :)
@LucF가 언급했듯이 이것은 Pine의 버그로 밝혀졌습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다