커뮤니티
지표식 질문입니다
2011-11-02 07:19:59
593
글번호 44358
어제 써주신 수식 감사합니다
Input : enPeriod(20), enPercent(2);
Input : BolPeriod(20), BolDv(2);
var1 = EnvelopeUp(enPeriod, enPercent);#엔벤로프상단
var2 = ma(C, enPeriod);#엔벤로프중단
var3 = EnvelopeDown(enPeriod, enPercent);#엔벤로프하단
var4 = BollBandUp(BolPeriod,BolDv);#볼린져밴드상단
var5 = ma(C,BolPeriod);#볼린져밴드 중단
var6 = BollBandDown(BolPeriod,BolDv);#볼린져밴드하단
if dayindex == 0 and #첫봉
C < var2 and C < var5 then #종가가 엔벤로프중단과 볼린져밴드 중단 아래에 있음
buy("B1");
#B1진입인 상태에서 볼린져밴드 중단을 상향하면 매수포지션 청산
if MarketPosition == 1 and IsEntryName("B1") == true And crossup(c,var5) then
ExitLong("Bx1");
if MarketPosition == 0 and #현재 무포지션
ExitDate(1) == sdate and #직전청산이 오늘발생한 청산이고
IsExitName("Bx1",1) and #직전청산명은 bx1이고
BarsSinceExit(1) == 1 Then#청산후 다음봉이면 매도진입
sell("BS");
if MarketPosition == -1 and #현재 매도포지션 진입중이고
IsEntryName("BS") == True then{#진입명은 Bs이면
ExitShort("Sx2",atlimit,EntryPrice-1.5);#진입가대비 -1.5까지 시세내려가면 매도포지션 청산
if C < var2 and C < var5 Then#종가가 엔벨로프 중단과 볼린져밴드 중단 아래이면 매도포지션 청산하고 매수진입
buy("SB");
}
if dayindex == 0 and #첫봉
C > var2 and C > var5 then #종가가 엔벤로프중단과 볼린져밴드 중단 위 있음
Sell("S1");
if MarketPosition == -1 and CrossDown(c,var5) then#볼린져밴드 중단을 하향하면 매도포지션 청산
ExitShort("Sx1");
SetStopProfittarget(4,PointStop);#목표수익
SetStopLoss(2.5,PointStop);#손절
SetStopEndofday(150000);#당일청산
여기서요 첫봉이 볼린져밴드 위에 있음 매도 이 진입을
청산하는 조건에 그 다음봉이 첫봉의 고가를 넘는 양봉이면 청산 을 추가하고 싶은대요
if MarketPosition == -1 and IsEntryName("S1") == true And h < c and o < c then
ExitLong();
이거 아닌가요 안되네요 ;;
그리고 동영상에 합성 전략이요
수식을 못찾아서 동영상 보고 직접 다 쳤는데요
위에 처럼 자세하게 주석좀 달아주실수 있을까요 이해해 보려고합니다
var : pp(0), pr1(0), pr2(0), ps1(0), ps2(0), sp(40), lp(350), emashort(0),
emalong(0), pivot_idx(22), pivot_ch(0.3), ilmokidx(15), ilmokx(14),ilmok1(0),ilmok2(0)
,ilmok3(0), sunhang1(0), sunhang2(0), ccilen(50), ccich(100), mult(1),
ccivalue(0), bcnt(0), scnt(0);
SetStopLoss(1.6, PointStop);
#피봋
if dayindex() == 0 then {pp = (DayHigh(1)+DayLow(1)+DayClose(1))/3;
pr1 = 2*pp-daylow(1); pr2 = pp+DayHigh(1)-DayLow(1);
ps1 = 2*pp-DayHigh(1);ps2 = pp-DayHigh(1)+DayLow(1);}
if stime < 1400000 then {if crossup(c, ps1) and bids > asks then buy("pprec_b");
if CrossDown(c, pr1) and bids < asks then sell("pprev_s");}
#CCI
if date != date[1] then {bcnt = 0; scnt = 0;}
CCIvalue = cci(ccilen);
if CrossUp(ccivalue, -ccich) and bids > asks and bcnt == 0 Then
{buy("ccirev_b");bcnt = bcnt +1;}
if CrossDown(ccivalue,ccich) and bids < asks and scnt == 0 Then
{sell("ccirev_s");scnt = scnt+1;}
if BarsSinceEntry(0) > 0 then {
if IsEntryName("ccirev_b") and l == daylow(0) then exitlong("cci_le");
if IsEntryName("ccirev_s") and h == DayHigh(0) then ExitShort("cci_es");
}
#지수이평
emashort = ema(c, sp); emalong = ema(c, lp);
if crossup(emashort, emalong) and bids > asks then buy("ema_b");
if CrossDown(emashort, emalong) and bids < asks then sell("ema_s");
#피봋추세
if DayIndex() <= pivot_idx then {
if c > pr2 and bids > asks then
buy("pp_b");
if c < ps2 and bids < asks then sell("pp_s");}
if IsEntryName("pp_b") and CrossDown(c,pr2-pivot_ch) then ExitLong("pp_es");
if IsEntryName("pp_s") and Crossup(c,ps2+pivot_ch) then ExitLong("pp_el");
#일목
ilmok1 = (Highest(h,ilmokx)+lowest(l,ilmokx))/2;
ilmok2 = (Highest(h,ilmokx*3)+lowest(l,ilmokx*3))/2;
ilmok3 = (Highest(h,ilmokx*3*2)+lowest(l,ilmokx*3*2))/2;
sunhang1 = (ilmok1+ilmok2)/2;//선행스팬1
sunhang2 = ilmok3;
if DayIndex() == ilmokidx+1 then {
if AccumN( IFF (c > max(sunhang1, sunhang2),1,0), ilmokidx) == ilmokidx and bids > asks Then
buy("ilmokb");
if AccumN( IFF (c < min(sunhang1, sunhang2),1,0), ilmokidx) == ilmokidx and bids < asks Then
sell("ilmoks");}
if IsEntryName("ilmokb") and CrossDown(c, max(sunhang1, sunhang2)) Then
ExitLong("ilmok_el");
if IsEntryName("ilmoks") and Crossup(c, min(sunhang1, sunhang2)) Then
ExitLong("ilmok_es");
답변 1
예스스탁 예스스탁 답변
2011-11-02 15:12:46
안녕하세요
예스스탁입니다.
1.
아래와 같이 작성하셔야 합니다.
if MarketPosition == -1 and IsEntryName("S1") == true And BarsSinceEntry == 1 and h[1] < c and o < c then
ExitShort();
2.
var : pp(0), pr1(0), pr2(0), ps1(0), ps2(0), sp(40), lp(350), emashort(0),emalong(0),
pivot_idx(22), pivot_ch(0.3), ilmokidx(15), ilmokx(14),ilmok1(0),ilmok2(0), ilmok3(0),
sunhang1(0), sunhang2(0), ccilen(50), ccich(100), mult(1), ccivalue(0), bcnt(0), scnt(0);
#손절 1.6 포인트
SetStopLoss(1.6, PointStop);
#피봇
#
if dayindex() == 0 then{# 첫봉에서
pp = (DayHigh(1)+DayLow(1)+DayClose(1))/3;#(전일고가+전일저가+전일종가)/3을 피봇포인트 값으로 저장
pr1 = 2*pp-daylow(1); #PP의 두배값에서 전일저가를 뺀값을 저항1값으로 저장
pr2 = pp+DayHigh(1)-DayLow(1);#PP값+전일고가-전일저가값을 저항2값으로 저장
ps1 = 2*pp-DayHigh(1);##PP의 두배값에서 전일고가를 뺀값을 지지1값으로 저장
ps2 = pp-DayHigh(1)+DayLow(1);#PP값-전일고가+전일저가값을 지지2값으로 저장
}
#14시 이전에
if stime < 140000 then {
#종가가 지지1값을 상향돌파하고 매수잔량이 매도잔량보다 크면 매수
if crossup(c, ps1) and bids > asks then buy("pprec_b");
#종가가 저항1값을 하향이탈하고 매도잔량이 매수잔량보다 크면 매도
if CrossDown(c, pr1) and bids < asks then sell("pprev_s");
}
#CCI
if date != date[1] then {
bcnt = 0;
scnt = 0;
}
CCIvalue = cci(ccilen);#CCI값
#CCI가 -100을 상향돌파하고 매수잔량이 매도잔량보다 크고 당일 첫번째 조건만족할 때만 매수진입
if CrossUp(ccivalue, -ccich) and bids > asks and bcnt == 0 Then{
buy("ccirev_b");
bcnt = bcnt +1;#if조건 만족하면 1씩 증가
}
#CCI가 100을 하향이탈하고 매도잔량이 매수잔량보다 크고 당일 첫번째 조건만족할 때만 매도진입
if CrossDown(ccivalue,ccich) and bids < asks and scnt == 0 Then{
sell("ccirev_s");
scnt = scnt+1;#if조건 만족하면 1씩증가
}
if BarsSinceEntry(0) > 0 then {# 진입후(BarsSinceEntry가 0보다 크다는 진입이 들어가 있는 상태라는 표현입니다.)
#진입명이 ccirev_b 일때 당일 저가를 갱신하면 매수청산
if IsEntryName("ccirev_b") and l == daylow(0) then exitlong("cci_le");
#진입명이 ccirev_s 일때 당일 고가를 갱신하면 매도청산
if IsEntryName("ccirev_s") and h == DayHigh(0) then ExitShort("cci_es");
}
#지수이평
emashort = ema(c, sp);#단기지수이평
emalong = ema(c, lp);#장기지수이평
#단기지수이평이 장기지수이평을 상향돌파하고 매수잔량이 매도잔량보다 크면 매수
if crossup(emashort, emalong) and bids > asks then buy("ema_b");
#단기지수이평이 장기지수이평을 하향이탈하고 매수잔량이 매도잔량보다 작으면 매도
if CrossDown(emashort, emalong) and bids < asks then sell("ema_s");
#피봇추세
#당일 22개봉 이전에
if DayIndex() <= pivot_idx then {
#종가가 저항2값보다 크고 매수잔량이 매도잔량보다 크면 매수
if c > pr2 and bids > asks then
buy("pp_b");
#종가가 지지2값보다 작고 매도잔량이 매수잔량보다 크면 매도
if c < ps2 and bids < asks then
sell("pp_s");
}
# PP_B 진입이 발생하고 주가가 저항2값-0.3보다 작아지면 매수청산
if IsEntryName("pp_b") and CrossDown(c,pr2-pivot_ch) then ExitLong("pp_es");
# PP_s 진입이 발생하고 주가가 지지2값+.3보다 커지면 매도청산
if IsEntryName("pp_s") and Crossup(c,ps2+pivot_ch) then ExitShort("pp_el");
#일목
ilmok1 = (Highest(h,ilmokx)+lowest(l,ilmokx))/2;#14봉 최고가와 최저가의 중간값
ilmok2 = (Highest(h,ilmokx*3)+lowest(l,ilmokx*3))/2;#14*3봉 최고가와 최저가의 중간값
ilmok3 = (Highest(h,ilmokx*3*2)+lowest(l,ilmokx*3*2))/2;#14*3*2봉 최고가와 최저가의 중간값
sunhang1 = (ilmok1+ilmok2)/2;//선행스팬1
sunhang2 = ilmok3;#선행스팬2
#당일 15번째 봉 이후
if DayIndex() == ilmokidx+1 then {
#15개봉 연속으로 종가가 선행스팬1과 선행스팬2중 큰값(구름대 상단)보다 크고 현재봉 매수잔량이 매도잔량보다 많으면 매수
if AccumN( IFF (c > max(sunhang1, sunhang2),1,0), ilmokidx) == ilmokidx and bids > asks Then
buy("ilmokb");
#15개봉 연속으로 종가가 선행스팬1과 선행스팬2중 작은값(구름대 하단)보다 작고 현재봉 매도잔량이 매수잔량보다 많으면 매도
if AccumN( IFF (c < min(sunhang1, sunhang2),1,0), ilmokidx) == ilmokidx and bids < asks Then
sell("ilmoks");
}
#ilmokb 진입후에 선행스팬1이 선행스팬2를 하향이탈하면 매수청산
if IsEntryName("ilmokb") and CrossDown(c, max(sunhang1, sunhang2)) Then
ExitLong("ilmok_el");
#ilmoks 진입후에 선행스팬1이 선행스팬2를 상향돌파하면 매도청산
if IsEntryName("ilmoks") and Crossup(c, min(sunhang1, sunhang2)) Then
ExitShort("ilmok_es");
즐거운 하루되세요
> 가날 님이 쓴 글입니다.
> 제목 : 지표식 질문입니다
> 어제 써주신 수식 감사합니다
Input : enPeriod(20), enPercent(2);
Input : BolPeriod(20), BolDv(2);
var1 = EnvelopeUp(enPeriod, enPercent);#엔벤로프상단
var2 = ma(C, enPeriod);#엔벤로프중단
var3 = EnvelopeDown(enPeriod, enPercent);#엔벤로프하단
var4 = BollBandUp(BolPeriod,BolDv);#볼린져밴드상단
var5 = ma(C,BolPeriod);#볼린져밴드 중단
var6 = BollBandDown(BolPeriod,BolDv);#볼린져밴드하단
if dayindex == 0 and #첫봉
C < var2 and C < var5 then #종가가 엔벤로프중단과 볼린져밴드 중단 아래에 있음
buy("B1");
#B1진입인 상태에서 볼린져밴드 중단을 상향하면 매수포지션 청산
if MarketPosition == 1 and IsEntryName("B1") == true And crossup(c,var5) then
ExitLong("Bx1");
if MarketPosition == 0 and #현재 무포지션
ExitDate(1) == sdate and #직전청산이 오늘발생한 청산이고
IsExitName("Bx1",1) and #직전청산명은 bx1이고
BarsSinceExit(1) == 1 Then#청산후 다음봉이면 매도진입
sell("BS");
if MarketPosition == -1 and #현재 매도포지션 진입중이고
IsEntryName("BS") == True then{#진입명은 Bs이면
ExitShort("Sx2",atlimit,EntryPrice-1.5);#진입가대비 -1.5까지 시세내려가면 매도포지션 청산
if C < var2 and C < var5 Then#종가가 엔벨로프 중단과 볼린져밴드 중단 아래이면 매도포지션 청산하고 매수진입
buy("SB");
}
if dayindex == 0 and #첫봉
C > var2 and C > var5 then #종가가 엔벤로프중단과 볼린져밴드 중단 위 있음
Sell("S1");
if MarketPosition == -1 and CrossDown(c,var5) then#볼린져밴드 중단을 하향하면 매도포지션 청산
ExitShort("Sx1");
SetStopProfittarget(4,PointStop);#목표수익
SetStopLoss(2.5,PointStop);#손절
SetStopEndofday(150000);#당일청산
여기서요 첫봉이 볼린져밴드 위에 있음 매도 이 진입을
청산하는 조건에 그 다음봉이 첫봉의 고가를 넘는 양봉이면 청산 을 추가하고 싶은대요
if MarketPosition == -1 and IsEntryName("S1") == true And h < c and o < c then
ExitLong();
이거 아닌가요 안되네요 ;;
그리고 동영상에 합성 전략이요
수식을 못찾아서 동영상 보고 직접 다 쳤는데요
위에 처럼 자세하게 주석좀 달아주실수 있을까요 이해해 보려고합니다
var : pp(0), pr1(0), pr2(0), ps1(0), ps2(0), sp(40), lp(350), emashort(0),
emalong(0), pivot_idx(22), pivot_ch(0.3), ilmokidx(15), ilmokx(14),ilmok1(0),ilmok2(0)
,ilmok3(0), sunhang1(0), sunhang2(0), ccilen(50), ccich(100), mult(1),
ccivalue(0), bcnt(0), scnt(0);
SetStopLoss(1.6, PointStop);
#피봋
if dayindex() == 0 then {pp = (DayHigh(1)+DayLow(1)+DayClose(1))/3;
pr1 = 2*pp-daylow(1); pr2 = pp+DayHigh(1)-DayLow(1);
ps1 = 2*pp-DayHigh(1);ps2 = pp-DayHigh(1)+DayLow(1);}
if stime < 1400000 then {if crossup(c, ps1) and bids > asks then buy("pprec_b");
if CrossDown(c, pr1) and bids < asks then sell("pprev_s");}
#CCI
if date != date[1] then {bcnt = 0; scnt = 0;}
CCIvalue = cci(ccilen);
if CrossUp(ccivalue, -ccich) and bids > asks and bcnt == 0 Then
{buy("ccirev_b");bcnt = bcnt +1;}
if CrossDown(ccivalue,ccich) and bids < asks and scnt == 0 Then
{sell("ccirev_s");scnt = scnt+1;}
if BarsSinceEntry(0) > 0 then {
if IsEntryName("ccirev_b") and l == daylow(0) then exitlong("cci_le");
if IsEntryName("ccirev_s") and h == DayHigh(0) then ExitShort("cci_es");
}
#지수이평
emashort = ema(c, sp); emalong = ema(c, lp);
if crossup(emashort, emalong) and bids > asks then buy("ema_b");
if CrossDown(emashort, emalong) and bids < asks then sell("ema_s");
#피봋추세
if DayIndex() <= pivot_idx then {
if c > pr2 and bids > asks then
buy("pp_b");
if c < ps2 and bids < asks then sell("pp_s");}
if IsEntryName("pp_b") and CrossDown(c,pr2-pivot_ch) then ExitLong("pp_es");
if IsEntryName("pp_s") and Crossup(c,ps2+pivot_ch) then ExitLong("pp_el");
#일목
ilmok1 = (Highest(h,ilmokx)+lowest(l,ilmokx))/2;
ilmok2 = (Highest(h,ilmokx*3)+lowest(l,ilmokx*3))/2;
ilmok3 = (Highest(h,ilmokx*3*2)+lowest(l,ilmokx*3*2))/2;
sunhang1 = (ilmok1+ilmok2)/2;//선행스팬1
sunhang2 = ilmok3;
if DayIndex() == ilmokidx+1 then {
if AccumN( IFF (c > max(sunhang1, sunhang2),1,0), ilmokidx) == ilmokidx and bids > asks Then
buy("ilmokb");
if AccumN( IFF (c < min(sunhang1, sunhang2),1,0), ilmokidx) == ilmokidx and bids < asks Then
sell("ilmoks");}
if IsEntryName("ilmokb") and CrossDown(c, max(sunhang1, sunhang2)) Then
ExitLong("ilmok_el");
if IsEntryName("ilmoks") and Crossup(c, min(sunhang1, sunhang2)) Then
ExitLong("ilmok_es");
다음글
이전글