커뮤니티
부탁합니다
2017-02-13 17:29:19
95
글번호 106792
input : Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(1200),익절틱수(15),손절틱수(15);
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 < 5 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 < 5 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*손절틱수);
}
위 수식에서 한가지 추가하고자 합니다
만약에 매수진입 후 매수진입 평균단가가 - (마이너스)인 경우 이동평균선 20일이 120일선을 하락크로스CrossDown(mav11,mav14) 인 경우 매수진입 전체청산 추가해주세요
또한
만약에 매도진입 후 매도진입 평균단가가 - (마이너스)인 경우 이동평균선 20일이 120일선을 상승크로스(crossup(mav11,mav14)) 인 경우 매도진입 전체청산 추가해주세요
감사합니다
답변 1
예스스탁 예스스탁 답변
2017-02-14 10:07:05
안녕하세요
예스스탁입니다.
평균단가가 마이너스라는 부분이 어떤 의미인지 모르겠습니다.
매수는 현재가가 평균단가보다 낮고, 매도는 현재가가 평균단가보다 크다라고 지정했습니다.
input : Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(1200),익절틱수(15),손절틱수(15);
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 < 5 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 C < AvgEntryPrice and crossup(mav11,mav14) Then
exitlong("bx1");
}
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 < 5 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*손절틱수);
if C > AvgEntryPrice and crossup(mav11,mav14) Then
ExitShort("sx1");
}
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 부탁합니다
> input : Period11(20),Period12(40),Period13(80),Period14(120),Period15(160),Period16(300),Period17(600),Period18(1200),익절틱수(15),손절틱수(15);
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 < 5 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 < 5 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*손절틱수);
}
위 수식에서 한가지 추가하고자 합니다
만약에 매수진입 후 매수진입 평균단가가 - (마이너스)인 경우 이동평균선 20일이 120일선을 하락크로스CrossDown(mav11,mav14) 인 경우 매수진입 전체청산 추가해주세요
또한
만약에 매도진입 후 매도진입 평균단가가 - (마이너스)인 경우 이동평균선 20일이 120일선을 상승크로스(crossup(mav11,mav14)) 인 경우 매도진입 전체청산 추가해주세요
감사합니다