커뮤니티

수식 수정 좀 부탁드립니다.

프로필 이미지
산수유
2024-05-22 18:20:46
1102
글번호 179887
답변완료
아래의 원래의 식 중 몇 가지 수정 좀 부탁드립니다. 볼린저밴드(bolinger band)전략 전략실행시간 17(진입시작)-05시52분(강제청산) 1.매수: 1.종가가 볼린저 밴드 상단선 돌파 2.아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매수진입 2.매도: 1종가가 볼린저 밴드 하단선 이탈 2아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매도진입 손절 1.매수:일목구름대 중심선 이탈시 실시간 손절 2.매도;일목구름대 중심선 돌파시 실시간 손절 익절 기존대로 재진입 익절 손절 모두 1+2만족시에 종가 재진입 볼린저밴드 넓이구하는 식 Inputs: Period(20), D(2); Variables: BBTop(0), BBMid(0), BBBot(0),Bwidth(0); BBTop = BollBandUp(Period,D); BBMid = ma(C,Period); BBBot = BollBandDown(Period,D); BWidth = ((BBTop - BBBot)/ BBMid)*100; Plot1(Bwidth, "Band Width"); PlotBaseLine1(0); input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,L[BarsSinceEntry]); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,H[BarsSinceEntry]); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); }
시스템
답변 4
프로필 이미지

예스스탁 예스스탁 답변

2024-05-23 10:41:21

안녕하세요 예스스탁입니다. input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),BBMid(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0),BWidth(0); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); BBMid = ma(C,Length); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); BWidth = ((BBTop - BBBot)/ BBMid)*100; 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O and BWidth >= 0.5 Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O and BWidth >= 0.5 Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { #ExitLong("bx2",AtStop,L[BarsSinceEntry]); ExitLong("bx3",AtStop,(선행스팬1+선행스팬2)/2); } if MarketPosition == -1 Then { #ExitShort("sx2",AtStop,H[BarsSinceEntry]); ExitShort("sx3",AtStop,(선행스팬1+선행스팬2)/2); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); } 즐거운 하루되세요 > 산수유 님이 쓴 글입니다. > 제목 : 수식 수정 좀 부탁드립니다. > 아래의 원래의 식 중 몇 가지 수정 좀 부탁드립니다. 볼린저밴드(bolinger band)전략 전략실행시간 17(진입시작)-05시52분(강제청산) 1.매수: 1.종가가 볼린저 밴드 상단선 돌파 2.아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매수진입 2.매도: 1종가가 볼린저 밴드 하단선 이탈 2아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매도진입 손절 1.매수:일목구름대 중심선 이탈시 실시간 손절 2.매도;일목구름대 중심선 돌파시 실시간 손절 익절 기존대로 재진입 익절 손절 모두 1+2만족시에 종가 재진입 볼린저밴드 넓이구하는 식 Inputs: Period(20), D(2); Variables: BBTop(0), BBMid(0), BBBot(0),Bwidth(0); BBTop = BollBandUp(Period,D); BBMid = ma(C,Period); BBBot = BollBandDown(Period,D); BWidth = ((BBTop - BBBot)/ BBMid)*100; Plot1(Bwidth, "Band Width"); PlotBaseLine1(0); input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,L[BarsSinceEntry]); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,H[BarsSinceEntry]); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); }
프로필 이미지

산수유

2024-05-23 15:54:19

매번 감사드립니다. 이번에는 수익이 좀 났으면 좋겠습니다. C > O and BWidth >= 0.5 이부분을 C < O and 2 > BWidth > 0.5로 수정하니 문법에러라고 뜨는데 이유가 먼지 좀 알려 주셔요^^ > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 수정 좀 부탁드립니다. > 안녕하세요 예스스탁입니다. input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),BBMid(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0),BWidth(0); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); BBMid = ma(C,Length); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); BWidth = ((BBTop - BBBot)/ BBMid)*100; 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O and BWidth >= 0.5 Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O and BWidth >= 0.5 Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { #ExitLong("bx2",AtStop,L[BarsSinceEntry]); ExitLong("bx3",AtStop,(선행스팬1+선행스팬2)/2); } if MarketPosition == -1 Then { #ExitShort("sx2",AtStop,H[BarsSinceEntry]); ExitShort("sx3",AtStop,(선행스팬1+선행스팬2)/2); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); } 즐거운 하루되세요 > 산수유 님이 쓴 글입니다. > 제목 : 수식 수정 좀 부탁드립니다. > 아래의 원래의 식 중 몇 가지 수정 좀 부탁드립니다. 볼린저밴드(bolinger band)전략 전략실행시간 17(진입시작)-05시52분(강제청산) 1.매수: 1.종가가 볼린저 밴드 상단선 돌파 2.아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매수진입 2.매도: 1종가가 볼린저 밴드 하단선 이탈 2아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매도진입 손절 1.매수:일목구름대 중심선 이탈시 실시간 손절 2.매도;일목구름대 중심선 돌파시 실시간 손절 익절 기존대로 재진입 익절 손절 모두 1+2만족시에 종가 재진입 볼린저밴드 넓이구하는 식 Inputs: Period(20), D(2); Variables: BBTop(0), BBMid(0), BBBot(0),Bwidth(0); BBTop = BollBandUp(Period,D); BBMid = ma(C,Period); BBBot = BollBandDown(Period,D); BWidth = ((BBTop - BBBot)/ BBMid)*100; Plot1(Bwidth, "Band Width"); PlotBaseLine1(0); input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,L[BarsSinceEntry]); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,H[BarsSinceEntry]); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); }
프로필 이미지

예스스탁 예스스탁 답변

2024-05-23 16:25:36

안녕하세요 예스스탁입니다. 2 > BWidth > 0.5 예스랭귀지에서 비교는 값 2개만 비교가 가능합니다. 그러므로 아래와 같이 2개씩 비교해 and로 연결하셔야 합니다. C < O and 2 > BWidth and BWidth > 0.5 즐거운 하루되세요 > 산수유 님이 쓴 글입니다. > 제목 : Re : Re : 수식 수정 좀 부탁드립니다. > 매번 감사드립니다. 이번에는 수익이 좀 났으면 좋겠습니다. C > O and BWidth >= 0.5 이부분을 C < O and 2 > BWidth > 0.5로 수정하니 문법에러라고 뜨는데 이유가 먼지 좀 알려 주셔요^^ > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 수정 좀 부탁드립니다. > 안녕하세요 예스스탁입니다. input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),BBMid(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0),BWidth(0); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); BBMid = ma(C,Length); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); BWidth = ((BBTop - BBBot)/ BBMid)*100; 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O and BWidth >= 0.5 Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O and BWidth >= 0.5 Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { #ExitLong("bx2",AtStop,L[BarsSinceEntry]); ExitLong("bx3",AtStop,(선행스팬1+선행스팬2)/2); } if MarketPosition == -1 Then { #ExitShort("sx2",AtStop,H[BarsSinceEntry]); ExitShort("sx3",AtStop,(선행스팬1+선행스팬2)/2); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); } 즐거운 하루되세요 > 산수유 님이 쓴 글입니다. > 제목 : 수식 수정 좀 부탁드립니다. > 아래의 원래의 식 중 몇 가지 수정 좀 부탁드립니다. 볼린저밴드(bolinger band)전략 전략실행시간 17(진입시작)-05시52분(강제청산) 1.매수: 1.종가가 볼린저 밴드 상단선 돌파 2.아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매수진입 2.매도: 1종가가 볼린저 밴드 하단선 이탈 2아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매도진입 손절 1.매수:일목구름대 중심선 이탈시 실시간 손절 2.매도;일목구름대 중심선 돌파시 실시간 손절 익절 기존대로 재진입 익절 손절 모두 1+2만족시에 종가 재진입 볼린저밴드 넓이구하는 식 Inputs: Period(20), D(2); Variables: BBTop(0), BBMid(0), BBBot(0),Bwidth(0); BBTop = BollBandUp(Period,D); BBMid = ma(C,Period); BBBot = BollBandDown(Period,D); BWidth = ((BBTop - BBBot)/ BBMid)*100; Plot1(Bwidth, "Band Width"); PlotBaseLine1(0); input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,L[BarsSinceEntry]); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,H[BarsSinceEntry]); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); }
프로필 이미지

산수유

2024-05-24 08:31:21

감사드립니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : Re : Re : 수식 수정 좀 부탁드립니다. > 안녕하세요 예스스탁입니다. 2 > BWidth > 0.5 예스랭귀지에서 비교는 값 2개만 비교가 가능합니다. 그러므로 아래와 같이 2개씩 비교해 and로 연결하셔야 합니다. C < O and 2 > BWidth and BWidth > 0.5 즐거운 하루되세요 > 산수유 님이 쓴 글입니다. > 제목 : Re : Re : 수식 수정 좀 부탁드립니다. > 매번 감사드립니다. 이번에는 수익이 좀 났으면 좋겠습니다. C > O and BWidth >= 0.5 이부분을 C < O and 2 > BWidth > 0.5로 수정하니 문법에러라고 뜨는데 이유가 먼지 좀 알려 주셔요^^ > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 수식 수정 좀 부탁드립니다. > 안녕하세요 예스스탁입니다. input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),BBMid(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0),BWidth(0); var : 전환선(0),기준선(0),선행스팬1(0),선행스팬2(0); BBMid = ma(C,Length); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); BWidth = ((BBTop - BBBot)/ BBMid)*100; 전환선 = (highest(H,9)+lowest(L,9))/2; 기준선 = (highest(H,26)+lowest(L,26))/2; 선행스팬1 = (전환선[25]+기준선[25])/2; 선행스팬2 = (highest(H,52)[25]+lowest(L,52)[25])/2; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O and BWidth >= 0.5 Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O and BWidth >= 0.5 Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { #ExitLong("bx2",AtStop,L[BarsSinceEntry]); ExitLong("bx3",AtStop,(선행스팬1+선행스팬2)/2); } if MarketPosition == -1 Then { #ExitShort("sx2",AtStop,H[BarsSinceEntry]); ExitShort("sx3",AtStop,(선행스팬1+선행스팬2)/2); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); } 즐거운 하루되세요 > 산수유 님이 쓴 글입니다. > 제목 : 수식 수정 좀 부탁드립니다. > 아래의 원래의 식 중 몇 가지 수정 좀 부탁드립니다. 볼린저밴드(bolinger band)전략 전략실행시간 17(진입시작)-05시52분(강제청산) 1.매수: 1.종가가 볼린저 밴드 상단선 돌파 2.아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매수진입 2.매도: 1종가가 볼린저 밴드 하단선 이탈 2아래 볼린저밴드 넓이 식으로 나온값 >=0.5 1+2만족시에 종가 매도진입 손절 1.매수:일목구름대 중심선 이탈시 실시간 손절 2.매도;일목구름대 중심선 돌파시 실시간 손절 익절 기존대로 재진입 익절 손절 모두 1+2만족시에 종가 재진입 볼린저밴드 넓이구하는 식 Inputs: Period(20), D(2); Variables: BBTop(0), BBMid(0), BBBot(0),Bwidth(0); BBTop = BollBandUp(Period,D); BBMid = ma(C,Period); BBBot = BollBandDown(Period,D); BWidth = ((BBTop - BBBot)/ BBMid)*100; Plot1(Bwidth, "Band Width"); PlotBaseLine1(0); input : starttime(213000),Endtime(055000); Inputs: Length(20), StdDev(2), Bars(2); Var : BBTop(0),BBBot(0),T(0); var : Tcond(False),trade(False),Sarv(0),entry(0); BBTop = BollBandup(Length, StdDev); BBBot = BollBanddown(Length, StdDev); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; trade = true; IF Endtime <= starttime Then { SetStopEndofday(0); } T = 0; if C > value1 and C > Sarv Then T = 1; if C < value2 and C < Sarv Then T = -1; } Else { if T == 1 and !(C > value1 and C > Sarv) Then T = 0; if T == -1 and !(C < value2 and C < Sarv) Then T = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; if Tcond == true and Trade == true Then { If MarketPosition <= 0 and CrossUp(C,BBTop) and C > O Then { Buy("b"); ExitLong("bx1",AtStop,L); } If MarketPosition >= 0 and CrossDown(C,BBBot) and C < O Then { Sell("s"); ExitShort("sx1",AtStop,H); } } if MarketPosition == 1 Then { ExitLong("bx2",AtStop,L[BarsSinceEntry]); } if MarketPosition == -1 Then { ExitShort("sx2",AtStop,H[BarsSinceEntry]); } SetStopProfittarget(1000,PointStop); #고가가 저가대비 300포인트 이상 크면 if Tcond == true and H >= L+300 Then { #trade는 False trade = False; #매수포지션이면 청산 if MarketPosition == 1 Then exitlong(); #매도포지션이면 청산 if MarketPosition == -1 Then ExitShort(); }