예스스탁
예스스탁 답변
2023-09-08 14:38:43
안녕하세요
예스스탁입니다.
Input : Period(14);
input : StartTime(090000),EndTime(230000);
Input : 당일수익틱수(100),당일손실틱수(200);
Input : shortPeriod(5), longPeriod(10);
Var : value(0);
Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
Tcond = true;
}
당일수익 = PriceScale*당일수익틱수;
당일손실 = PriceScale*당일손실틱수;
if Bdate != Bdate[1] Then
{
Xcond = false;
N1 = NetProfit;
}
daypl = NetProfit-N1;
if TotalTrades > TotalTrades[1] then
{
if daypl >= 당일수익 or daypl <= -당일손실 Then
Xcond = true;
if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or
IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then
Xcond = true;
}
value1 = ema(C, shortPeriod);
value2 = ema(C, longPeriod);
if Xcond == false and Tcond == true then
{
# 매수
If c > value2 and o < value2 Then
{
Buy();
}
# 매도
If c < value2 and o > value2 Then
{
Sell();
}
if MarketPosition == 1 then
{
ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts));
ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts));
}
if MarketPosition == -1 then{
ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts));
ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts));
}
}
즐거운 하루되세요
> 하늘북 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 늘 감사합니다.
아래 수식 수정 부탁드립니다.
당일 누적수익 100틱이상이면 모두 청산 후 진입금지 당일거래 금지
당일 누적손실 100틱이상이면 모두 청산 후 진입금지 당일거래 금지
Input : Period(14);
Var : value(0);
input : StartTime(090000),EndTime(230000);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
Tcond = False;
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
Input : shortPeriod(5), longPeriod(10);
value1 = ema(C, shortPeriod);
value2 = ema(C, longPeriod);
# 매수
If c > value2 and o < value2 Then
{
Buy();
}
# 매도
If c < value2 and o > value2 Then
{
Sell();
}