커뮤니티
수식 수정 부탁드립니다.
2018-09-12 06:42:44
138
글번호 121973
아래의 수식에서 Atstop (매도10, 매도15, 매도20, 매도25, 매도30)으로 매도 된 경우는
이후에 추가 진입이 되지 않도록 수정 부탁드립니다.
- 아 래 -
input : 타주기분(60),시작일(20180816),종료일(20180910),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("청산");
}
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;
if TotalTrades == 0 or (TotalTrades >= 1 and IsExitName("매도",1) == true) Then
Buy("매수",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C <= AvgEntryPrice and
MarketPosition >= 0 and CurrentContracts < 19 Then
{
Condition1 = true;
Buy("매수.",OnClose,def,vol);
}
if MarketPosition == 1 and
Condition1 == false and
C >= AvgEntryPrice*1.03 Then
ExitLong("매도",OnClose,def,"",vol,2);
if highest(H,BarsSinceEntry) >= EntryPrice*1.10 and highest(H,BarsSinceEntry) < EntryPrice*1.15 Then
Exitlong("매도10",AtStop,EntryPrice*1.10);
if highest(H,BarsSinceEntry) >= EntryPrice*1.15 and highest(H,BarsSinceEntry) < EntryPrice*1.20 Then
Exitlong("매도15",AtStop,EntryPrice*1.15);
if highest(H,BarsSinceEntry) >= EntryPrice*1.20 and highest(H,BarsSinceEntry) < EntryPrice*1.25 Then
Exitlong("매도20",AtStop,EntryPrice*1.20);
if highest(H,BarsSinceEntry) >= EntryPrice*1.25 and highest(H,BarsSinceEntry) < EntryPrice*1.30 Then
Exitlong("매도25",AtStop,EntryPrice*1.25);
if highest(H,BarsSinceEntry) >= EntryPrice*1.30 and highest(H,BarsSinceEntry) < EntryPrice*1.35 Then
Exitlong("매도30",AtStop,EntryPrice*1.30);
}
답변 1
예스스탁 예스스탁 답변
2018-09-12 13:54:52
안녕하세요
예스스탁입니다.
input : 타주기분(60),시작일(20180816),종료일(20180910),vol(1);
var : S1(0),D1(0),TM(0),TF(0);
var : CC(0),C1(0),Tcond(false),Xcond(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("청산");
}
if TotalTrades > TotalTrades[1] Then
{
if LatestExitName(1) != "매도" Then
Xcond = true;
Else
Xcond = false;
}
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 and
Xcond == false Then
{
Condition1 = true;
Buy("매수",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C <= AvgEntryPrice and
Xcond == false and
MarketPosition == 1 and CurrentContracts < 19 Then
{
Condition1 = true;
Buy("매수.",OnClose,def,vol);
}
if MarketPosition == 1 and
Condition1 == false and
C >= AvgEntryPrice*1.03 Then
ExitLong("매도",OnClose,def,"",vol,2);
if highest(H,BarsSinceEntry) >= EntryPrice*1.10 and highest(H,BarsSinceEntry) < EntryPrice*1.15 Then
Exitlong("매도10",AtStop,EntryPrice*1.10);
if highest(H,BarsSinceEntry) >= EntryPrice*1.15 and highest(H,BarsSinceEntry) < EntryPrice*1.20 Then
Exitlong("매도15",AtStop,EntryPrice*1.15);
if highest(H,BarsSinceEntry) >= EntryPrice*1.20 and highest(H,BarsSinceEntry) < EntryPrice*1.25 Then
Exitlong("매도20",AtStop,EntryPrice*1.20);
if highest(H,BarsSinceEntry) >= EntryPrice*1.25 and highest(H,BarsSinceEntry) < EntryPrice*1.30 Then
Exitlong("매도25",AtStop,EntryPrice*1.25);
if highest(H,BarsSinceEntry) >= EntryPrice*1.30 and highest(H,BarsSinceEntry) < EntryPrice*1.35 Then
Exitlong("매도30",AtStop,EntryPrice*1.30);
}
즐거운 하루되세요
> 승부사1 님이 쓴 글입니다.
> 제목 : 수식 수정 부탁드립니다.
> 아래의 수식에서 Atstop (매도10, 매도15, 매도20, 매도25, 매도30)으로 매도 된 경우는
이후에 추가 진입이 되지 않도록 수정 부탁드립니다.
- 아 래 -
input : 타주기분(60),시작일(20180816),종료일(20180910),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("청산");
}
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;
if TotalTrades == 0 or (TotalTrades >= 1 and IsExitName("매도",1) == true) Then
Buy("매수",OnClose,def,vol);
}
if Tcond == true and
Condition1 == false and
C <= AvgEntryPrice and
MarketPosition >= 0 and CurrentContracts < 19 Then
{
Condition1 = true;
Buy("매수.",OnClose,def,vol);
}
if MarketPosition == 1 and
Condition1 == false and
C >= AvgEntryPrice*1.03 Then
ExitLong("매도",OnClose,def,"",vol,2);
if highest(H,BarsSinceEntry) >= EntryPrice*1.10 and highest(H,BarsSinceEntry) < EntryPrice*1.15 Then
Exitlong("매도10",AtStop,EntryPrice*1.10);
if highest(H,BarsSinceEntry) >= EntryPrice*1.15 and highest(H,BarsSinceEntry) < EntryPrice*1.20 Then
Exitlong("매도15",AtStop,EntryPrice*1.15);
if highest(H,BarsSinceEntry) >= EntryPrice*1.20 and highest(H,BarsSinceEntry) < EntryPrice*1.25 Then
Exitlong("매도20",AtStop,EntryPrice*1.20);
if highest(H,BarsSinceEntry) >= EntryPrice*1.25 and highest(H,BarsSinceEntry) < EntryPrice*1.30 Then
Exitlong("매도25",AtStop,EntryPrice*1.25);
if highest(H,BarsSinceEntry) >= EntryPrice*1.30 and highest(H,BarsSinceEntry) < EntryPrice*1.35 Then
Exitlong("매도30",AtStop,EntryPrice*1.30);
}