커뮤니티
보유종목의 일부만 이익청산
2014-10-22 15:44:41
210
글번호 79670
안녕하십니까. 조금 수정하고 싶은 내용이 있습니다.
아래식은 목표이익 도달시 모두청산한후 다시 들어가도록 되어있습니다.
바꾸고 싶은 내용은, 목표이익 도달시 투자금액만큼의 수량을 남기고 청산하는 것입니다.
즉 목표익이 도달한 순간 최초금액(1000000)을 남기고 청산하고 이때의 가격이 최초진입된것으로 재설정되어 이후 재진입이 다시 시작되게 하는 것입니다.
손절금액에 도달시도 마찬가지로 최초금액(1000000)의 수량을 남기고 청산하고 이때의 가격이 최초진입된것으로 재설정되어 이후 재진입이 다시 시작되게 합니다.
요약하면, 시스템이 적용되면 최초진입후 항상 최초금액이상으로 진입되어있는 상태입니다.
감사합니다.
=======================================================================
1.고정금액
input : RateUp(0.5),RateDn(1.5),투자금액(1000000),Per(2.5),첫진입시각(90000),Profit(5),Loss(30);
var : Vol1(0),vol2(0),vol3(0),Upval(0),Dnval(0);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{//주식
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액*RateUp)/C)/10)*10;
vol3 = int(int((투자금액*RateDn)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);//ETF
vol2 = int((투자금액*RateUp)/C);
vol3 = int((투자금액*RateDn)/C);
}
if MarketPosition == 0 and stime == 첫진입시각 Then{
buy("b",OnClose,def,vol1);
UpVal = c;
DnVal = c;
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
UpVal = LatestEntryPrice(0);
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100));
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100));
}
2. 누적금액
input : 투자금액(2000000),Mult(0.5),Per(2.5),첫진입시각(90000),Profit(6),Loss(30);
var : Mny1(0),Mny2(0),Mny3(0),Vol1(0),Vol2(0),Vol3(0),Upval(0),Dnval(0),UPcnt(0),Dncnt(0);
if MarketPosition == 0 and stime == 첫진입시각 Then{
Mny3 = 투자금액+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);
vol2 = int((투자금액-투자금액*Mult)/C);
vol3 = int((Mny3)/C);
}
UpVal = c;
DnVal = c;
buy("b",OnClose,def,vol1);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
UpVal = LatestEntryPrice(0);
UPCnt = upcnt+1;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
}
Else{
vol2 = int((투자금액-투자금액*Mult)/C);
}
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
DnCnt = Dncnt+1;
Mny3 = Mny3+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol3 = int((Mny3)/C);
}
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100));
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100));
}
if MarketPosition != 0 Then{
Upcnt = 0;
Dncnt = 0;
}
답변 2
예스스탁 예스스탁 답변
2014-10-23 14:04:50
안녕하세요
예스스탁입니다.
청산할때 투자금액만큼의 수량은 제외하고 청산하게 수정했습니다.
일부 청산을 하면 평균단가가 변하므로 바로 다음봉에 또다시
평균단가대비 수익이나 손실조건이 충족되어 신호가 발생할수 있습니다.
일부청산을 한 상태에서는 추가진입이 한번이상 발생한 이후부터 또다시 청산이 발생하게
추가해 놓았습니다.
해당 내용이 불필요 하시면 청산식의 if문에서 Xcond == true 조건을 삭제하시면 됩니다.
1.
input : RateUp(0.5),RateDn(1.5),투자금액(1000000),Per(2.5),첫진입시각(90000),Profit(5),Loss(30);
var : Vol1(0),vol2(0),vol3(0),Upval(0),Dnval(0),Ivol(0);
var : Xcond(false);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{//주식
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액*RateUp)/C)/10)*10;
vol3 = int(int((투자금액*RateDn)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);//ETF
vol2 = int((투자금액*RateUp)/C);
vol3 = int((투자금액*RateDn)/C);
}
if MarketPosition == 0 and stime == 첫진입시각 Then{
buy("b",OnClose,def,vol1);
UpVal = c;
DnVal = c;
Ivol = vol1;
Xcond = true;
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
UpVal = LatestEntryPrice(0);
Xcond = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
Xcond = true;
}
if CurrentContracts < CurrentContracts[1] Then{
UpVal = LatestExitPrice(1);
DnVal = LatestExitPrice(1);
Xcond = false;
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
ivol = int(int((투자금액)/C)/10)*10;
}
Else{
ivol = int((투자금액)/C);
}
if CurrentContracts > ivol and Xcond == true then{
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100),"",(CurrentContracts-Ivol),1);
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100),"",(CurrentContracts)-Ivol,1);
}
}
2.
input : 투자금액(2000000),Mult(0.5),Per(2.5),첫진입시각(90000),Profit(6),Loss(30);
var : Mny1(0),Mny2(0),Mny3(0),Vol1(0),Vol2(0),Vol3(0),Upval(0),Dnval(0),UPcnt(0),Dncnt(0),ivol(0);
var : Xcond(false);
if MarketPosition == 0 and stime == 첫진입시각 Then{
Mny3 = 투자금액+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);
vol2 = int((투자금액-투자금액*Mult)/C);
vol3 = int((Mny3)/C);
}
UpVal = c;
DnVal = c;
Xcond = true;
buy("b",OnClose,def,vol1);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
Xcond = true;
UpVal = LatestEntryPrice(0);
UPCnt = upcnt+1;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
}
Else{
vol2 = int((투자금액-투자금액*Mult)/C);
}
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
DnCnt = Dncnt+1;
Mny3 = Mny3+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol3 = int((Mny3)/C);
}
}
if CurrentContracts < CurrentContracts[1] Then{
Xcond = false;
UpVal = LatestExitPrice(1);
DnVal = LatestExitPrice(1);
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
ivol = int(int((투자금액)/C)/10)*10;
}
Else{
ivol = int((투자금액)/C);
}
if Xcond = true and CurrentContracts > Ivol Then{
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100),"",(CurrentContracts-Ivol),1);
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100),"",(CurrentContracts-Ivol),1);
}
}
if MarketPosition != 0 Then{
Upcnt = 0;
Dncnt = 0;
}
즐거운 하루되세요
> 미수예스 님이 쓴 글입니다.
> 제목 : 보유종목의 일부만 이익청산
> 안녕하십니까. 조금 수정하고 싶은 내용이 있습니다.
아래식은 목표이익 도달시 모두청산한후 다시 들어가도록 되어있습니다.
바꾸고 싶은 내용은, 목표이익 도달시 투자금액만큼의 수량을 남기고 청산하는 것입니다.
즉 목표익이 도달한 순간 최초금액(1000000)을 남기고 청산하고 이때의 가격이 최초진입된것으로 재설정되어 이후 재진입이 다시 시작되게 하는 것입니다.
손절금액에 도달시도 마찬가지로 최초금액(1000000)의 수량을 남기고 청산하고 이때의 가격이 최초진입된것으로 재설정되어 이후 재진입이 다시 시작되게 합니다.
요약하면, 시스템이 적용되면 최초진입후 항상 최초금액이상으로 진입되어있는 상태입니다.
감사합니다.
=======================================================================
1.고정금액
input : RateUp(0.5),RateDn(1.5),투자금액(1000000),Per(2.5),첫진입시각(90000),Profit(5),Loss(30);
var : Vol1(0),vol2(0),vol3(0),Upval(0),Dnval(0);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{//주식
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액*RateUp)/C)/10)*10;
vol3 = int(int((투자금액*RateDn)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);//ETF
vol2 = int((투자금액*RateUp)/C);
vol3 = int((투자금액*RateDn)/C);
}
if MarketPosition == 0 and stime == 첫진입시각 Then{
buy("b",OnClose,def,vol1);
UpVal = c;
DnVal = c;
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
UpVal = LatestEntryPrice(0);
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100));
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100));
}
2. 누적금액
input : 투자금액(2000000),Mult(0.5),Per(2.5),첫진입시각(90000),Profit(6),Loss(30);
var : Mny1(0),Mny2(0),Mny3(0),Vol1(0),Vol2(0),Vol3(0),Upval(0),Dnval(0),UPcnt(0),Dncnt(0);
if MarketPosition == 0 and stime == 첫진입시각 Then{
Mny3 = 투자금액+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);
vol2 = int((투자금액-투자금액*Mult)/C);
vol3 = int((Mny3)/C);
}
UpVal = c;
DnVal = c;
buy("b",OnClose,def,vol1);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
UpVal = LatestEntryPrice(0);
UPCnt = upcnt+1;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
}
Else{
vol2 = int((투자금액-투자금액*Mult)/C);
}
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
DnCnt = Dncnt+1;
Mny3 = Mny3+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol3 = int((Mny3)/C);
}
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100));
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100));
}
if MarketPosition != 0 Then{
Upcnt = 0;
Dncnt = 0;
}
미수예스
2014-10-23 17:17:34
안녕하십니까. 음..적용해보니 의미가 약간 다르게 전달된것 같습니다. (ETF레버리지)
첨부의 그림에서 보듯이 매수와 Profit청산이 의도와 다르게 비정상적으로 발생하네요.
말씀하신대로 일부만 청산하다보니 "AvgEntryPrice"가 바뀌는 문제 있네요
제 의도는 단순히
전부청산후 투자금액만큼 최초 재진입을 ---> 투자금액 만큼 남기고 청산 하면
어차피 같은 수량을 보유하므로 거래비용 및 슬리피지만큼 좀더 도움이 된다고 생각했는데,
의도는 청산청산시점에 남겨둔 수량이 청산시점에 진입된 가격으로 재인식이 되어서 처리되어 야하는데(다청산 하고 새로진입한 것과 같이..)
,, 문제는 그 수량이 원래 진입가격이 따로 있으므로 로직상에서 꼬이는것 같네요.
처리가 안될까요....
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 보유종목의 일부만 이익청산
>
안녕하세요
예스스탁입니다.
청산할때 투자금액만큼의 수량은 제외하고 청산하게 수정했습니다.
일부 청산을 하면 평균단가가 변하므로 바로 다음봉에 또다시
평균단가대비 수익이나 손실조건이 충족되어 신호가 발생할수 있습니다.
일부청산을 한 상태에서는 추가진입이 한번이상 발생한 이후부터 또다시 청산이 발생하게
추가해 놓았습니다.
해당 내용이 불필요 하시면 청산식의 if문에서 Xcond == true 조건을 삭제하시면 됩니다.
1.
input : RateUp(0.5),RateDn(1.5),투자금액(1000000),Per(2.5),첫진입시각(90000),Profit(5),Loss(30);
var : Vol1(0),vol2(0),vol3(0),Upval(0),Dnval(0),Ivol(0);
var : Xcond(false);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{//주식
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액*RateUp)/C)/10)*10;
vol3 = int(int((투자금액*RateDn)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);//ETF
vol2 = int((투자금액*RateUp)/C);
vol3 = int((투자금액*RateDn)/C);
}
if MarketPosition == 0 and stime == 첫진입시각 Then{
buy("b",OnClose,def,vol1);
UpVal = c;
DnVal = c;
Ivol = vol1;
Xcond = true;
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
UpVal = LatestEntryPrice(0);
Xcond = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
Xcond = true;
}
if CurrentContracts < CurrentContracts[1] Then{
UpVal = LatestExitPrice(1);
DnVal = LatestExitPrice(1);
Xcond = false;
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
ivol = int(int((투자금액)/C)/10)*10;
}
Else{
ivol = int((투자금액)/C);
}
if CurrentContracts > ivol and Xcond == true then{
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100),"",(CurrentContracts-Ivol),1);
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100),"",(CurrentContracts)-Ivol,1);
}
}
2.
input : 투자금액(2000000),Mult(0.5),Per(2.5),첫진입시각(90000),Profit(6),Loss(30);
var : Mny1(0),Mny2(0),Mny3(0),Vol1(0),Vol2(0),Vol3(0),Upval(0),Dnval(0),UPcnt(0),Dncnt(0),ivol(0);
var : Xcond(false);
if MarketPosition == 0 and stime == 첫진입시각 Then{
Mny3 = 투자금액+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);
vol2 = int((투자금액-투자금액*Mult)/C);
vol3 = int((Mny3)/C);
}
UpVal = c;
DnVal = c;
Xcond = true;
buy("b",OnClose,def,vol1);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
Xcond = true;
UpVal = LatestEntryPrice(0);
UPCnt = upcnt+1;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
}
Else{
vol2 = int((투자금액-투자금액*Mult)/C);
}
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
DnCnt = Dncnt+1;
Mny3 = Mny3+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol3 = int((Mny3)/C);
}
}
if CurrentContracts < CurrentContracts[1] Then{
Xcond = false;
UpVal = LatestExitPrice(1);
DnVal = LatestExitPrice(1);
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
ivol = int(int((투자금액)/C)/10)*10;
}
Else{
ivol = int((투자금액)/C);
}
if Xcond = true and CurrentContracts > Ivol Then{
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100),"",(CurrentContracts-Ivol),1);
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100),"",(CurrentContracts-Ivol),1);
}
}
if MarketPosition != 0 Then{
Upcnt = 0;
Dncnt = 0;
}
즐거운 하루되세요
> 미수예스 님이 쓴 글입니다.
> 제목 : 보유종목의 일부만 이익청산
> 안녕하십니까. 조금 수정하고 싶은 내용이 있습니다.
아래식은 목표이익 도달시 모두청산한후 다시 들어가도록 되어있습니다.
바꾸고 싶은 내용은, 목표이익 도달시 투자금액만큼의 수량을 남기고 청산하는 것입니다.
즉 목표익이 도달한 순간 최초금액(1000000)을 남기고 청산하고 이때의 가격이 최초진입된것으로 재설정되어 이후 재진입이 다시 시작되게 하는 것입니다.
손절금액에 도달시도 마찬가지로 최초금액(1000000)의 수량을 남기고 청산하고 이때의 가격이 최초진입된것으로 재설정되어 이후 재진입이 다시 시작되게 합니다.
요약하면, 시스템이 적용되면 최초진입후 항상 최초금액이상으로 진입되어있는 상태입니다.
감사합니다.
=======================================================================
1.고정금액
input : RateUp(0.5),RateDn(1.5),투자금액(1000000),Per(2.5),첫진입시각(90000),Profit(5),Loss(30);
var : Vol1(0),vol2(0),vol3(0),Upval(0),Dnval(0);
if CodeCategoryEx == 11 and BasePrice < 50000 Then{//주식
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액*RateUp)/C)/10)*10;
vol3 = int(int((투자금액*RateDn)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);//ETF
vol2 = int((투자금액*RateUp)/C);
vol3 = int((투자금액*RateDn)/C);
}
if MarketPosition == 0 and stime == 첫진입시각 Then{
buy("b",OnClose,def,vol1);
UpVal = c;
DnVal = c;
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
UpVal = LatestEntryPrice(0);
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100));
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100));
}
2. 누적금액
input : 투자금액(2000000),Mult(0.5),Per(2.5),첫진입시각(90000),Profit(6),Loss(30);
var : Mny1(0),Mny2(0),Mny3(0),Vol1(0),Vol2(0),Vol3(0),Upval(0),Dnval(0),UPcnt(0),Dncnt(0);
if MarketPosition == 0 and stime == 첫진입시각 Then{
Mny3 = 투자금액+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol1 = int(int((투자금액)/C)/10)*10;
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol1 = int((투자금액)/C);
vol2 = int((투자금액-투자금액*Mult)/C);
vol3 = int((Mny3)/C);
}
UpVal = c;
DnVal = c;
buy("b",OnClose,def,vol1);
}
if MarketPosition == 1 Then{
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "UpB" Then{
UpVal = LatestEntryPrice(0);
UPCnt = upcnt+1;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol2 = int(int((투자금액-투자금액*Mult)/C)/10)*10;
}
Else{
vol2 = int((투자금액-투자금액*Mult)/C);
}
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "DnB" Then{
DnVal = LatestEntryPrice(0);
DnCnt = Dncnt+1;
Mny3 = Mny3+투자금액*Mult;
if CodeCategoryEx == 11 and BasePrice < 50000 Then{
vol3 = int(int((Mny3)/C)/10)*10;
}
Else{
vol3 = int((Mny3)/C);
}
}
buy("UpB",AtStop,UpVal*(1+(Per)/100),Vol2);
buy("DnB",atlimit,DnVal*(1-(Per)/100),Vol3);
ExitLong("BP",atlimit,AvgEntryPrice*(1+Profit/100));
ExitLong("BL",atlimit,AvgEntryPrice*(1+Loss/100));
}
if MarketPosition != 0 Then{
Upcnt = 0;
Dncnt = 0;
}
다음글