예스스탁
예스스탁 답변
2021-12-20 16:23:05
안녕하세요
예스스탁입니다.
수식에 변경해 드릴 부분이 없습니다.
현재 수식이 매수/매도 조건만족시에 종가를 저장하고
해당 종가 기준 10틱 이상 반대로 움직인 후에
다시 돌파할때 신호가 발생하게 되어 있습니다.
시간은 적용하는 종목에 맞게
사용자분이 StartTime과 EndTime을 지정해 주시면 됩니다.
즐거운 하루되세요
> 장사장 님이 쓴 글입니다.
> 제목 : 안녕하세요 수식 문의 드립니다.
> 일전에 주신 수식 잘활요하고 있습니다. 항셍, 골드, 나스닥 한가지씩 추가 문의 드립니다.
항셍입니다. 항셍 수식입니다.
1. 매수 / 매도 신호시에 바로 진입으로 되있나요?
2. 바로 진입으로 되어있으면 바로진입이 아니라, 매수 매도 신호 발생하고,
10틱 눌림시에 매수매도 신호 발생시점에서 진입하는 것으로 변경 부탁드립니다.
기존수식 입니다.
input : StartTime(101200),EndTime(114000);
input : Length(20), D1(2),n(10);
input : 익절1(30),손절1(30),청산구분시간(103000),익절2(50),손절2(30),익절연속횟수(3),손절연속횟수(2);
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 (sdate != sdate[1] and stime >= StartTime) or
(sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then
{
T = 0;
Tcond = true;
profit = 0;
loss = 0;
}
if TotalTrades > TotalTrades[1] Then
{
if IsExitName("bp1.",1) or IsExitName("bp2.",21) or IsExitName("bp1",1) or IsExitName("bp2",21) or
IsExitName("sp1.",1) or IsExitName("sp2.",1) or IsExitName("sp1",1) or IsExitName("sp2",1) Then
profit = profit+1;
Else
profit = 0;
if IsExitName("bl1.",1) or IsExitName("bl2.",1) or IsExitName("bl1",1) or IsExitName("bl2",1) or
IsExitName("sl1.",1) or IsExitName("sl2.",1) or IsExitName("sl1",1) or IsExitName("sl2",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 or (C==O and C >= C[1])) then
{
T = 1;
S = C;
Y = S;
}
If CrossDown(L,Var2) and (C < O or (C==O and C < C[1])) then
{
T = -1;
S = C;
}
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*n and CrossUP(c,S) then
{
T = 2;
if profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Buy("b",OnClose,DEF,1);
if sTime >= StartTime and sTime < 청산구분시간 Then
{
ExitLong("bp1.",AtLimit,C+PriceScale*익절1,"",1,1);
ExitLong("bl1.",AtStop,C-PriceScale*손절1,"",1,1);
}
if sTime >= 청산구분시간 and sTime < Endtime Then
{
ExitLong("bp2.",AtLimit,C+PriceScale*익절2,"",1,1);
ExitLong("bl2.",AtStop,C-PriceScale*손절2,"",1,1);
}
}
}
If T == -1 and Y >= S+PriceScale*n and crossdown(C,S) then
{
T = -2;
if profit < 익절연속횟수 and loss < 손절연속횟수 then
{
Sell("s",OnClose,DEF,1);
if sTime >= StartTime and sTime < 103000 Then
{
ExitShort("sp1.",AtLimit,C-PriceScale*익절1,"",1,1);
ExitShort("sl1.",AtStop,C+PriceScale*손절1,"",1,1);
}
if sTime >= 103000 and sTime < Endtime Then
{
ExitShort("sp2.",AtLimit,C-PriceScale*익절2,"",1,1);
ExitShort("sl2.",AtStop,C+PriceScale*손절2,"",1,1);
}
}
}
}
if MarketPosition == 1 Then
{
if sTime >= StartTime and sTime < 청산구분시간 Then
{
ExitLong("bp1",AtLimit,EntryPrice+PriceScale*익절1,"",1,1);
ExitLong("bl1",AtStop,EntryPrice-PriceScale*손절1,"",1,1);
}
if sTime >= 청산구분시간 and sTime < Endtime Then
{
ExitLong("bp2",AtLimit,EntryPrice+PriceScale*익절2,"",1,1);
ExitLong("bl2",AtStop,EntryPrice-PriceScale*손절2,"",1,1);
}
}
if MarketPosition == -1 Then
{
if sTime >= StartTime and sTime < 103000 Then
{
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*익절1,"",1,1);
ExitShort("sl1",AtStop,EntryPrice+PriceScale*손절1,"",1,1);
}
if sTime >= 103000 and sTime < Endtime Then
{
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*익절2,"",1,1);
ExitShort("sl2",AtStop,EntryPrice+PriceScale*손절2,"",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);
}
}