예스스탁
예스스탁 답변
2020-12-11 14:33:33
안녕하세요
예스스탁입니다.
input : StartTime(223000),EndTime(030000),Xtime(033000);
input : 진입(2),청산(10),이동평균선(3);
input : 연속손실(3),익절(10),손절(10),매매정지(5);
var : hh(0),ll(0),mav(0),Tcond(false),loss(0),S1(0),D1(0),TM(0);
if sdate != sDate[1] Then
SetStopEndofday(EndTime);
if Bdate != Bdate[1] Then
{
SetStopEndofday(0);
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
}
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;
loss = 0;
Condition1 = False;
}
if TotalTrades > TotalTrades[1] Then
{
if PositionProfit(1) < 0 Then
loss = loss+1;
Else
loss = 0;
Condition1 = False;
if IsExitName("StopProfitTarget",1) == true or IsExitName("StopLoss",1) == true Then
Condition1 = true;
}
ExitLong("EL", atstop, Lowest( Low , 청산 ));
ExitShort("ES", atstop,Highest( High , 청산 ));
hh = Highest(h,진입);
ll = Lowest(l,진입);
mav = ma(C,이동평균선);
if Tcond == true Then
{
if c > mav and c > hh[1] Then
{
if (MarketPosition == 0 and loss < 연속손실 and Condition1 == False) or
(MarketPosition == 0 and loss < 연속손실 and Condition1 == true and TM >= TM[BarsSinceExit(1)]+매매정지) or
(MarketPosition == -1 and loss < 연속손실 and PositionProfit(0) >= 0) Then
Buy("b");
Else
ExitShort("sx");
}
if c < mav and c < ll[1] Then
{
if (MarketPosition == 0 and loss < 연속손실 and Condition1 == False) or
(MarketPosition == 0 and loss < 연속손실 and Condition1 == true and TM >= TM[BarsSinceExit(1)]+매매정지) or
(MarketPosition == 1 and loss < 연속손실 and PositionProfit(0) >= 0) Then
Sell("s");
Else
ExitLong("bx");
}
}
SetStopProfittarget(익절,PointStop);
SetStopLoss(손절,PointStop);
즐거운 하루되세요
> 산이보리 님이 쓴 글입니다.
> 제목 : 수식 의뢰 부탁드립니다.
> 나스닥을 매매하려고 합니다
아래 수식에서 3가지 조건을 추가하려고 합니다
1. 3번 연속손실 거래시 매매중지
(새벽 3시 반 당일청산, 저녁 11:30분 로스컷 카운트 제로 재설정)
2. 타겟수익(변수설정) 발생 시 이익실현 후 5분 매매정지
3. 손실 발생 시 5분 매매정지
감사합니다
------
input: 진입(2),청산(10),이동평균선(3);
var : hh(0),ll(0),mav(0);
#당일청산
If MarketPosition < 0 and time >= 033000 and time < 070000 Then
Exitshort("DailyExitShort");
if MarketPosition > 0 and time >= 033000 and time < 070000 Then
ExitLong("DailyExitlong");
#청산
ExitLong("EL", atstop, Lowest( Low , 청산 ));
ExitShort("ES", atstop,Highest( High , 청산 ));
hh = Highest(h,진입);
ll = Lowest(l,진입);
mav = ma(C,이동평균선);
if ( stime >= 223000 or stime < 030000 ) Then
{
if c > mav and c > hh[1] Then
Buy();
if c < mav and c < ll[1] Then
Sell();
}