커뮤니티

시스템수식 오류 가르침 요청

프로필 이미지
세력은내밥줄
2025-10-24 13:57:13
87
글번호 227271
답변완료

아래시스템트레이딩 코드에 /=========================================== // 1. 지표 계산 // ============== RSI_Current := RSI(Close, RSI_Period); 에 잘못된 문법이라고 합니다. 수정 후 전체코드를 다시 주시길 간곡히 부탁을 드립니다.



Inputs: RSI_Period(14), MACD_Fast(12), MACD_Slow(26), MACD_Signal(9), BB_Period(20), BB_Dev(2), DivBars(5), RSI_BuyLevel(30), RSI_SellLevel(70); Variables: // RSI RSI_Current(0), RSI_PrevLow(0), RSI_PrevHigh(0), // MACD MACD_Main(0), MACD_Signal_Line(0), MACD_Main_Prev(0), MACD_Signal_Prev(0), // Bollinger Bands BB_Upper(0), BB_Lower(0), BB_Upper_Prev(0), BB_Lower_Prev(0), // Divergence Detection Price_Low1(0), Price_Low2(0), RSI_Low1(0), RSI_Low2(0), Bullish_Div(0), Price_High1(0), Price_High2(0), RSI_High1(0), RSI_High2(0), Bearish_Div(0), // Index for Lowest/Highest Low1_Idx(0), Low2_Idx(0), High1_Idx(0), High2_Idx(0), // Conditions MACD_Cross_Up(0), MACD_Cross_Down(0), Touch_Lower_BB(0), Touch_Upper_BB(0), Buy_Signal(0), Sell_Signal(0); //=================================================================== // 1. 지표 계산 //=================================================================== RSI_Current := RSI(Close, RSI_Period); MACD_Main := MACD(Close, MACD_Fast, MACD_Slow, MACD_Signal, 0); MACD_Signal_Line := MACD(Close, MACD_Fast, MACD_Slow, MACD_Signal, 1); MACD_Main_Prev := MACD(Close, MACD_Fast, MACD_Slow, MACD_Signal, 0)[1]; MACD_Signal_Prev := MACD(Close, MACD_Fast, MACD_Slow, MACD_Signal, 1)[1]; BB_Upper := BollingerBand(Close, BB_Period, BB_Dev, 1); BB_Lower := BollingerBand(Close, BB_Period, BB_Dev, 2); BB_Upper_Prev := BollingerBand(Close, BB_Period, BB_Dev, 1)[1]; BB_Lower_Prev := BollingerBand(Close, BB_Period, BB_Dev, 2)[1]; //=================================================================== // 2. 다이버전스 감지 (Bullish & Bearish) //=================================================================== // Bullish Divergence: 가격은 낮은 저점, RSI는 높은 저점 Low1_Idx := LowestBar(Low, DivBars, 1); Low2_Idx := LowestBar(Low, DivBars, DivBars+1); Price_Low1 := Low[Low1_Idx]; Price_Low2 := Low[Low2_Idx]; RSI_Low1 := RSI(Close, RSI_Period)[Low1_Idx]; RSI_Low2 := RSI(Close, RSI_Period)[Low2_Idx]; Bullish_Div := (Price_Low1 < Price_Low2) And (RSI_Low1 > RSI_Low2); // Bearish Divergence: 가격은 높은 고점, RSI는 낮은 고점 High1_Idx := HighestBar(High, DivBars, 1); High2_Idx := HighestBar(High, DivBars, DivBars+1); Price_High1 := High[High1_Idx]; Price_High2 := High[High2_Idx]; RSI_High1 := RSI(Close, RSI_Period)[High1_Idx]; RSI_High2 := RSI(Close, RSI_Period)[High2_Idx]; Bearish_Div := (Price_High1 > Price_High2) And (RSI_High1 < RSI_High2); //=================================================================== // 3. MACD 크로스 //=================================================================== MACD_Cross_Up := (MACD_Main_Prev <= MACD_Signal_Prev) And (MACD_Main > MACD_Signal_Line); MACD_Cross_Down := (MACD_Main_Prev >= MACD_Signal_Prev) And (MACD_Main < MACD_Signal_Line); //=================================================================== // 4. 볼린저 밴드 터치 후 반등/하락 //=================================================================== Touch_Lower_BB := (Low[1] <= BB_Lower_Prev) And (Close[1] > BB_Lower_Prev); Touch_Upper_BB := (High[1] >= BB_Upper_Prev) And (Close[1] < BB_Upper_Prev); //=================================================================== // 5. 최종 매수/매도 신호 //=================================================================== Buy_Signal := (RSI_Current > RSI_BuyLevel) And MACD_Cross_Up And Touch_Lower_BB And Bullish_Div; Sell_Signal := (RSI_Current < RSI_SellLevel) And MACD_Cross_Down And Touch_Upper_BB And Bearish_Div; //=================================================================== // 6. 주문 실행 (자동매매 연동용) //=================================================================== If Buy_Signal Then Begin Buy("BTC_5M_BULL"); End; If Sell_Signal Then Begin Sell("BTC_5M_BEAR"); End;

시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-10-24 18:17:16

안녕하세요 예스스탁입니다.
올리신 수식에서 다른 함수들은 예스랭귀지 문법으로 변환했지만 LowestBar(Low, DivBars, DivBars+1); HighestBar(High, DivBars, DivBars+1) 위 부분은 처음 보은 형태의 언어라 어떤 의미인지 알수 없습니다.

저희 랭귀지에서 비슷한 함수인 nthLowestBar와 nthHighestBar로 대체는 했지만 해당 부분은 사용자분이 기존 언어 도움말 내용 참고하셔서 맞는 내용으로 변환해 보셔야 합니다. 현재 해당 함수들 내용때문에 신호는 발생하지 않습니다. Inputs: RSI_Period(14), MACD_Fast(12), MACD_Slow(26), MACD_Signal(9), BB_Period(20), BB_Dev(2), DivBars(5), RSI_BuyLevel(30), RSI_SellLevel(70); Variables: // RSI RSI_Current(0), RSI_PrevLow(0), RSI_PrevHigh(0), // MACD MACD_Main(0), MACD_Signal_Line(0), MACD_Main_Prev(0), MACD_Signal_Prev(0), // Bollinger Bands BB_Upper(0), BB_Lower(0), BB_Upper_Prev(0), BB_Lower_Prev(0), // Divergence Detection Price_Low1(0), Price_Low2(0), RSI_Low1(0), RSI_Low2(0), Bullish_Div(False), Price_High1(0), Price_High2(0), RSI_High1(0), RSI_High2(0), Bearish_Div(False), // Index for Lowest/Highest Low1_Idx(0), Low2_Idx(0), High1_Idx(0), High2_Idx(0), // Conditions MACD_Cross_Up(false), MACD_Cross_Down(False), Touch_Lower_BB(False), Touch_Upper_BB(False), Buy_Signal(False), Sell_Signal(False); //=================================================================== // 1. 지표 계산 //=================================================================== RSI_Current = RSI(RSI_Period); MACD_Main = MACD(MACD_Fast, MACD_Slow); MACD_Signal_Line = ema(MACD_MAin,MACD_Signal); MACD_Main_Prev = MACD_Main[1]; MACD_Signal_Prev = MACD_Signal_Line[1]; BB_Upper = BollBandUp(BB_Period, BB_Dev); BB_Lower = BollBandDown(BB_Period, BB_Dev); BB_Upper_Prev = BB_Upper[1]; BB_Lower_Prev = BB_Lower[1]; //=================================================================== // 2. 다이버전스 감지 (Bullish & Bearish) //=================================================================== // Bullish Divergence: 가격은 낮은 저점, RSI는 높은 저점 Low1_Idx = nthLowestBar(1,Low, DivBars); Low2_Idx = nthLowestBar(DivBars+1,Low, DivBars); Price_Low1 = Low[Low1_Idx]; Price_Low2 = Low[Low2_Idx]; RSI_Low1 = RSI_Current[Low1_Idx]; RSI_Low2 = RSI_Current[Low2_Idx]; Bullish_Div = (Price_Low1 < Price_Low2) And (RSI_Low1 > RSI_Low2); // Bearish Divergence: 가격은 높은 고점, RSI는 낮은 고점 High1_Idx = nthHighestBar(1,High, DivBars); High2_Idx = nthHighestBar(DivBars+1,High, DivBars); Price_High1 = High[High1_Idx]; Price_High2 = High[High2_Idx]; RSI_High1 = RSI_Current[High1_Idx]; RSI_High2 = RSI_Current[High2_Idx]; Bearish_Div = (Price_High1 > Price_High2) And (RSI_High1 < RSI_High2); //=================================================================== // 3. MACD 크로스 //=================================================================== MACD_Cross_Up = (MACD_Main_Prev <= MACD_Signal_Prev) And (MACD_Main > MACD_Signal_Line); MACD_Cross_Down = (MACD_Main_Prev >= MACD_Signal_Prev) And (MACD_Main < MACD_Signal_Line); //=================================================================== // 4. 볼린저 밴드 터치 후 반등/하락 //=================================================================== Touch_Lower_BB = (Low[1] <= BB_Lower_Prev) And (Close[1] > BB_Lower_Prev); Touch_Upper_BB = (High[1] >= BB_Upper_Prev) And (Close[1] < BB_Upper_Prev); //=================================================================== // 5. 최종 매수/매도 신호 //=================================================================== Buy_Signal = (RSI_Current > RSI_BuyLevel) And MACD_Cross_Up And Touch_Lower_BB And Bullish_Div; Sell_Signal = (RSI_Current < RSI_SellLevel) And MACD_Cross_Down And Touch_Upper_BB And Bearish_Div; //=================================================================== // 6. 주문 실행 (자동매매 연동용) //=================================================================== If Buy_Signal Then Begin Buy("BTC_5M_BULL"); End; If Sell_Signal Then Begin Sell("BTC_5M_BEAR"); End; 즐거운 하루되세요