예스스탁
예스스탁 답변
2021-11-04 13:09:43
안녕하세요
예스스탁입니다.
1
수식안에 StartTime4에 대한 시간조건수식이 없습니다.
아래식에 추가해 드립니다.
2
input : 진입틱수(10);
input : 최소손실틱(0),손실감소틱(10);
input : StartTime1(70000),EndTime1(100000);
input : StartTime2(110000),EndTime2(130000);
input : StartTime3(150000),EndTime3(180000);
input : StartTime4(230000),EndTime4(010000);
var : Tcond(false);
var : OO(0),HH(0),LL(0);
if (sdate != sdate[1] and stime >= EndTime1) or
(sdate == sdate[1] and stime >= EndTime1 and stime[1] < EndTime1) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (DayOfWeek(sDate) != 1 and sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime2) or
(sdate == sdate[1] and stime >= EndTime2 and stime[1] < EndTime2) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (DayOfWeek(sDate) != 1 and sdate != sdate[1] and stime >= StartTime2) or
(sdate == sdate[1] and stime >= StartTime2 and stime[1] < StartTime2) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime3) or
(sdate == sdate[1] and stime >= EndTime3 and stime[1] < EndTime3) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (DayOfWeek(sDate) != 1 and sdate != sdate[1] and stime >= StartTime3) or
(sdate == sdate[1] and stime >= StartTime3 and stime[1] < StartTime3) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime4) or
(sdate == sdate[1] and stime >= EndTime4 and stime[1] < EndTime4) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (DayOfWeek(sDate) != 1 and sdate != sdate[1] and stime >= StartTime4) or
(sdate == sdate[1] and stime >= StartTime4 and stime[1] < StartTime4) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if Tcond == true Then
{
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*진입틱수 Then
Sell("하루시작매도",AtLimit,LL+PriceScale*진입틱수);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*진입틱수 Then
Buy("하루시작메수",AtLimit,HH-PriceScale*진입틱수);
}
if MarketPosition == 1 Then
{
if Tcond == true Then
Sell("Bp1",AtLimit,EntryPrice+PriceScale*진입틱수);
Else
ExitLong("Bp2",AtLimit,EntryPrice+PriceScale*진입틱수);
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소손실틱 Then
{
if Tcond == true Then
Sell("sx1",AtLimit,Lowest(L,BarsSinceEntry)+PriceScale*손실감소틱);
Else
ExitLong("sx2",AtLimit,Lowest(L,BarsSinceEntry)+PriceScale*손실감소틱);
}
}
if MarketPosition == -1 Then
{
if Tcond == true Then
Buy("sp1",AtLimit,EntryPrice-PriceScale*진입틱수);
Else
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*진입틱수);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소손실틱 Then
{
if Tcond == true Then
Buy("bx1",AtLimit,highest(H,BarsSinceEntry)-PriceScale*손실감소틱);
Else
ExitShort("bx2",AtLimit,highest(H,BarsSinceEntry)-PriceScale*손실감소틱);
}
}
즐거운 하루되세요
> 예스요 님이 쓴 글입니다.
> 제목 : 문의 드립니다.~~~~
> 답변주신 내용으로 햬결이 되지 않아
추가 요청을 더해 다시 부탁드립니다~
<진입>
진입은 아래 수식에서 설정된 시간대별로 구분되어
매일 진입이 실행되도록 시간대 설정
(왜그런지 아래식에서는 23시에서 1시까지는 진입이 이루어지지 않습니다.)
<청산>
1, 설정된 각 시간대 내에서는 청산 조건이 충족되면 수식 그대로
청산 및 스위칭 재진입
2, 설정된 각 시간내에서 청산 조건이 충족 되지 않아
포지션을 가지고 각 시간대를 지날때에는
청산 조건이 충족되면 스위칭 재진입 없이
청산만 이루어지도록 부탁드립니다~~~
항상 감사합니다 건강하세요~``
input : 진입틱수(10);
input : 최소손실틱(0),손실감소틱(10);
input : StartTime1(70000),EndTime1(100000);
input : StartTime2(110000),EndTime2(130000);
input : StartTime3(150000),EndTime3(180000);
input : StartTime4(230000),EndTime4(010000);
var : Tcond(false);
var : OO(0),HH(0),LL(0);
if (sdate != sdate[1] and stime >= EndTime1) or
(sdate == sdate[1] and stime >= EndTime1 and stime[1] < EndTime1) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (DayOfWeek(sDate) != 1 and sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime2) or
(sdate == sdate[1] and stime >= EndTime2 and stime[1] < EndTime2) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (DayOfWeek(sDate) != 1 and sdate != sdate[1] and stime >= StartTime2) or
(sdate == sdate[1] and stime >= StartTime2 and stime[1] < StartTime2) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime3) or
(sdate == sdate[1] and stime >= EndTime3 and stime[1] < EndTime3) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (DayOfWeek(sDate) != 1 and sdate != sdate[1] and stime >= StartTime3) or
(sdate == sdate[1] and stime >= StartTime3 and stime[1] < StartTime3) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime4) or
(sdate == sdate[1] and stime >= EndTime4 and stime[1] < EndTime4) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if Tcond == true Then
{
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*진입틱수 Then
Sell("하루시작매도",AtLimit,LL+PriceScale*진입틱수);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*진입틱수 Then
Buy("하루시작메수",AtLimit,HH-PriceScale*진입틱수);
}
if MarketPosition == 1 Then
{
Sell("Bp",AtLimit,EntryPrice+PriceScale*진입틱수);
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*최소손실틱 Then
Sell("sx",AtLimit,Lowest(L,BarsSinceEntry)+PriceScale*손실감소틱);
}
if MarketPosition == -1 Then
{
Buy("sp",AtLimit,EntryPrice-PriceScale*진입틱수);
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소손실틱 Then
Buy("bx",AtLimit,highest(H,BarsSinceEntry)-PriceScale*손실감소틱);
}