커뮤니티

수식 부탁드립니다

프로필 이미지
오이도인
2022-10-31 08:47:35
833
글번호 163398
답변완료
수고 하십니다. 아래 지표식을 시스템식으로 바꿔주세요,,, 감사합니다. ######## input : start(0.02),increment(0.02),maximum(0.2); var : haopen(0),haclose(0),hahigh(0),halow(0),hacolor(0); var : af(0),trend_dir(0),ep(0),trend_bars(0),psar(0); var : sar_long_to_short(False),sar_short_to_long(False),trend_change(False); if index == 0 then { haOpen = open; haClose = (O+H+L+C)/4; haHigh = MaxList( high, haOpen, haClose); haLow = MinList( low, haOpen,haClose); } else { haClose = (O+H+L+C)/4; haOpen = (haOpen [1] + haClose [1])/2 ; haHigh = MaxList(High, haOpen, haClose) ; haLow = MinList(Low, haOpen, haClose) ; } hacolor = iff(haclose > haopen , green ,red); 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 haclose <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and haclose >= psar[1]; // PSAR switches from short to long trend_change = IsNaN(psar[2]) == true or sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(IsNaN(psar[2]) == true and haclose[1] > haopen[1] , 1 , IFf(IsNaN(psar[2]) == true and haclose[1] <= haopen[1] , -1 , iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , trend_dir[1])))); trend_bars = iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(trend_dir == 1 , trend_bars[1] + 1 , iff(trend_dir == -1 , trend_bars[1] - 1 ,trend_bars[1])))); // Calculate Acceleration Factor af = iff(trend_change , start , iff((trend_dir == 1 and hahigh > 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 , hahigh , iff(trend_change and trend_dir == -1 , halow , iff(trend_dir == 1 , max(ep[1], hahigh) ,min(ep[1], halow)))); // Calculate PSAR psar = iff(IsNaN(psar[2]) == true and haclose[1] > haopen[1] , halow[1] , iff(IsNan(psar[2]) == true and haclose[1] <= haopen[1] , hahigh[1] , iff(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * (ep - psar[1]) , psar[1] - af * (psar[1] - ep) )))); plot1(psar,"pSar",iff(trend_dir == 1 ,Red,v));
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-10-31 16:17:39

안녕하세요 예스스탁입니다. input : start(0.02),increment(0.02),maximum(0.2); var : haopen(0),haclose(0),hahigh(0),halow(0),hacolor(0); var : af(0),trend_dir(0),ep(0),trend_bars(0),psar(0); var : sar_long_to_short(False),sar_short_to_long(False),trend_change(False); if index == 0 then { haOpen = open; haClose = (O+H+L+C)/4; haHigh = MaxList( high, haOpen, haClose); haLow = MinList( low, haOpen,haClose); } else { haClose = (O+H+L+C)/4; haOpen = (haOpen [1] + haClose [1])/2 ; haHigh = MaxList(High, haOpen, haClose) ; haLow = MinList(Low, haOpen, haClose) ; } hacolor = iff(haclose > haopen , green ,red); 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 haclose <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and haclose >= psar[1]; // PSAR switches from short to long trend_change = IsNaN(psar[2]) == true or sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(IsNaN(psar[2]) == true and haclose[1] > haopen[1] , 1 , IFf(IsNaN(psar[2]) == true and haclose[1] <= haopen[1] , -1 , iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , trend_dir[1])))); trend_bars = iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(trend_dir == 1 , trend_bars[1] + 1 , iff(trend_dir == -1 , trend_bars[1] - 1 ,trend_bars[1])))); // Calculate Acceleration Factor af = iff(trend_change , start , iff((trend_dir == 1 and hahigh > 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 , hahigh , iff(trend_change and trend_dir == -1 , halow , iff(trend_dir == 1 , max(ep[1], hahigh) ,min(ep[1], halow)))); // Calculate PSAR psar = iff(IsNaN(psar[2]) == true and haclose[1] > haopen[1] , halow[1] , iff(IsNan(psar[2]) == true and haclose[1] <= haopen[1] , hahigh[1] , iff(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * (ep - psar[1]) , psar[1] - af * (psar[1] - ep) )))); if trend_dir == 1 Then Buy(); Else Sell(); 즐거운 하루되세요 > 오이도인 님이 쓴 글입니다. > 제목 : 수식 부탁드립니다 > 수고 하십니다. 아래 지표식을 시스템식으로 바꿔주세요,,, 감사합니다. ######## input : start(0.02),increment(0.02),maximum(0.2); var : haopen(0),haclose(0),hahigh(0),halow(0),hacolor(0); var : af(0),trend_dir(0),ep(0),trend_bars(0),psar(0); var : sar_long_to_short(False),sar_short_to_long(False),trend_change(False); if index == 0 then { haOpen = open; haClose = (O+H+L+C)/4; haHigh = MaxList( high, haOpen, haClose); haLow = MinList( low, haOpen,haClose); } else { haClose = (O+H+L+C)/4; haOpen = (haOpen [1] + haClose [1])/2 ; haHigh = MaxList(High, haOpen, haClose) ; haLow = MinList(Low, haOpen, haClose) ; } hacolor = iff(haclose > haopen , green ,red); 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 haclose <= psar[1]; // PSAR switches from long to short sar_short_to_long = trend_dir[1] == -1 and haclose >= psar[1]; // PSAR switches from short to long trend_change = IsNaN(psar[2]) == true or sar_long_to_short or sar_short_to_long; // Calculate trend direction trend_dir = iff(IsNaN(psar[2]) == true and haclose[1] > haopen[1] , 1 , IFf(IsNaN(psar[2]) == true and haclose[1] <= haopen[1] , -1 , iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , trend_dir[1])))); trend_bars = iff(sar_long_to_short , -1 , iff(sar_short_to_long , 1 , iff(trend_dir == 1 , trend_bars[1] + 1 , iff(trend_dir == -1 , trend_bars[1] - 1 ,trend_bars[1])))); // Calculate Acceleration Factor af = iff(trend_change , start , iff((trend_dir == 1 and hahigh > 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 , hahigh , iff(trend_change and trend_dir == -1 , halow , iff(trend_dir == 1 , max(ep[1], hahigh) ,min(ep[1], halow)))); // Calculate PSAR psar = iff(IsNaN(psar[2]) == true and haclose[1] > haopen[1] , halow[1] , iff(IsNan(psar[2]) == true and haclose[1] <= haopen[1] , hahigh[1] , iff(trend_change , ep[1] , IFf(trend_dir == 1 , psar[1] + af * (ep - psar[1]) , psar[1] - af * (psar[1] - ep) )))); plot1(psar,"pSar",iff(trend_dir == 1 ,Red,v));