커뮤니티

문의드립니다

프로필 이미지
탱탱볼
2023-07-04 09:25:43
913
글번호 170298
답변완료
어제 질문드린 수식값(수정)에 복리 적용하려고 하니 아래의 b1, b2, b3 에서 에러가 뜹니다. 정확히는 b1, b2, b3 값에 복리적용이 되지 않습니다. 어떻게 변경해야할까요? 아래 수식 보시고 미흡한 점도 함께 보완 부탁드립니다. input : 원금(0),시작일0),시작시간(0); var : Tcond(False),수량(0); if sDate == 시작일 and sTime >= 시작시간 Then 수량 = (원금+NetProfit)/NextBarOpen; input : P1(0),P2(0),P3(0); input : short1(0),long1(0),sig1(0); input : shor(0),long(0),sig(0); input : sho(0),lon(0),si(0); if Tcond == true Then var : mav1(0),mav2(0),mav3(0); var : macdv1(0),macdv2(0),macdv3(0),macds1(0),macds2(0),macds3(0); mav1 = ma(C,P1); mav2 = ma(C,P2); mav3 = ma(C,P3); macdv1 = macd(short1,long1); macdv2 = macd(shor,long); macdv3 = macd(sho,lon); macds1 = Ema(macdv1,sig1); macds2 = Ema(macdv2,sig); macds3 = Ema(macdv3,si); if MarketPosition <= 0 and CrossUp(macdv1,0) Then { Buy("b",AtMarket,Def,수량); } If macdv1 > 0 and CrossUp(macdv1, macds1) Then { Buy("bx",AtMarket,Def,수량); } if MarketPosition == 0 and CountIf(macdv1<0,BarsSinceExit(1)) < 1 Then { if IsExitName("s1",1) == true Then Buy("b1",AtLimit,EntryPrice(1)*0.05); if IsExitName("s2",1) == true Then Buy("b2",AtLimit,EntryPrice(1)*0.05); if IsExitName("s3",1) == true Then Buy("b3",AtLimit,ExitPrice(1)*0.05); } If macdv1 > 0 and macdv2 > 0 and CrossDown(macdv3, 0) Then { Buy("b5",AtMarket,Def,수량); } If macdv1 > 0 and macdv2 > 0 and CrossUp(macdv3,macds3) Then { Buy("b6",AtMarket,Def,수량); } If macdv1 > 0 and macdv2 < 0 Then { ExitLong("sx"); } if MarketPosition == 1 Then { if mav3 > mav2 and mav2 > mav1 Then { ExitLong("s1",AtLimit,EntryPrice*0.15); } if mav3 > mav1 and mav1 > mav2 Then { ExitLong("s2",AtLimit,EntryPrice*0.20); } if mav1 > mav3 and mav3 > mav2 Then { ExitLong("s3",AtLimit,EntryPrice*0.30); } } 감사합니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-07-04 14:04:00

안녕하세요 예스스탁입니다. b1,b2,b3에 수량을 지정하는 부분이 없었습니다. 진입함수에 수량이 지정되지 않으면 설정창의 수량이 적용됩니다. input : 원금(0),시작일(0),시작시간(0); var : Tcond(False),수량(0); if sDate == 시작일 and sTime >= 시작시간 Then 수량 = (원금+NetProfit)/NextBarOpen; input : P1(0),P2(0),P3(0); input : short1(0),long1(0),sig1(0); input : shor(0),long(0),sig(0); input : sho(0),lon(0),si(0); if Tcond == true Then var : mav1(0),mav2(0),mav3(0); var : macdv1(0),macdv2(0),macdv3(0),macds1(0),macds2(0),macds3(0); mav1 = ma(C,P1); mav2 = ma(C,P2); mav3 = ma(C,P3); macdv1 = macd(short1,long1); macdv2 = macd(shor,long); macdv3 = macd(sho,lon); macds1 = Ema(macdv1,sig1); macds2 = Ema(macdv2,sig); macds3 = Ema(macdv3,si); if MarketPosition <= 0 and CrossUp(macdv1,0) Then { Buy("b",AtMarket,Def,수량); } If macdv1 > 0 and CrossUp(macdv1, macds1) Then { Buy("bx",AtMarket,Def,수량); } if MarketPosition == 0 and CountIf(macdv1<0,BarsSinceExit(1)) < 1 Then { if IsExitName("s1",1) == true Then Buy("b1",AtLimit,EntryPrice(1)*0.05,수량); if IsExitName("s2",1) == true Then Buy("b2",AtLimit,EntryPrice(1)*0.05,수량); if IsExitName("s3",1) == true Then Buy("b3",AtLimit,ExitPrice(1)*0.05,수량); } If macdv1 > 0 and macdv2 > 0 and CrossDown(macdv3, 0) Then { Buy("b5",AtMarket,Def,수량); } If macdv1 > 0 and macdv2 > 0 and CrossUp(macdv3,macds3) Then { Buy("b6",AtMarket,Def,수량); } If macdv1 > 0 and macdv2 < 0 Then { ExitLong("sx"); } if MarketPosition == 1 Then { if mav3 > mav2 and mav2 > mav1 Then { ExitLong("s1",AtLimit,EntryPrice*0.15); } if mav3 > mav1 and mav1 > mav2 Then { ExitLong("s2",AtLimit,EntryPrice*0.20); } if mav1 > mav3 and mav3 > mav2 Then { ExitLong("s3",AtLimit,EntryPrice*0.30); } } 즐거운 하루되세요 > 탱탱볼 님이 쓴 글입니다. > 제목 : 문의드립니다 > 어제 질문드린 수식값(수정)에 복리 적용하려고 하니 아래의 b1, b2, b3 에서 에러가 뜹니다. 정확히는 b1, b2, b3 값에 복리적용이 되지 않습니다. 어떻게 변경해야할까요? 아래 수식 보시고 미흡한 점도 함께 보완 부탁드립니다. input : 원금(0),시작일0),시작시간(0); var : Tcond(False),수량(0); if sDate == 시작일 and sTime >= 시작시간 Then 수량 = (원금+NetProfit)/NextBarOpen; input : P1(0),P2(0),P3(0); input : short1(0),long1(0),sig1(0); input : shor(0),long(0),sig(0); input : sho(0),lon(0),si(0); if Tcond == true Then var : mav1(0),mav2(0),mav3(0); var : macdv1(0),macdv2(0),macdv3(0),macds1(0),macds2(0),macds3(0); mav1 = ma(C,P1); mav2 = ma(C,P2); mav3 = ma(C,P3); macdv1 = macd(short1,long1); macdv2 = macd(shor,long); macdv3 = macd(sho,lon); macds1 = Ema(macdv1,sig1); macds2 = Ema(macdv2,sig); macds3 = Ema(macdv3,si); if MarketPosition <= 0 and CrossUp(macdv1,0) Then { Buy("b",AtMarket,Def,수량); } If macdv1 > 0 and CrossUp(macdv1, macds1) Then { Buy("bx",AtMarket,Def,수량); } if MarketPosition == 0 and CountIf(macdv1<0,BarsSinceExit(1)) < 1 Then { if IsExitName("s1",1) == true Then Buy("b1",AtLimit,EntryPrice(1)*0.05); if IsExitName("s2",1) == true Then Buy("b2",AtLimit,EntryPrice(1)*0.05); if IsExitName("s3",1) == true Then Buy("b3",AtLimit,ExitPrice(1)*0.05); } If macdv1 > 0 and macdv2 > 0 and CrossDown(macdv3, 0) Then { Buy("b5",AtMarket,Def,수량); } If macdv1 > 0 and macdv2 > 0 and CrossUp(macdv3,macds3) Then { Buy("b6",AtMarket,Def,수량); } If macdv1 > 0 and macdv2 < 0 Then { ExitLong("sx"); } if MarketPosition == 1 Then { if mav3 > mav2 and mav2 > mav1 Then { ExitLong("s1",AtLimit,EntryPrice*0.15); } if mav3 > mav1 and mav1 > mav2 Then { ExitLong("s2",AtLimit,EntryPrice*0.20); } if mav1 > mav3 and mav3 > mav2 Then { ExitLong("s3",AtLimit,EntryPrice*0.30); } } 감사합니다.