예스스탁
예스스탁 답변
2021-12-20 16:27:40
안녕하세요
예스스탁입니다.
24시는 0시로 지정해 주시면 됩니다.
input : StartTime(205500),EndTime(0);
input : Length(20), D1(2);
input : 익절(20),손절(15),익절연속횟수(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 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. 골드 시작시간은 22시로 변경 부탁드리고, 끝나는 시간을 24시로 변경부탁드립니다.
2. 골드도 매수매도 신호 바로 진입이 아니라, 5틱 눌림후에 매수매도 신호가 발생한 그 자리에 들어가는 것으로 변경 부탁드립니다.
input : StartTime(205500),EndTime(221000);
input : Length(20), D1(2);
input : 익절(20),손절(15),익절연속횟수(3),손절연속횟수(2);
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 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 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);
}