커뮤니티

89178/89209요청과 관련입니다.

프로필 이미지
하날랑
2024-09-23 18:20:45
566
글번호 183692
답변완료
항상 빠른 답변에 감사를 드립니다. 수정을 하여주신 것을 복사하여 시뮬레이션을 돌려보니 신호가 하나도 발생하지 않습니다. 제가 지표 조합을 잘못해서 신호가 하나도 나오지 않나 싶어 89178로 답변주신 원본을 89209에서 수정해 주신대로 고쳐서 시뮬레이션을 돌려도 신호가 하나도 생성되지 않습니다. 한번더 검토해 주시길 부탁드립니다. input : length(13), mult(5.5), map(60); input : lengthB(16), multB(6.76); input : useClose(1);//1:종가기준, 2:고/저가 기준 input : Bolllimit(0.2); input : src(close); input : smooth(1); input : length1(25); input : SetStop(169), gamso(83), minMoney(194), 변수(0), 목표수익값(255), 수익포인트(108) ; input : StartTime(215000),EndTime(054210); //215000//054210//EndTime(081500) var : Tcond(False); var : A(0), longStop(0), longStopPrev(0), shortStop(0), shortStopPrev(0), AB(0), longStopB(0), longStopPrevB(0), shortStopB(0), shortStopPrevB(0), BollUp(0), Ma20(0), BWI(0), BollDown(0), Ma60(0), srcS(0), value(0) ; var : dir(1), dirB(1); var : offset(0.85),sigma1(7),pchange(0),avpchange(0); var : buySignal(False), buyExit(False), sellSignal(False), sellExit(False); offset = 0.85; sigma1 = 7; pchange = (src-src[smooth]) / src * 100; var : i(0),mm(0),s(0),norm(0),sum(0),weight(0); var : r(0),rsiL(False),rsiS(False); var : length11(0),src1(0),momm(0); var : m1(0),m2(0),sm1(0),sm2(0),chandeMO(0),cL(False),cS(False); mm = offset * (length1 - 1); s = length1 / sigma1; norm = 0.0; sum = 0.0; for i = 0 to length1 - 1 { weight = exp(-1 * pow(i - mm, 2) / (2 * pow(s, 2))); norm = norm + weight; sum = sum + pchange[length1 - i - 1] * weight; } avpchange = sum / norm; //RSI r = rsi(14); rsiL = r > r[1]; rsiS = r < r[1]; //Chande Momentum length11 = 9; src1 = close; momm = src1-src1[1]; m1 = iff(momm >= 0.0 , momm , 0.0); m2 = iff(momm >= 0.0 , 0 , -momm); sm1 = AccumN(m1, length11); sm2 = AccumN(m2, length11); chandeMO = 100 * (sm1-sm2) / (sm1+sm2); cL = chandeMO > chandeMO[1]; cS = chandeMO < chandeMO[1]; //GAMA credit to author: &#169; LeafAlgo https://www.tradingview.com/v/th7NZUPM/ input : lengthG(14); input : adaptive(1);#true면 1, 아니면 0 지정 input : volatilityPeriod(20); input : vv(1); var : gma(0),sumOfWeights(0),sigma(0),valueG(0),gmaColor(0),tx(0); // Calculate Gaussian Moving Average gma = 0.0; sumOfWeights = 0.0; sigma = iff(adaptive == 1 , std(close, volatilityPeriod) ,vv); for i = 0 to lengthG - 1 { weight = exp(-pow(((i - (lengthG - 1)) / (2 * sigma)), 2) / 2); valueG = highest(avpchange, i + 1) + lowest(avpchange, i + 1); gma = gma + (valueG * weight); sumOfWeights = sumOfWeights + weight; } gma = (gma / sumOfWeights)/2; gma = ema(gma, 7); gmaColor = iff(avpchange >= gma , rgb(0, 161, 5) , rgb(215, 0, 0)); var : currentSignal(0),barColor(Nan); currentSignal = iff(avpchange >= gma , 1 , -1); if currentSignal == 1 Then barColor = rgb(0, 186, 6); BollUp = BollBandUp(20, 2); BollDown = BollBandDown(20, 2); Ma20 = Average(C, 20); BWI = (BollUp - BollDown)/Ma20*100; Ma60 = Average(C, map); srcS = close; a = mult * atr(length); ab = multB * atr(lengthB); if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice+수익포인트 Then ExitLong("L_EvenBreak",AtStop,EntryPrice); if MarketPosition == -1 and lowest(l,BarsSinceEntry) <= EntryPrice-수익포인트 Then ExitShort("S_EvenBreak",AtStop,EntryPrice); longStop = IFf(useClose == 1, highest(close, length) ,highest(H,length)) - a; longStopPrev = iff(IsNan(longStop[1]) == true, longStop,longStop[1]); longStop = iff(close[1] > longStopPrev ,max(longStop, longStopPrev) , longStop); shortStop = IFf(useClose == 1, lowest(close, length) , Lowest(L,length)) + a; shortStopPrev = iff(IsNan(shortStop[1]) == true, shortStop,shortStop[1]); shortStop = iff(close[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop); dir = iff(close > shortStopPrev , 1 , IFF(close < longStopPrev , -1 , dir)); longStopB = IFf(useClose == 1, highest(close, lengthB) ,highest(H,lengthB)) - aB; longStopPrevB = iff(IsNan(longStopB[1]) == true, longStopB,longStopB[1]); longStopB = iff(close[1] > longStopPrevB ,max(longStopB, longStopPrevB) , longStopB); shortStopB = IFf(useClose == 1, lowest(close, lengthB) , Lowest(L,lengthB)) + aB; shortStopPrevB = iff(IsNan(shortStopB[1]) == true, shortStopB,shortStopB[1]); shortStopB = iff(close[1] < shortStopPrevB , min(shortStopB, shortStopPrevB) , shortStopB); dirB = iff(close > shortStopPrevB , 1 , IFF(close < longStopPrevB , -1 , dirB)); buySignal = avpchange > gma and BWI >= Bolllimit and C > O and (C > Ma60 or dir == 1) and (CrossUp(avpchange,gma) or dir[1] == -1 or crossUp(C, Ma60)); buyExit = CrossDown(avpchange,gma); sellSignal = avpchange < gma and BWI >= Bolllimit and C < O and (C < Ma60 or dirB == -1) and (CrossDown(avpchange,gma) or dirB[1] == 1 or crossUp(C, Ma60)); sellExit = CrossUp(avpchange,gma); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if Bdate != Bdate[1] Then { IF Endtime <= starttime Then { SetStopEndofday(0); } } 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; if Tcond == true Then { if buySignal == true Then Buy("Buy"); if buyExit == true Then ExitLong("BExit"); if sellSignal == true Then Sell("Sell"); if sellExit == true Then ExitShort("SExit"); } //SetStopInactivity(최소가격,기간,PointStop); SetStopProfittarget(목표수익값,PointStop); SetStopLoss(SetStop,PointStop); SetStopTrailing(gamso,minMoney,PointStop,변수);
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2024-09-24 09:51:26

안녕하세요 예스스탁입니다. input : src(close); 외부변수 중에 src도 변경해야 하는데 변경해 드리지 못했습니다. 아래식 적용하시면 됩니다. 시뮬레이션 차트에는 외부변수가 완전히 숫자형 변수만 지정되어야 합니다. input : length(13), mult(5.5), map(60); input : lengthB(16), multB(6.76); input : useClose(1);//1:종가기준, 2:고/저가 기준 input : Bolllimit(0.2); input : smooth(1); input : length1(25); input : SetStop(169), gamso(83), minMoney(194), 변수(0), 목표수익값(255), 수익포인트(108) ; input : StartTime(215000),EndTime(054210); //215000//054210//EndTime(081500) var : Tcond(False); var : A(0), longStop(0), longStopPrev(0), shortStop(0), shortStopPrev(0), AB(0), longStopB(0), longStopPrevB(0), shortStopB(0), shortStopPrevB(0), BollUp(0), Ma20(0), BWI(0), BollDown(0), Ma60(0), srcS(0), value(0) ; var : dir(1), dirB(1); var : offset(0.85),sigma1(7),pchange(0),avpchange(0); var : buySignal(False), buyExit(False), sellSignal(False), sellExit(False); var : src(0); src = close; offset = 0.85; sigma1 = 7; pchange = (src-src[smooth]) / src * 100; var : i(0),mm(0),s(0),norm(0),sum(0),weight(0); var : r(0),rsiL(False),rsiS(False); var : length11(0),src1(0),momm(0); var : m1(0),m2(0),sm1(0),sm2(0),chandeMO(0),cL(False),cS(False); mm = offset * (length1 - 1); s = length1 / sigma1; norm = 0.0; sum = 0.0; for i = 0 to length1 - 1 { weight = exp(-1 * pow(i - mm, 2) / (2 * pow(s, 2))); norm = norm + weight; sum = sum + pchange[length1 - i - 1] * weight; } avpchange = sum / norm; //RSI r = rsi(14); rsiL = r > r[1]; rsiS = r < r[1]; //Chande Momentum length11 = 9; src1 = close; momm = src1-src1[1]; m1 = iff(momm >= 0.0 , momm , 0.0); m2 = iff(momm >= 0.0 , 0 , -momm); sm1 = AccumN(m1, length11); sm2 = AccumN(m2, length11); chandeMO = 100 * (sm1-sm2) / (sm1+sm2); cL = chandeMO > chandeMO[1]; cS = chandeMO < chandeMO[1]; //GAMA credit to author: &#169; LeafAlgo https://www.tradingview.com/v/th7NZUPM/ input : lengthG(14); input : adaptive(1);#true면 1, 아니면 0 지정 input : volatilityPeriod(20); input : vv(1); var : gma(0),sumOfWeights(0),sigma(0),valueG(0),gmaColor(0),tx(0); // Calculate Gaussian Moving Average gma = 0.0; sumOfWeights = 0.0; sigma = iff(adaptive == 1 , std(close, volatilityPeriod) ,vv); for i = 0 to lengthG - 1 { weight = exp(-pow(((i - (lengthG - 1)) / (2 * sigma)), 2) / 2); valueG = highest(avpchange, i + 1) + lowest(avpchange, i + 1); gma = gma + (valueG * weight); sumOfWeights = sumOfWeights + weight; } gma = (gma / sumOfWeights)/2; gma = ema(gma, 7); gmaColor = iff(avpchange >= gma , rgb(0, 161, 5) , rgb(215, 0, 0)); var : currentSignal(0),barColor(Nan); currentSignal = iff(avpchange >= gma , 1 , -1); if currentSignal == 1 Then barColor = rgb(0, 186, 6); BollUp = BollBandUp(20, 2); BollDown = BollBandDown(20, 2); Ma20 = Average(C, 20); BWI = (BollUp - BollDown)/Ma20*100; Ma60 = Average(C, map); srcS = close; a = mult * atr(length); ab = multB * atr(lengthB); if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice+수익포인트 Then ExitLong("L_EvenBreak",AtStop,EntryPrice); if MarketPosition == -1 and lowest(l,BarsSinceEntry) <= EntryPrice-수익포인트 Then ExitShort("S_EvenBreak",AtStop,EntryPrice); longStop = IFf(useClose == 1, highest(close, length) ,highest(H,length)) - a; longStopPrev = iff(IsNan(longStop[1]) == true, longStop,longStop[1]); longStop = iff(close[1] > longStopPrev ,max(longStop, longStopPrev) , longStop); shortStop = IFf(useClose == 1, lowest(close, length) , Lowest(L,length)) + a; shortStopPrev = iff(IsNan(shortStop[1]) == true, shortStop,shortStop[1]); shortStop = iff(close[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop); dir = iff(close > shortStopPrev , 1 , IFF(close < longStopPrev , -1 , dir)); longStopB = IFf(useClose == 1, highest(close, lengthB) ,highest(H,lengthB)) - aB; longStopPrevB = iff(IsNan(longStopB[1]) == true, longStopB,longStopB[1]); longStopB = iff(close[1] > longStopPrevB ,max(longStopB, longStopPrevB) , longStopB); shortStopB = IFf(useClose == 1, lowest(close, lengthB) , Lowest(L,lengthB)) + aB; shortStopPrevB = iff(IsNan(shortStopB[1]) == true, shortStopB,shortStopB[1]); shortStopB = iff(close[1] < shortStopPrevB , min(shortStopB, shortStopPrevB) , shortStopB); dirB = iff(close > shortStopPrevB , 1 , IFF(close < longStopPrevB , -1 , dirB)); buySignal = avpchange > gma and BWI >= Bolllimit and C > O and (C > Ma60 or dir == 1) and (CrossUp(avpchange,gma) or dir[1] == -1 or crossUp(C, Ma60)); buyExit = CrossDown(avpchange,gma); sellSignal = avpchange < gma and BWI >= Bolllimit and C < O and (C < Ma60 or dirB == -1) and (CrossDown(avpchange,gma) or dirB[1] == 1 or crossUp(C, Ma60)); sellExit = CrossUp(avpchange,gma); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if Bdate != Bdate[1] Then { IF Endtime <= starttime Then { SetStopEndofday(0); } } 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; if Tcond == true Then { if buySignal == true Then Buy("Buy"); if buyExit == true Then ExitLong("BExit"); if sellSignal == true Then Sell("Sell"); if sellExit == true Then ExitShort("SExit"); } //SetStopInactivity(최소가격,기간,PointStop); SetStopProfittarget(목표수익값,PointStop); SetStopLoss(SetStop,PointStop); SetStopTrailing(gamso,minMoney,PointStop,변수); 즐거운 하루되세요 > 하날랑 님이 쓴 글입니다. > 제목 : 89178/89209요청과 관련입니다. > 항상 빠른 답변에 감사를 드립니다. 수정을 하여주신 것을 복사하여 시뮬레이션을 돌려보니 신호가 하나도 발생하지 않습니다. 제가 지표 조합을 잘못해서 신호가 하나도 나오지 않나 싶어 89178로 답변주신 원본을 89209에서 수정해 주신대로 고쳐서 시뮬레이션을 돌려도 신호가 하나도 생성되지 않습니다. 한번더 검토해 주시길 부탁드립니다. input : length(13), mult(5.5), map(60); input : lengthB(16), multB(6.76); input : useClose(1);//1:종가기준, 2:고/저가 기준 input : Bolllimit(0.2); input : src(close); input : smooth(1); input : length1(25); input : SetStop(169), gamso(83), minMoney(194), 변수(0), 목표수익값(255), 수익포인트(108) ; input : StartTime(215000),EndTime(054210); //215000//054210//EndTime(081500) var : Tcond(False); var : A(0), longStop(0), longStopPrev(0), shortStop(0), shortStopPrev(0), AB(0), longStopB(0), longStopPrevB(0), shortStopB(0), shortStopPrevB(0), BollUp(0), Ma20(0), BWI(0), BollDown(0), Ma60(0), srcS(0), value(0) ; var : dir(1), dirB(1); var : offset(0.85),sigma1(7),pchange(0),avpchange(0); var : buySignal(False), buyExit(False), sellSignal(False), sellExit(False); offset = 0.85; sigma1 = 7; pchange = (src-src[smooth]) / src * 100; var : i(0),mm(0),s(0),norm(0),sum(0),weight(0); var : r(0),rsiL(False),rsiS(False); var : length11(0),src1(0),momm(0); var : m1(0),m2(0),sm1(0),sm2(0),chandeMO(0),cL(False),cS(False); mm = offset * (length1 - 1); s = length1 / sigma1; norm = 0.0; sum = 0.0; for i = 0 to length1 - 1 { weight = exp(-1 * pow(i - mm, 2) / (2 * pow(s, 2))); norm = norm + weight; sum = sum + pchange[length1 - i - 1] * weight; } avpchange = sum / norm; //RSI r = rsi(14); rsiL = r > r[1]; rsiS = r < r[1]; //Chande Momentum length11 = 9; src1 = close; momm = src1-src1[1]; m1 = iff(momm >= 0.0 , momm , 0.0); m2 = iff(momm >= 0.0 , 0 , -momm); sm1 = AccumN(m1, length11); sm2 = AccumN(m2, length11); chandeMO = 100 * (sm1-sm2) / (sm1+sm2); cL = chandeMO > chandeMO[1]; cS = chandeMO < chandeMO[1]; //GAMA credit to author: &#169; LeafAlgo https://www.tradingview.com/v/th7NZUPM/ input : lengthG(14); input : adaptive(1);#true면 1, 아니면 0 지정 input : volatilityPeriod(20); input : vv(1); var : gma(0),sumOfWeights(0),sigma(0),valueG(0),gmaColor(0),tx(0); // Calculate Gaussian Moving Average gma = 0.0; sumOfWeights = 0.0; sigma = iff(adaptive == 1 , std(close, volatilityPeriod) ,vv); for i = 0 to lengthG - 1 { weight = exp(-pow(((i - (lengthG - 1)) / (2 * sigma)), 2) / 2); valueG = highest(avpchange, i + 1) + lowest(avpchange, i + 1); gma = gma + (valueG * weight); sumOfWeights = sumOfWeights + weight; } gma = (gma / sumOfWeights)/2; gma = ema(gma, 7); gmaColor = iff(avpchange >= gma , rgb(0, 161, 5) , rgb(215, 0, 0)); var : currentSignal(0),barColor(Nan); currentSignal = iff(avpchange >= gma , 1 , -1); if currentSignal == 1 Then barColor = rgb(0, 186, 6); BollUp = BollBandUp(20, 2); BollDown = BollBandDown(20, 2); Ma20 = Average(C, 20); BWI = (BollUp - BollDown)/Ma20*100; Ma60 = Average(C, map); srcS = close; a = mult * atr(length); ab = multB * atr(lengthB); if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice+수익포인트 Then ExitLong("L_EvenBreak",AtStop,EntryPrice); if MarketPosition == -1 and lowest(l,BarsSinceEntry) <= EntryPrice-수익포인트 Then ExitShort("S_EvenBreak",AtStop,EntryPrice); longStop = IFf(useClose == 1, highest(close, length) ,highest(H,length)) - a; longStopPrev = iff(IsNan(longStop[1]) == true, longStop,longStop[1]); longStop = iff(close[1] > longStopPrev ,max(longStop, longStopPrev) , longStop); shortStop = IFf(useClose == 1, lowest(close, length) , Lowest(L,length)) + a; shortStopPrev = iff(IsNan(shortStop[1]) == true, shortStop,shortStop[1]); shortStop = iff(close[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop); dir = iff(close > shortStopPrev , 1 , IFF(close < longStopPrev , -1 , dir)); longStopB = IFf(useClose == 1, highest(close, lengthB) ,highest(H,lengthB)) - aB; longStopPrevB = iff(IsNan(longStopB[1]) == true, longStopB,longStopB[1]); longStopB = iff(close[1] > longStopPrevB ,max(longStopB, longStopPrevB) , longStopB); shortStopB = IFf(useClose == 1, lowest(close, lengthB) , Lowest(L,lengthB)) + aB; shortStopPrevB = iff(IsNan(shortStopB[1]) == true, shortStopB,shortStopB[1]); shortStopB = iff(close[1] < shortStopPrevB , min(shortStopB, shortStopPrevB) , shortStopB); dirB = iff(close > shortStopPrevB , 1 , IFF(close < longStopPrevB , -1 , dirB)); buySignal = avpchange > gma and BWI >= Bolllimit and C > O and (C > Ma60 or dir == 1) and (CrossUp(avpchange,gma) or dir[1] == -1 or crossUp(C, Ma60)); buyExit = CrossDown(avpchange,gma); sellSignal = avpchange < gma and BWI >= Bolllimit and C < O and (C < Ma60 or dirB == -1) and (CrossDown(avpchange,gma) or dirB[1] == 1 or crossUp(C, Ma60)); sellExit = CrossUp(avpchange,gma); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if Bdate != Bdate[1] Then { IF Endtime <= starttime Then { SetStopEndofday(0); } } 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; if Tcond == true Then { if buySignal == true Then Buy("Buy"); if buyExit == true Then ExitLong("BExit"); if sellSignal == true Then Sell("Sell"); if sellExit == true Then ExitShort("SExit"); } //SetStopInactivity(최소가격,기간,PointStop); SetStopProfittarget(목표수익값,PointStop); SetStopLoss(SetStop,PointStop); SetStopTrailing(gamso,minMoney,PointStop,변수);
프로필 이미지

하날랑

2024-09-25 08:12:50

> 예스스탁 님이 쓴 글입니다. > 제목 : Re : 89178/89209요청과 관련입니다. > 안녕하세요 예스스탁입니다. input : src(close); 외부변수 중에 src도 변경해야 하는데 변경해 드리지 못했습니다. 아래식 적용하시면 됩니다. 시뮬레이션 차트에는 외부변수가 완전히 숫자형 변수만 지정되어야 합니다. input : length(13), mult(5.5), map(60); input : lengthB(16), multB(6.76); input : useClose(1);//1:종가기준, 2:고/저가 기준 input : Bolllimit(0.2); input : smooth(1); input : length1(25); input : SetStop(169), gamso(83), minMoney(194), 변수(0), 목표수익값(255), 수익포인트(108) ; input : StartTime(215000),EndTime(054210); //215000//054210//EndTime(081500) var : Tcond(False); var : A(0), longStop(0), longStopPrev(0), shortStop(0), shortStopPrev(0), AB(0), longStopB(0), longStopPrevB(0), shortStopB(0), shortStopPrevB(0), BollUp(0), Ma20(0), BWI(0), BollDown(0), Ma60(0), srcS(0), value(0) ; var : dir(1), dirB(1); var : offset(0.85),sigma1(7),pchange(0),avpchange(0); var : buySignal(False), buyExit(False), sellSignal(False), sellExit(False); var : src(0); src = close; offset = 0.85; sigma1 = 7; pchange = (src-src[smooth]) / src * 100; var : i(0),mm(0),s(0),norm(0),sum(0),weight(0); var : r(0),rsiL(False),rsiS(False); var : length11(0),src1(0),momm(0); var : m1(0),m2(0),sm1(0),sm2(0),chandeMO(0),cL(False),cS(False); mm = offset * (length1 - 1); s = length1 / sigma1; norm = 0.0; sum = 0.0; for i = 0 to length1 - 1 { weight = exp(-1 * pow(i - mm, 2) / (2 * pow(s, 2))); norm = norm + weight; sum = sum + pchange[length1 - i - 1] * weight; } avpchange = sum / norm; //RSI r = rsi(14); rsiL = r > r[1]; rsiS = r < r[1]; //Chande Momentum length11 = 9; src1 = close; momm = src1-src1[1]; m1 = iff(momm >= 0.0 , momm , 0.0); m2 = iff(momm >= 0.0 , 0 , -momm); sm1 = AccumN(m1, length11); sm2 = AccumN(m2, length11); chandeMO = 100 * (sm1-sm2) / (sm1+sm2); cL = chandeMO > chandeMO[1]; cS = chandeMO < chandeMO[1]; //GAMA credit to author: &#169; LeafAlgo https://www.tradingview.com/v/th7NZUPM/ input : lengthG(14); input : adaptive(1);#true면 1, 아니면 0 지정 input : volatilityPeriod(20); input : vv(1); var : gma(0),sumOfWeights(0),sigma(0),valueG(0),gmaColor(0),tx(0); // Calculate Gaussian Moving Average gma = 0.0; sumOfWeights = 0.0; sigma = iff(adaptive == 1 , std(close, volatilityPeriod) ,vv); for i = 0 to lengthG - 1 { weight = exp(-pow(((i - (lengthG - 1)) / (2 * sigma)), 2) / 2); valueG = highest(avpchange, i + 1) + lowest(avpchange, i + 1); gma = gma + (valueG * weight); sumOfWeights = sumOfWeights + weight; } gma = (gma / sumOfWeights)/2; gma = ema(gma, 7); gmaColor = iff(avpchange >= gma , rgb(0, 161, 5) , rgb(215, 0, 0)); var : currentSignal(0),barColor(Nan); currentSignal = iff(avpchange >= gma , 1 , -1); if currentSignal == 1 Then barColor = rgb(0, 186, 6); BollUp = BollBandUp(20, 2); BollDown = BollBandDown(20, 2); Ma20 = Average(C, 20); BWI = (BollUp - BollDown)/Ma20*100; Ma60 = Average(C, map); srcS = close; a = mult * atr(length); ab = multB * atr(lengthB); if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice+수익포인트 Then ExitLong("L_EvenBreak",AtStop,EntryPrice); if MarketPosition == -1 and lowest(l,BarsSinceEntry) <= EntryPrice-수익포인트 Then ExitShort("S_EvenBreak",AtStop,EntryPrice); longStop = IFf(useClose == 1, highest(close, length) ,highest(H,length)) - a; longStopPrev = iff(IsNan(longStop[1]) == true, longStop,longStop[1]); longStop = iff(close[1] > longStopPrev ,max(longStop, longStopPrev) , longStop); shortStop = IFf(useClose == 1, lowest(close, length) , Lowest(L,length)) + a; shortStopPrev = iff(IsNan(shortStop[1]) == true, shortStop,shortStop[1]); shortStop = iff(close[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop); dir = iff(close > shortStopPrev , 1 , IFF(close < longStopPrev , -1 , dir)); longStopB = IFf(useClose == 1, highest(close, lengthB) ,highest(H,lengthB)) - aB; longStopPrevB = iff(IsNan(longStopB[1]) == true, longStopB,longStopB[1]); longStopB = iff(close[1] > longStopPrevB ,max(longStopB, longStopPrevB) , longStopB); shortStopB = IFf(useClose == 1, lowest(close, lengthB) , Lowest(L,lengthB)) + aB; shortStopPrevB = iff(IsNan(shortStopB[1]) == true, shortStopB,shortStopB[1]); shortStopB = iff(close[1] < shortStopPrevB , min(shortStopB, shortStopPrevB) , shortStopB); dirB = iff(close > shortStopPrevB , 1 , IFF(close < longStopPrevB , -1 , dirB)); buySignal = avpchange > gma and BWI >= Bolllimit and C > O and (C > Ma60 or dir == 1) and (CrossUp(avpchange,gma) or dir[1] == -1 or crossUp(C, Ma60)); buyExit = CrossDown(avpchange,gma); sellSignal = avpchange < gma and BWI >= Bolllimit and C < O and (C < Ma60 or dirB == -1) and (CrossDown(avpchange,gma) or dirB[1] == 1 or crossUp(C, Ma60)); sellExit = CrossUp(avpchange,gma); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if Bdate != Bdate[1] Then { IF Endtime <= starttime Then { SetStopEndofday(0); } } 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; if Tcond == true Then { if buySignal == true Then Buy("Buy"); if buyExit == true Then ExitLong("BExit"); if sellSignal == true Then Sell("Sell"); if sellExit == true Then ExitShort("SExit"); } //SetStopInactivity(최소가격,기간,PointStop); SetStopProfittarget(목표수익값,PointStop); SetStopLoss(SetStop,PointStop); SetStopTrailing(gamso,minMoney,PointStop,변수); 즐거운 하루되세요 > 하날랑 님이 쓴 글입니다. > 제목 : 89178/89209요청과 관련입니다. > 항상 빠른 답변에 감사를 드립니다. 수정을 하여주신 것을 복사하여 시뮬레이션을 돌려보니 신호가 하나도 발생하지 않습니다. 제가 지표 조합을 잘못해서 신호가 하나도 나오지 않나 싶어 89178로 답변주신 원본을 89209에서 수정해 주신대로 고쳐서 시뮬레이션을 돌려도 신호가 하나도 생성되지 않습니다. 한번더 검토해 주시길 부탁드립니다. input : length(13), mult(5.5), map(60); input : lengthB(16), multB(6.76); input : useClose(1);//1:종가기준, 2:고/저가 기준 input : Bolllimit(0.2); input : src(close); input : smooth(1); input : length1(25); input : SetStop(169), gamso(83), minMoney(194), 변수(0), 목표수익값(255), 수익포인트(108) ; input : StartTime(215000),EndTime(054210); //215000//054210//EndTime(081500) var : Tcond(False); var : A(0), longStop(0), longStopPrev(0), shortStop(0), shortStopPrev(0), AB(0), longStopB(0), longStopPrevB(0), shortStopB(0), shortStopPrevB(0), BollUp(0), Ma20(0), BWI(0), BollDown(0), Ma60(0), srcS(0), value(0) ; var : dir(1), dirB(1); var : offset(0.85),sigma1(7),pchange(0),avpchange(0); var : buySignal(False), buyExit(False), sellSignal(False), sellExit(False); offset = 0.85; sigma1 = 7; pchange = (src-src[smooth]) / src * 100; var : i(0),mm(0),s(0),norm(0),sum(0),weight(0); var : r(0),rsiL(False),rsiS(False); var : length11(0),src1(0),momm(0); var : m1(0),m2(0),sm1(0),sm2(0),chandeMO(0),cL(False),cS(False); mm = offset * (length1 - 1); s = length1 / sigma1; norm = 0.0; sum = 0.0; for i = 0 to length1 - 1 { weight = exp(-1 * pow(i - mm, 2) / (2 * pow(s, 2))); norm = norm + weight; sum = sum + pchange[length1 - i - 1] * weight; } avpchange = sum / norm; //RSI r = rsi(14); rsiL = r > r[1]; rsiS = r < r[1]; //Chande Momentum length11 = 9; src1 = close; momm = src1-src1[1]; m1 = iff(momm >= 0.0 , momm , 0.0); m2 = iff(momm >= 0.0 , 0 , -momm); sm1 = AccumN(m1, length11); sm2 = AccumN(m2, length11); chandeMO = 100 * (sm1-sm2) / (sm1+sm2); cL = chandeMO > chandeMO[1]; cS = chandeMO < chandeMO[1]; //GAMA credit to author: &#169; LeafAlgo https://www.tradingview.com/v/th7NZUPM/ input : lengthG(14); input : adaptive(1);#true면 1, 아니면 0 지정 input : volatilityPeriod(20); input : vv(1); var : gma(0),sumOfWeights(0),sigma(0),valueG(0),gmaColor(0),tx(0); // Calculate Gaussian Moving Average gma = 0.0; sumOfWeights = 0.0; sigma = iff(adaptive == 1 , std(close, volatilityPeriod) ,vv); for i = 0 to lengthG - 1 { weight = exp(-pow(((i - (lengthG - 1)) / (2 * sigma)), 2) / 2); valueG = highest(avpchange, i + 1) + lowest(avpchange, i + 1); gma = gma + (valueG * weight); sumOfWeights = sumOfWeights + weight; } gma = (gma / sumOfWeights)/2; gma = ema(gma, 7); gmaColor = iff(avpchange >= gma , rgb(0, 161, 5) , rgb(215, 0, 0)); var : currentSignal(0),barColor(Nan); currentSignal = iff(avpchange >= gma , 1 , -1); if currentSignal == 1 Then barColor = rgb(0, 186, 6); BollUp = BollBandUp(20, 2); BollDown = BollBandDown(20, 2); Ma20 = Average(C, 20); BWI = (BollUp - BollDown)/Ma20*100; Ma60 = Average(C, map); srcS = close; a = mult * atr(length); ab = multB * atr(lengthB); if MarketPosition == 1 and highest(h,BarsSinceEntry) >= EntryPrice+수익포인트 Then ExitLong("L_EvenBreak",AtStop,EntryPrice); if MarketPosition == -1 and lowest(l,BarsSinceEntry) <= EntryPrice-수익포인트 Then ExitShort("S_EvenBreak",AtStop,EntryPrice); longStop = IFf(useClose == 1, highest(close, length) ,highest(H,length)) - a; longStopPrev = iff(IsNan(longStop[1]) == true, longStop,longStop[1]); longStop = iff(close[1] > longStopPrev ,max(longStop, longStopPrev) , longStop); shortStop = IFf(useClose == 1, lowest(close, length) , Lowest(L,length)) + a; shortStopPrev = iff(IsNan(shortStop[1]) == true, shortStop,shortStop[1]); shortStop = iff(close[1] < shortStopPrev , min(shortStop, shortStopPrev) , shortStop); dir = iff(close > shortStopPrev , 1 , IFF(close < longStopPrev , -1 , dir)); longStopB = IFf(useClose == 1, highest(close, lengthB) ,highest(H,lengthB)) - aB; longStopPrevB = iff(IsNan(longStopB[1]) == true, longStopB,longStopB[1]); longStopB = iff(close[1] > longStopPrevB ,max(longStopB, longStopPrevB) , longStopB); shortStopB = IFf(useClose == 1, lowest(close, lengthB) , Lowest(L,lengthB)) + aB; shortStopPrevB = iff(IsNan(shortStopB[1]) == true, shortStopB,shortStopB[1]); shortStopB = iff(close[1] < shortStopPrevB , min(shortStopB, shortStopPrevB) , shortStopB); dirB = iff(close > shortStopPrevB , 1 , IFF(close < longStopPrevB , -1 , dirB)); buySignal = avpchange > gma and BWI >= Bolllimit and C > O and (C > Ma60 or dir == 1) and (CrossUp(avpchange,gma) or dir[1] == -1 or crossUp(C, Ma60)); buyExit = CrossDown(avpchange,gma); sellSignal = avpchange < gma and BWI >= Bolllimit and C < O and (C < Ma60 or dirB == -1) and (CrossDown(avpchange,gma) or dirB[1] == 1 or crossUp(C, Ma60)); sellExit = CrossUp(avpchange,gma); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } if Bdate != Bdate[1] Then { IF Endtime <= starttime Then { SetStopEndofday(0); } } 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; if Tcond == true Then { if buySignal == true Then Buy("Buy"); if buyExit == true Then ExitLong("BExit"); if sellSignal == true Then Sell("Sell"); if sellExit == true Then ExitShort("SExit"); } //SetStopInactivity(최소가격,기간,PointStop); SetStopProfittarget(목표수익값,PointStop); SetStopLoss(SetStop,PointStop); SetStopTrailing(gamso,minMoney,PointStop,변수);