커뮤니티

83425번 2항 문의사항 입니다.

프로필 이미지
하루삼프로
2023-08-22 16:45:33
1577
글번호 171757
답변완료

첨부 이미지

83425번 2번항에 해당되는 파인스크립 을 예스 수식으로 변환 부탁드립니다 에서 변환해주신 수식 적용하니 지표가 트레이딩뷰차트랑 예스차트랑 다르게 표기 됩니다. 파일 첨부 하오니 검토 부탁 드리겠습니다. 아래: 파인스크립트 수식 83425번 2번항 atr_length = input(500) start = input(500) increment = input(500) maximum = input(500) entry_bars = input(500, title='Entry on Nth trend bar') atr = ta.atr(atr_length) atr := na(atr) ? ta.tr : atr psar = 0.0 // PSAR af = 0.0 // Acceleration Factor trend_dir = 0 // Current direction of PSAR ep = 0.0 // Extreme point trend_bars = 0 sar_long_to_short = trend_dir[1] == 1 and close <= psar[1] // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1] // PSAR switches from short to long trend_change = barstate.isfirst[1] or sar_long_to_short or sar_short_to_long // Calculate trend direction trend_dir := barstate.isfirst[1] and close[1] > open[1] ? 1 : barstate.isfirst[1] and close[1] <= open[1] ? -1 : sar_long_to_short ? -1 : sar_short_to_long ? 1 : nz(trend_dir[1]) trend_bars := sar_long_to_short ? -1 : sar_short_to_long ? 1 : trend_dir == 1 ? nz(trend_bars[1]) + 1 : trend_dir == -1 ? nz(trend_bars[1]) - 1 : nz(trend_bars[1]) // Calculate Acceleration Factor af := trend_change ? start : trend_dir == 1 and high > ep[1] or trend_dir == -1 and low < ep[1] ? math.min(maximum, af[1] + increment) : af[1] // Calculate extreme point ep := trend_change and trend_dir == 1 ? high : trend_change and trend_dir == -1 ? low : trend_dir == 1 ? math.max(ep[1], high) : math.min(ep[1], low) // Calculate PSAR psar := barstate.isfirst[1] and close[1] > open[1] ? low[1] : barstate.isfirst[1] and close[1] <= open[1] ? high[1] : trend_change ? ep[1] : trend_dir == 1 ? psar[1] + af * atr : psar[1] - af * atr plot(psar, style=plot.style_cross, color=trend_dir == 1 ? color.green : color.red, linewidth=2) // Strategy strategy.entry('Long', strategy.long, when=trend_bars == entry_bars) strategy.entry('Short', strategy.short, when=trend_bars == -entry_bars) --------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------- 아래: 변환해주신 수식 입니다. 2-1 지표 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False); atrv = atr(atr_length); atrv = iff(IsNan(atrv) == true ,TrueRange , atrv); psar = 0.0; // PSAR af = 0.0; // Acceleration Factor trend_dir = 0; // Current direction of PSAR ep = 0.0; // Extreme point trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(close[1] > open[1] , 1 , IFf(close[1] <= open[1] , -1 , IFf(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(isnan(trend_dir[1])==False,trend_dir[1],0))))); trend_bars = iff(sar_long_to_short , -1 , IFf(sar_short_to_long , 1 , iff(trend_dir == 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0)+ 1 , IFf( trend_dir == -1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) - 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) )))); // Calculate Acceleration Factor af = iff(trend_change , start , iff(trend_dir == 1 and high > ep[1] or trend_dir == -1 and low < ep[1] , min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , iff(trend_change and trend_dir == -1 , low , iff(trend_dir == 1 , max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(close[1] > open[1] , low[1] , IFf(close[1] <= open[1] , high[1] , IFf(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); plot1(psar,"psar",iff(trend_dir == 1 , green , red)); 2-2 시스템 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False); atrv = atr(atr_length); atrv = iff(IsNan(atrv) == true ,TrueRange , atrv); psar = 0.0; // PSAR af = 0.0; // Acceleration Factor trend_dir = 0; // Current direction of PSAR ep = 0.0; // Extreme point trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(close[1] > open[1] , 1 , IFf(close[1] <= open[1] , -1 , IFf(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(isnan(trend_dir[1])==False,trend_dir[1],0))))); trend_bars = iff(sar_long_to_short , -1 , IFf(sar_short_to_long , 1 , iff(trend_dir == 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0)+ 1 , IFf( trend_dir == -1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) - 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) )))); // Calculate Acceleration Factor af = iff(trend_change , start , iff(trend_dir == 1 and high > ep[1] or trend_dir == -1 and low < ep[1] , min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , iff(trend_change and trend_dir == -1 , low , iff(trend_dir == 1 , max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(close[1] > open[1] , low[1] , IFf(close[1] <= open[1] , high[1] , IFf(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); IF trend_bars == entry_bars TheN Buy(); IF trend_bars == -entry_bars TheN Sell(); 2-3 종목검색 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False); atrv = atr(atr_length); atrv = iff(IsNan(atrv) == true ,TrueRange , atrv); psar = 0.0; // PSAR af = 0.0; // Acceleration Factor trend_dir = 0; // Current direction of PSAR ep = 0.0; // Extreme point trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(close[1] > open[1] , 1 , IFf(close[1] <= open[1] , -1 , IFf(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(isnan(trend_dir[1])==False,trend_dir[1],0))))); trend_bars = iff(sar_long_to_short , -1 , IFf(sar_short_to_long , 1 , iff(trend_dir == 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0)+ 1 , IFf( trend_dir == -1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) - 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) )))); // Calculate Acceleration Factor af = iff(trend_change , start , iff(trend_dir == 1 and high > ep[1] or trend_dir == -1 and low < ep[1] , min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , iff(trend_change and trend_dir == -1 , low , iff(trend_dir == 1 , max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(close[1] > open[1] , low[1] , IFf(close[1] <= open[1] , high[1] , IFf(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); IF trend_bars == entry_bars TheN find(1); 즐거운 하루되세요
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-08-23 10:20:35

안녕하세요 예스스탁입니다. barstate.isfirst[1] 내용을 추가하지 않아서 발생한 내용같습니다. 해당 내용이 있는 곳에 동일조건을 추가했습니다. 1 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False),nz1(0); atrv = atr(atr_length); atrv = IFf(IsNan(atrv) == true, TrueRange , atrv); psar = 0.0; af = 0.0; trend_dir = 0; ep = 0.0; trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = Index[1] == 0 or sar_long_to_short or sar_short_to_long; // Calculate trend direction nz1 = IFF(IsNan(trend_dir[1])== False,trend_dir[1],0); trend_dir = iff(Index[1] == 0 and close[1] > open[1] , 1 , iff(Index[1] == 0 and close[1] <= open[1] , -1 , iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , nz1)))); trend_bars = iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(trend_dir == 1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0) + 1 , Iff(trend_dir == -1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0) - 1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0))))); // Calculate Acceleration Factor af = iff(trend_change , start , Iff((trend_dir == 1 and high > ep[1]) or (trend_dir == -1 and low < ep[1]), min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , IFf( trend_change and trend_dir == -1 , low , iff(trend_dir == 1 ,max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(Index[1] == 0 and close[1] > open[1] , low[1] , Iff(Index[1] == 0 and close[1] <= open[1] , high[1] , Iff(trend_change , ep[1] , Iff(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); plot1(psar,"psav",iff(trend_dir == 1 , green , red)); 2 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False),nz1(0); atrv = atr(atr_length); atrv = IFf(IsNan(atrv) == true, TrueRange , atrv); psar = 0.0; af = 0.0; trend_dir = 0; ep = 0.0; trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = Index[1] == 0 or sar_long_to_short or sar_short_to_long; // Calculate trend direction nz1 = IFF(IsNan(trend_dir[1])== False,trend_dir[1],0); trend_dir = iff(Index[1] == 0 and close[1] > open[1] , 1 , iff(Index[1] == 0 and close[1] <= open[1] , -1 , iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , nz1)))); trend_bars = iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(trend_dir == 1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0) + 1 , Iff(trend_dir == -1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0) - 1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0))))); // Calculate Acceleration Factor af = iff(trend_change , start , Iff((trend_dir == 1 and high > ep[1]) or (trend_dir == -1 and low < ep[1]), min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , IFf( trend_change and trend_dir == -1 , low , iff(trend_dir == 1 ,max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(Index[1] == 0 and close[1] > open[1] , low[1] , Iff(Index[1] == 0 and close[1] <= open[1] , high[1] , Iff(trend_change , ep[1] , Iff(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); IF trend_bars == entry_bars TheN Buy(); IF trend_bars == -entry_bars TheN Sell(); 3 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False),nz1(0); atrv = atr(atr_length); atrv = IFf(IsNan(atrv) == true, TrueRange , atrv); psar = 0.0; af = 0.0; trend_dir = 0; ep = 0.0; trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = Index[1] == 0 or sar_long_to_short or sar_short_to_long; // Calculate trend direction nz1 = IFF(IsNan(trend_dir[1])== False,trend_dir[1],0); trend_dir = iff(Index[1] == 0 and close[1] > open[1] , 1 , iff(Index[1] == 0 and close[1] <= open[1] , -1 , iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , nz1)))); trend_bars = iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(trend_dir == 1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0) + 1 , Iff(trend_dir == -1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0) - 1 , IFF(IsNan(trend_bars[1])== False,trend_bars[1],0))))); // Calculate Acceleration Factor af = iff(trend_change , start , Iff((trend_dir == 1 and high > ep[1]) or (trend_dir == -1 and low < ep[1]), min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , IFf( trend_change and trend_dir == -1 , low , iff(trend_dir == 1 ,max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(Index[1] == 0 and close[1] > open[1] , low[1] , Iff(Index[1] == 0 and close[1] <= open[1] , high[1] , Iff(trend_change , ep[1] , Iff(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); IF trend_bars == entry_bars TheN find(1); 즐거운 하루되세요 > 하루삼프로 님이 쓴 글입니다. > 제목 : 83425번 2항 문의사항 입니다. > 83425번 2번항에 해당되는 파인스크립 을 예스 수식으로 변환 부탁드립니다 에서 변환해주신 수식 적용하니 지표가 트레이딩뷰차트랑 예스차트랑 다르게 표기 됩니다. 파일 첨부 하오니 검토 부탁 드리겠습니다. 아래: 파인스크립트 수식 83425번 2번항 atr_length = input(500) start = input(500) increment = input(500) maximum = input(500) entry_bars = input(500, title='Entry on Nth trend bar') atr = ta.atr(atr_length) atr := na(atr) ? ta.tr : atr psar = 0.0 // PSAR af = 0.0 // Acceleration Factor trend_dir = 0 // Current direction of PSAR ep = 0.0 // Extreme point trend_bars = 0 sar_long_to_short = trend_dir[1] == 1 and close <= psar[1] // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1] // PSAR switches from short to long trend_change = barstate.isfirst[1] or sar_long_to_short or sar_short_to_long // Calculate trend direction trend_dir := barstate.isfirst[1] and close[1] > open[1] ? 1 : barstate.isfirst[1] and close[1] <= open[1] ? -1 : sar_long_to_short ? -1 : sar_short_to_long ? 1 : nz(trend_dir[1]) trend_bars := sar_long_to_short ? -1 : sar_short_to_long ? 1 : trend_dir == 1 ? nz(trend_bars[1]) + 1 : trend_dir == -1 ? nz(trend_bars[1]) - 1 : nz(trend_bars[1]) // Calculate Acceleration Factor af := trend_change ? start : trend_dir == 1 and high > ep[1] or trend_dir == -1 and low < ep[1] ? math.min(maximum, af[1] + increment) : af[1] // Calculate extreme point ep := trend_change and trend_dir == 1 ? high : trend_change and trend_dir == -1 ? low : trend_dir == 1 ? math.max(ep[1], high) : math.min(ep[1], low) // Calculate PSAR psar := barstate.isfirst[1] and close[1] > open[1] ? low[1] : barstate.isfirst[1] and close[1] <= open[1] ? high[1] : trend_change ? ep[1] : trend_dir == 1 ? psar[1] + af * atr : psar[1] - af * atr plot(psar, style=plot.style_cross, color=trend_dir == 1 ? color.green : color.red, linewidth=2) // Strategy strategy.entry('Long', strategy.long, when=trend_bars == entry_bars) strategy.entry('Short', strategy.short, when=trend_bars == -entry_bars) --------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------- 아래: 변환해주신 수식 입니다. 2-1 지표 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False); atrv = atr(atr_length); atrv = iff(IsNan(atrv) == true ,TrueRange , atrv); psar = 0.0; // PSAR af = 0.0; // Acceleration Factor trend_dir = 0; // Current direction of PSAR ep = 0.0; // Extreme point trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(close[1] > open[1] , 1 , IFf(close[1] <= open[1] , -1 , IFf(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(isnan(trend_dir[1])==False,trend_dir[1],0))))); trend_bars = iff(sar_long_to_short , -1 , IFf(sar_short_to_long , 1 , iff(trend_dir == 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0)+ 1 , IFf( trend_dir == -1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) - 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) )))); // Calculate Acceleration Factor af = iff(trend_change , start , iff(trend_dir == 1 and high > ep[1] or trend_dir == -1 and low < ep[1] , min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , iff(trend_change and trend_dir == -1 , low , iff(trend_dir == 1 , max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(close[1] > open[1] , low[1] , IFf(close[1] <= open[1] , high[1] , IFf(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); plot1(psar,"psar",iff(trend_dir == 1 , green , red)); 2-2 시스템 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False); atrv = atr(atr_length); atrv = iff(IsNan(atrv) == true ,TrueRange , atrv); psar = 0.0; // PSAR af = 0.0; // Acceleration Factor trend_dir = 0; // Current direction of PSAR ep = 0.0; // Extreme point trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(close[1] > open[1] , 1 , IFf(close[1] <= open[1] , -1 , IFf(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(isnan(trend_dir[1])==False,trend_dir[1],0))))); trend_bars = iff(sar_long_to_short , -1 , IFf(sar_short_to_long , 1 , iff(trend_dir == 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0)+ 1 , IFf( trend_dir == -1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) - 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) )))); // Calculate Acceleration Factor af = iff(trend_change , start , iff(trend_dir == 1 and high > ep[1] or trend_dir == -1 and low < ep[1] , min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , iff(trend_change and trend_dir == -1 , low , iff(trend_dir == 1 , max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(close[1] > open[1] , low[1] , IFf(close[1] <= open[1] , high[1] , IFf(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); IF trend_bars == entry_bars TheN Buy(); IF trend_bars == -entry_bars TheN Sell(); 2-3 종목검색 input : atr_length(500),start(500),increment(500),maximum(500),entry_bars(500); var : atrv(0),psar(0),af(0),trend_dir(0),ep(0),trend_bars(0); var : sar_long_to_short(False),sar_short_to_long(False); var : trend_change(False); atrv = atr(atr_length); atrv = iff(IsNan(atrv) == true ,TrueRange , atrv); psar = 0.0; // PSAR af = 0.0; // Acceleration Factor trend_dir = 0; // Current direction of PSAR ep = 0.0; // Extreme point trend_bars = 0; sar_long_to_short = trend_dir[1] == 1 and close <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and close >= psar[1]; // PSAR switches from short to long trend_change = sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(close[1] > open[1] , 1 , IFf(close[1] <= open[1] , -1 , IFf(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(isnan(trend_dir[1])==False,trend_dir[1],0))))); trend_bars = iff(sar_long_to_short , -1 , IFf(sar_short_to_long , 1 , iff(trend_dir == 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0)+ 1 , IFf( trend_dir == -1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) - 1 , iff(isnan(trend_bars[1])==False,trend_bars[1],0) )))); // Calculate Acceleration Factor af = iff(trend_change , start , iff(trend_dir == 1 and high > ep[1] or trend_dir == -1 and low < ep[1] , min(maximum, af[1] + increment) , af[1])); // Calculate extreme point ep = iff(trend_change and trend_dir == 1 , high , iff(trend_change and trend_dir == -1 , low , iff(trend_dir == 1 , max(ep[1], high) , min(ep[1], low)))); // Calculate PSAR psar = iff(close[1] > open[1] , low[1] , IFf(close[1] <= open[1] , high[1] , IFf(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * atrv , psar[1] - af * atrv)))); IF trend_bars == entry_bars TheN find(1); 즐거운 하루되세요