커뮤니티
부탁합니다
2017-02-22 09:50:00
108
글번호 107107
input : Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(1200),익절틱수(8),손절틱수(8);
input : ntime2(200),sig2(100);
var : mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0);
mav11 = ma(c, Period11);
mav12 = ma(c, Period12);
mav13 = ma(c, Period13);
mav14 = ma(c, Period14);
mav15 = ma(c, Period15);
mav16 = ma(c, Period16);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
if MarketPosition <= 0 and
mav12 < mav13 and mav13 < mav15 and mav15 < mav16 and mav16 < mav17 and crossup(mav11,mav13) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav11 < mav11[1] and CurrentContracts < 2 Then
buy("bb",OnClose,def,1);
if mav12 > mav13 and mav13 > mav15 and mav15 > mav16 and mav16 > mav17 and CrossDown(mav11,mav13) Then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
mav12 > mav13 and mav13 > mav15 and mav15 > mav16 and mav16 > mav17 and CrossDown(mav11,mav13) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav11 > mav11[1] and CurrentContracts < 2 Then
sell("ss",OnClose,def,1);
if mav12 < mav13 and mav13 < mav15 and mav15 < mav16 and mav16 < mav17 and crossup(mav11,mav13) Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
위 수식에서 한가지 추가하고자 합니다
매수진입 후 익절틱수가 되면 강제청산 되지만 아래 조건이 만족하면 강제청산이 아닌
아래 시스템 식으로 매수청산이 적용되도록 하고자 합니다
---아래 조건---
만약에 매수진입 후 현재가가 매수진입평균단가보다 크고 and mav12 > mav13 and mav13 > mav15 and mav15 > mav16 and mav16 > mav17 만족하면 CrossDown(mav11,mav12)으로 매수청산
매도진입 후 익절틱수가 되면 강제청산 되지만 아래 조건이 만족하면 강제청산이 아닌
아래 시스템 식으로 매도청산이 적용되도록 하고자 합니다
---아래 조건---
만약에 매도진입 후 현재가가 매도진입평균단가보다 작고 and mav12 < mav13 and mav13 < mav15 and mav15 < mav16 and mav16 < mav17 만족하면 crossup(mav11,mav12)으로 매도청산
감사합니다
답변 1
예스스탁 예스스탁 답변
2017-02-22 10:52:26
안녕하세요
예스스탁입니다.
신호는 먼저 만족한 조건으로 신호가 발생합니다.
문의하신 내용은 기존 bx나 sx청산이 현재가가 평단가보다 높다/낮다 조건만 추가하면 될것 같습니다.
수정한 식입니다.
input : Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(1200),익절틱수(8),손절틱수(8);
input : ntime2(200),sig2(100);
var : mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0);
mav11 = ma(c, Period11);
mav12 = ma(c, Period12);
mav13 = ma(c, Period13);
mav14 = ma(c, Period14);
mav15 = ma(c, Period15);
mav16 = ma(c, Period16);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
if MarketPosition <= 0 and
mav12 < mav13 and mav13 < mav15 and mav15 < mav16 and mav16 < mav17 and crossup(mav11,mav13) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav11 < mav11[1] and CurrentContracts < 2 Then
buy("bb",OnClose,def,1);
if C > AvgEntryPrice and mav12 > mav13 and mav13 > mav15 and mav15 > mav16 and mav16 > mav17 and CrossDown(mav11,mav13) Then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
mav12 > mav13 and mav13 > mav15 and mav15 > mav16 and mav16 > mav17 and CrossDown(mav11,mav13) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav11 > mav11[1] and CurrentContracts < 2 Then
sell("ss",OnClose,def,1);
if C < AvgEntryPrice and mav12 < mav13 and mav13 < mav15 and mav15 < mav16 and mav16 < mav17 and crossup(mav11,mav13) Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 부탁합니다
> input : Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(1200),익절틱수(8),손절틱수(8);
input : ntime2(200),sig2(100);
var : mav11(0),mav12(0),mav13(0),mav14(0),mav15(0),mav16(0),mav17(0),mav18(0);
mav11 = ma(c, Period11);
mav12 = ma(c, Period12);
mav13 = ma(c, Period13);
mav14 = ma(c, Period14);
mav15 = ma(c, Period15);
mav16 = ma(c, Period16);
mav17 = ma(c, Period17);
mav18 = ma(c, Period18);
if MarketPosition <= 0 and
mav12 < mav13 and mav13 < mav15 and mav15 < mav16 and mav16 < mav17 and crossup(mav11,mav13) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if mav11 < mav11[1] and CurrentContracts < 2 Then
buy("bb",OnClose,def,1);
if mav12 > mav13 and mav13 > mav15 and mav15 > mav16 and mav16 > mav17 and CrossDown(mav11,mav13) Then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
mav12 > mav13 and mav13 > mav15 and mav15 > mav16 and mav16 > mav17 and CrossDown(mav11,mav13) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if mav11 > mav11[1] and CurrentContracts < 2 Then
sell("ss",OnClose,def,1);
if mav12 < mav13 and mav13 < mav15 and mav15 < mav16 and mav16 < mav17 and crossup(mav11,mav13) Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
위 수식에서 한가지 추가하고자 합니다
매수진입 후 익절틱수가 되면 강제청산 되지만 아래 조건이 만족하면 강제청산이 아닌
아래 시스템 식으로 매수청산이 적용되도록 하고자 합니다
---아래 조건---
만약에 매수진입 후 현재가가 매수진입평균단가보다 크고 and mav12 > mav13 and mav13 > mav15 and mav15 > mav16 and mav16 > mav17 만족하면 CrossDown(mav11,mav12)으로 매수청산
매도진입 후 익절틱수가 되면 강제청산 되지만 아래 조건이 만족하면 강제청산이 아닌
아래 시스템 식으로 매도청산이 적용되도록 하고자 합니다
---아래 조건---
만약에 매도진입 후 현재가가 매도진입평균단가보다 작고 and mav12 < mav13 and mav13 < mav15 and mav15 < mav16 and mav16 < mav17 만족하면 crossup(mav11,mav12)으로 매도청산
감사합니다