커뮤니티
선물 수식 수정 부탁드립니다.
2018-09-09 15:24:32
182
글번호 121907
아래의 수식을 지수선물에 적용해 보았습니다.
1) 종료일 150000 에 전량청산이 실행되지 않습니다. 전량청산 되도록 부탁드립니다.
2) 각1회씩 진입한 수량만큼 각1회씩 청산이 되지 않습니다. 단 1회도 청산되지 않으니 재차 진입 또한 되지 않네요. 수정 부탁드립니다.
- 아 래 -
1.
input : 타주기분(60),시작일(20180608),종료일(20180913),vol(1);
var : S1(0),D1(0),TM(0),TF(0);
var : CC(0),C1(0),Tcond(false);
if Bdate != Bdate[1] Then{
S1 = TimeToMinutes(stime);
D1 = sdate;
if sdate >= 시작일 and sdate[1] < 종료일 Then
Tcond = true;
}
if Tcond == true and sdate >= 시작일 and (stime >= 종료일 and 150000) Then
{
Tcond = false;
ExitLong("x");
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
C1 = CC[1];
Condition1 = false;
}
CC = C;
if Tcond == true and
Condition1 == false and
C1 > 0 and CC < C1 and
MarketPosition >= 0 and CurrentContracts < 1 Then
{
Condition1 = true;
Buy("B",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C <= AvgEntryPrice and
MarketPosition >= 0 and CurrentContracts < 9 Then
{
Condition1 = true;
Buy("B.",OnClose,def,vol);
}
if MarketPosition == 1 and
Condition1 == false and
C >= AvgEntryPrice*1.01 Then
ExitLong("Bx",OnClose,def,"",vol,2);
}
2.
input : 타주기분(60),시작일(20180608),종료일(20180913),vol(1);
var : S1(0),D1(0),TM(0),TF(0);
var : CC(0),C1(0),Tcond(false);
if Bdate != Bdate[1] Then{
S1 = TimeToMinutes(stime);
D1 = sdate;
if sdate >= 시작일 and sdate[1] < 종료일 Then
Tcond = true;
}
if Tcond == true and sdate >= 시작일 and (stime >= 종료일 and 150000) Then
{
Tcond = false;
ExitShort("x");
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
C1 = CC[1];
Condition1 = false;
}
CC = C;
if Tcond == true and
Condition1 == false and
C1 > 0 and CC > C1 and
MarketPosition <= 0 and CurrentContracts < 1 Then
{
Condition1 = true;
sell("S",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C >= AvgEntryPrice and
MarketPosition <= 0 and CurrentContracts < 9 Then
{
Condition1 = true;
Sell("S.",OnClose,def,vol);
}
if MarketPosition == 1 and C < O and
Condition1 == false and
C <= AvgEntryPrice*0.99 Then
ExitShort("Sx",OnClose,def,"",vol,2);
}
답변 1
예스스탁 예스스탁 답변
2018-09-10 13:19:36
안녕하세요
예스스탁입니다.
각 수식의 청산이 1%수익시 청산입니다.
답변수식에서 포인트로 변경하고자 하시면 '
강제청산을 아래 내용으로 변경하시면 됩니다.
SetStopProfittarget(2,PointStop);
피라미딩은 모든진입신호로 설정하고 적용하셔야 합니다
1.
input : 타주기분(60),시작일(20180608),종료일(20180913),vol(1);
var : S1(0),D1(0),TM(0),TF(0);
var : CC(0),C1(0),Tcond(false);
if Bdate != Bdate[1] Then{
S1 = TimeToMinutes(stime);
D1 = sdate;
if sdate >= 시작일 and sdate[1] < 종료일 Then
Tcond = true;
}
if Tcond == true and sdate >= 종료일 and stime >= 150000 Then
{
Tcond = false;
ExitLong("x");
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
C1 = CC[1];
Condition1 = false;
}
CC = C;
if Tcond == true and
Condition1 == false and
C1 > 0 and CC < C1 and
MarketPosition >= 0 and CurrentContracts < 1 Then
{
Condition1 = true;
Buy("B",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C <= AvgEntryPrice and
MarketPosition >= 0 and CurrentContracts < 9 Then
{
Condition1 = true;
Buy("B.",OnClose,def,vol);
}
}
SetStopProfittarget(1,PercentStop);
2
input : 타주기분(60),시작일(20180608),종료일(20180913),vol(1);
var : S1(0),D1(0),TM(0),TF(0);
var : CC(0),C1(0),Tcond(false);
if Bdate != Bdate[1] Then{
S1 = TimeToMinutes(stime);
D1 = sdate;
if sdate >= 시작일 and sdate[1] < 종료일 Then
Tcond = true;
}
if Tcond == true and sdate >= 종료일 and stime >= 150000 Then
{
Tcond = false;
ExitShort("x");
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
C1 = CC[1];
Condition1 = false;
}
CC = C;
if Tcond == true and
Condition1 == false and
C1 > 0 and CC > C1 and
MarketPosition <= 0 and CurrentContracts < 1 Then
{
Condition1 = true;
sell("S",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C >= AvgEntryPrice and
MarketPosition <= 0 and CurrentContracts < 9 Then
{
Condition1 = true;
Sell("S.",OnClose,def,vol);
}
}
SetStopProfittarget(2,PercentStop);
즐거운 하루되세요
> 승부사1 님이 쓴 글입니다.
> 제목 : 선물 수식 수정 부탁드립니다.
> 아래의 수식을 지수선물에 적용해 보았습니다.
1) 종료일 150000 에 전량청산이 실행되지 않습니다. 전량청산 되도록 부탁드립니다.
2) 각1회씩 진입한 수량만큼 각1회씩 청산이 되지 않습니다. 단 1회도 청산되지 않으니 재차 진입 또한 되지 않네요. 수정 부탁드립니다.
- 아 래 -
1.
input : 타주기분(60),시작일(20180608),종료일(20180913),vol(1);
var : S1(0),D1(0),TM(0),TF(0);
var : CC(0),C1(0),Tcond(false);
if Bdate != Bdate[1] Then{
S1 = TimeToMinutes(stime);
D1 = sdate;
if sdate >= 시작일 and sdate[1] < 종료일 Then
Tcond = true;
}
if Tcond == true and sdate >= 시작일 and (stime >= 종료일 and 150000) Then
{
Tcond = false;
ExitLong("x");
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
C1 = CC[1];
Condition1 = false;
}
CC = C;
if Tcond == true and
Condition1 == false and
C1 > 0 and CC < C1 and
MarketPosition >= 0 and CurrentContracts < 1 Then
{
Condition1 = true;
Buy("B",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C <= AvgEntryPrice and
MarketPosition >= 0 and CurrentContracts < 9 Then
{
Condition1 = true;
Buy("B.",OnClose,def,vol);
}
if MarketPosition == 1 and
Condition1 == false and
C >= AvgEntryPrice*1.01 Then
ExitLong("Bx",OnClose,def,"",vol,2);
}
2.
input : 타주기분(60),시작일(20180608),종료일(20180913),vol(1);
var : S1(0),D1(0),TM(0),TF(0);
var : CC(0),C1(0),Tcond(false);
if Bdate != Bdate[1] Then{
S1 = TimeToMinutes(stime);
D1 = sdate;
if sdate >= 시작일 and sdate[1] < 종료일 Then
Tcond = true;
}
if Tcond == true and sdate >= 시작일 and (stime >= 종료일 and 150000) Then
{
Tcond = false;
ExitShort("x");
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
C1 = CC[1];
Condition1 = false;
}
CC = C;
if Tcond == true and
Condition1 == false and
C1 > 0 and CC > C1 and
MarketPosition <= 0 and CurrentContracts < 1 Then
{
Condition1 = true;
sell("S",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C >= AvgEntryPrice and
MarketPosition <= 0 and CurrentContracts < 9 Then
{
Condition1 = true;
Sell("S.",OnClose,def,vol);
}
if MarketPosition == 1 and C < O and
Condition1 == false and
C <= AvgEntryPrice*0.99 Then
ExitShort("Sx",OnClose,def,"",vol,2);
}
다음글