커뮤니티
문의 드립니다
2017-06-02 13:42:48
119
글번호 110084
input : ntime(300),sig(100),Period1(5),Period2(20),익절틱수(8),손절틱수(8);
var : mav1(0),mav2(0);
var1 = Accum(iff(ma(c-c[1],ntime) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime)+1),0.5)+
pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1));
var2 = ma(var1,sig);
mav1 = ma(c, Period1);
mav2 = ma(c, Period2);
if MarketPosition <= 0 and
(crossup(var1,var2) or var1 > var2 and mav1 > mav1[1]) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if var1 > var2 and mav1 > mav1[1] and CurrentContracts < 5 Then
buy("bb",OnClose,def,1);
if mav2 < mav2[1] then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
(CrossDown(var1,var2) or var1 < var2 and mav1 < mav1[1]) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if var1 < var2 and mav1 < mav1[1] and CurrentContracts < 5 Then
sell("ss",OnClose,def,1);
if mav2 > mav2[1] Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
한가지 수식을 추가하여 주시기 바랍니다
위 수식은 최초 매수진입 후 익절 또는 손절이 발생하였을 경우 1번만 매매하고
최초 매도진입 후 익절 또는 손절이 발생하였을 경우 1번만 매매할 수 있는 수식 입니다
====== 한가지 추가사항은 진입청산(exitLong("bx"); 또는 ExitShort("sx");
)이 나와도 위과 같이 1번만 매매할 수 있도록 넣어 주세요
감사합니다
답변 3
예스스탁 예스스탁 답변
2017-06-02 15:20:15
안녕하세요
예스스탁입니다.
현재 수식에 익절이나 청산이 되었다고
1번만 매매하게하는 내용이 없습니다.
즉 전체 진입이나 청산에 횟수를 제한하는 내용이 없습니다.
좀더 자세한 내용 올려주시기 바랍니다.
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> input : ntime(300),sig(100),Period1(5),Period2(20),익절틱수(8),손절틱수(8);
var : mav1(0),mav2(0);
var1 = Accum(iff(ma(c-c[1],ntime) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime)+1),0.5)+
pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1));
var2 = ma(var1,sig);
mav1 = ma(c, Period1);
mav2 = ma(c, Period2);
if MarketPosition <= 0 and
(crossup(var1,var2) or var1 > var2 and mav1 > mav1[1]) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if var1 > var2 and mav1 > mav1[1] and CurrentContracts < 5 Then
buy("bb",OnClose,def,1);
if mav2 < mav2[1] then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and
(CrossDown(var1,var2) or var1 < var2 and mav1 < mav1[1]) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if var1 < var2 and mav1 < mav1[1] and CurrentContracts < 5 Then
sell("ss",OnClose,def,1);
if mav2 > mav2[1] Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
한가지 수식을 추가하여 주시기 바랍니다
위 수식은 최초 매수진입 후 익절 또는 손절이 발생하였을 경우 1번만 매매하고
최초 매도진입 후 익절 또는 손절이 발생하였을 경우 1번만 매매할 수 있는 수식 입니다
====== 한가지 추가사항은 진입청산(exitLong("bx"); 또는 ExitShort("sx");
)이 나와도 위과 같이 1번만 매매할 수 있도록 넣어 주세요
감사합니다
남산
2017-06-02 15:30:50
죄송합니다
재등재합니다
input : ntime(300),sig(100),Period1(5),Period2(20),익절틱수(8),손절틱수(8);
var : mav1(0),mav2(0),Bxcond(false),Sxcond(false);
var1 = Accum(iff(ma(c-c[1],ntime) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime)+1),0.5)+
pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1));
var2 = ma(var1,sig);
mav1 = ma(c, Period1);
mav2 = ma(c, Period2);
Bxcond = ExitDate(1) == sdate and MarketPosition(1) == 1 and (IsExitName("bl",1) == true or IsExitName("bp",1) == true);
Sxcond = ExitDate(1) == sdate and MarketPosition(1) == -1 and (IsExitName("sl",1) == true or IsExitName("sp",1) == true);
if MarketPosition <= 0 and Bxcond == false and
(crossup(var1,var2) or (var1 > var2 and mav1 > mav1[1])) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if var1 > var2 and mav1 > mav1[1] and CurrentContracts < 5 Then
buy("bb",OnClose,def,1);
if mav2 < mav2[1] then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and Sxcond == false and
(CrossDown(var1,var2) or (var1 < var2 and mav1 < mav1[1])) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if var1 < var2 and mav1 < mav1[1] and CurrentContracts < 5 Then
sell("ss",OnClose,def,1);
if mav2 > mav2[1] Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
한가지 수식을 추가하여 주시기 바랍니다
위 수식은 최초 매수진입 후 익절 또는 손절이 발생하였을 경우 1번만 매매하고
최초 매도진입 후 익절 또는 손절이 발생하였을 경우 1번만 매매할 수 있는 수식 입니다
====== 한가지 추가사항은 진입청산(exitLong("bx"); 또는 ExitShort("sx");
)이 나와도 위과 같이 1번만 매매할 수 있도록 넣어 주세요
감사합니다
예스스탁 예스스탁 답변
2017-06-02 15:35:48
안녕하세요
예스스탁입니다.
bx청산과 sx청산이 발생해도 제한되게 추가했습니다.
input : ntime(300),sig(100),Period1(5),Period2(20),익절틱수(8),손절틱수(8);
var : mav1(0),mav2(0),Bxcond(false),Sxcond(false);
var1 = Accum(iff(ma(c-c[1],ntime) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime)+1),0.5)+
pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1));
var2 = ma(var1,sig);
mav1 = ma(c, Period1);
mav2 = ma(c, Period2);
Bxcond = ExitDate(1) == sdate and MarketPosition(1) == 1 and (IsExitName("bl",1) == true or IsExitName("bp",1) == true or IsExitName("bx",1) == true);
Sxcond = ExitDate(1) == sdate and MarketPosition(1) == -1 and (IsExitName("sl",1) == true or IsExitName("sp",1) == true or IsExitName("sx",1) == true);
if MarketPosition <= 0 and Bxcond == false and
(crossup(var1,var2) or (var1 > var2 and mav1 > mav1[1])) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if var1 > var2 and mav1 > mav1[1] and CurrentContracts < 5 Then
buy("bb",OnClose,def,1);
if mav2 < mav2[1] then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and Sxcond == false and
(CrossDown(var1,var2) or (var1 < var2 and mav1 < mav1[1])) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if var1 < var2 and mav1 < mav1[1] and CurrentContracts < 5 Then
sell("ss",OnClose,def,1);
if mav2 > mav2[1] Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : Re : Re : 문의 드립니다
> 죄송합니다
재등재합니다
input : ntime(300),sig(100),Period1(5),Period2(20),익절틱수(8),손절틱수(8);
var : mav1(0),mav2(0),Bxcond(false),Sxcond(false);
var1 = Accum(iff(ma(c-c[1],ntime) > 0,1,-1) * pow((ma(pow(c-c[1],2),ntime)+1),0.5)+
pow((pow(c-c[1],2) +1),0.5) * iff(c>c[1],1,-1));
var2 = ma(var1,sig);
mav1 = ma(c, Period1);
mav2 = ma(c, Period2);
Bxcond = ExitDate(1) == sdate and MarketPosition(1) == 1 and (IsExitName("bl",1) == true or IsExitName("bp",1) == true);
Sxcond = ExitDate(1) == sdate and MarketPosition(1) == -1 and (IsExitName("sl",1) == true or IsExitName("sp",1) == true);
if MarketPosition <= 0 and Bxcond == false and
(crossup(var1,var2) or (var1 > var2 and mav1 > mav1[1])) Then
buy("b",OnClose,def,1);
if MarketPosition == 1 Then{
if var1 > var2 and mav1 > mav1[1] and CurrentContracts < 5 Then
buy("bb",OnClose,def,1);
if mav2 < mav2[1] then{
ExitLong("bx");
}
ExitLong("bp",atlimit,AvgEntryPrice+PriceScale*익절틱수);
ExitLong("bl",AtStop,AvgEntryPrice-PriceScale*손절틱수);
}
if MarketPosition >= 0 and Sxcond == false and
(CrossDown(var1,var2) or (var1 < var2 and mav1 < mav1[1])) Then
sell("s",OnClose,def,1);
if MarketPosition == -1 then{
if var1 < var2 and mav1 < mav1[1] and CurrentContracts < 5 Then
sell("ss",OnClose,def,1);
if mav2 > mav2[1] Then
ExitShort("sx");
ExitShort("sp",atlimit,AvgEntryPrice-PriceScale*익절틱수);
ExitShort("sl",AtStop,AvgEntryPrice+PriceScale*손절틱수);
}
한가지 수식을 추가하여 주시기 바랍니다
위 수식은 최초 매수진입 후 익절 또는 손절이 발생하였을 경우 1번만 매매하고
최초 매도진입 후 익절 또는 손절이 발생하였을 경우 1번만 매매할 수 있는 수식 입니다
====== 한가지 추가사항은 진입청산(exitLong("bx"); 또는 ExitShort("sx");
)이 나와도 위과 같이 1번만 매매할 수 있도록 넣어 주세요
감사합니다