예스스탁
예스스탁 답변
2021-12-20 16:29:18
안녕하세요
예스스탁입니다.
input : StartTime(222700),EndTime(40000);
input : Length(20), D1(2);
input : 익절(50),손절(30),익절연속횟수(3),손절연속횟수(3);
var : Tcond(false),profit(0),loss(0),T(0),S(0),Y(0);
if (sdate != sdate[1] and stime >= EndTime) or
(sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
Tcond = true;
profit = 0;
loss = 0;
}
if TotalTrades > TotalTrades[1] Then
{
if IsExitName("bp.",1) or IsExitName("bp",1) or IsExitName("sp.",1) or IsExitName("sp",1) Then
profit = profit+1;
Else
profit = 0;
if IsExitName("bl.",1) or IsExitName("bl",1) or IsExitName("sl.",1) or IsExitName("sl",1) Then
loss = loss+1;
Else
loss = 0;
}
var1 = BollBandUp(Length,D1);
var2 = BollBandDown(Length,D1);
if Tcond == true Then
{
if CrossUp(H,var1) and C > O Then
{
T = 1;
S = C;
Y = S;
}
if CrossDown(L,Var2) and C < O Then
{
T = -1;
S = C;
Y = S;
}
if T == 1 and C < Y Then
Y = C;
if T == -1 and C > Y Then
Y = C;
If T == 1 and Y <= S-PriceScale*5 and CrossUp(C,S) Then
{
T = 2;
if profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Buy("b",OnClose,DEF,1);
ExitLong("bp.",AtLimit,C+PriceScale*익절,"",1,1);
ExitLong("bl.",AtStop,C-PriceScale*손절,"",1,1);
}
}
If T == -1 and Y >= S+PriceScale*5 and CrossDown(C,S) Then
{
T = -2;
if profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Sell("s",OnClose,DEF,1);
ExitShort("sp.",AtLimit,C-PriceScale*익절,"",1,1);
ExitShort("sl.",AtStop,C+PriceScale*손절,"",1,1);
}
}
}
if MarketPosition == 1 Then
{
ExitLong("bp",AtLimit,EntryPrice+PriceScale*익절,"",1,1);
ExitLong("bl",AtStop,EntryPrice-PriceScale*손절,"",1,1);
}
if MarketPosition == -1 Then
{
ExitShort("sp",AtLimit,EntryPrice-PriceScale*익절,"",1,1);
ExitShort("sl",AtStop,EntryPrice+PriceScale*손절,"",1,1);
}
즐거운 하루되세요
> 장사장 님이 쓴 글입니다.
> 제목 : 안녕하세요 수식 문의 드립니다.
> 나스닥 수식 입니다.
1. 나스닥 시작시간을 23시27분으로 변경해주시고, 종료 시간을 새벽 4시로 변경해주세요.
2. 나스닥도 지금 매수매도 신호에 바로 들어가는 것으로 되어있는데, 항셍과 마찬가지로 매수매도 신호 나오면 바로 들어가는 것이 아니라, 15틱 눌림후에 매수매도 신호 나왔던 그 자리에 들어가는 것으로 변경 부탁드립니다.
input : StartTime(223000),EndTime(011000);
input : Length(20), D1(2);
input : 익절(50),손절(30),익절연속횟수(3),손절연속횟수(3);
var : Tcond(false),profit(0),loss(0);
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;
profit = 0;
loss = 0;
}
if TotalTrades > TotalTrades[1] Then
{
if IsExitName("bp.",1) or IsExitName("bp",1) or IsExitName("sp.",1) or IsExitName("sp",1) Then
profit = profit+1;
Else
profit = 0;
if IsExitName("bl.",1) or IsExitName("bl",1) or IsExitName("sl.",1) or IsExitName("sl",1) Then
loss = loss+1;
Else
loss = 0;
}
var1 = BollBandUp(Length,D1);
var2 = BollBandDown(Length,D1);
if Tcond == true Then
{
If CrossUP(H,var1) and c > o and profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Buy("b",OnClose,DEF,1);
ExitLong("bp.",AtLimit,C+PriceScale*익절,"",1,1);
ExitLong("bl.",AtStop,C-PriceScale*손절,"",1,1);
}
If CrossDown(L,Var2) and C < O and profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Sell("s",OnClose,DEF,1);
ExitShort("sp.",AtLimit,C-PriceScale*익절,"",1,1);
ExitShort("sl.",AtStop,C+PriceScale*손절,"",1,1);
}
}
if MarketPosition == 1 Then
{
ExitLong("bp",AtLimit,EntryPrice+PriceScale*익절,"",1,1);
ExitLong("bl",AtStop,EntryPrice-PriceScale*손절,"",1,1);
}
if MarketPosition == -1 Then
{
ExitShort("sp",AtLimit,EntryPrice-PriceScale*익절,"",1,1);
ExitShort("sl",AtStop,EntryPrice+PriceScale*손절,"",1,1);
}
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
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);
}
}