예스스탁
예스스탁 답변
2023-02-09 16:22:16
안녕하세요
예스스탁입니다.
input : StartTime(080000),EndTime(070000);
input : 익절포인트수1(160),익절포인트수2(400),익절포인트수3(160),손절포인트수(80);
input : 타주기분(60),P(5),Period(5);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),entry(0),bbup(0),bbdn(0);
var : sum1(0),mav1(0),sum2(0),mav2(0),sum3(0),mav3(0),avgv(0),avgv1(0),Tcond(False);
Array : CC[100](0);
avgv = ma(c,Period);
avgv1 =ma(c,20);
bbup = BollBandUp(20,2);
bbdn = BollBandDown(20,2);
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);
}
}
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
entry = 0;
}
if D1 > 0 then
{
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
for cnt = 1 to 99
{
CC[cnt] = CC[cnt-1][1];
}
}
CC[0] = C;
if CC[P+2] > 0 then
{
sum1 = 0;
sum2 = 0;
sum3 = 0;
for cnt = 0 to P-1
{
sum1 = sum1 + CC[cnt];
sum2 = sum2 + CC[cnt+1];
sum3 = sum3 + CC[cnt+2];
}
mav1 = sum1/P;
mav2 = sum2/P;
mav3 = sum3/P;
if MarketPosition <= 0
and mav1>mav2+10 Then
Buy("b",AtMarket);
if MarketPosition >= 0
and mav1<mav2-10 Then
Sell("s",AtMarket);
}
}
SetStopLoss(PriceScale*손절포인트수,PointStop);
if sTime >= 080000 and sTime < 150000 Then
{
SetStopProfittarget(PriceScale*익절포인트수1,PointStop);
}
Else if sTime >= 150000 or sTime < 050000 Then
{
SetStopProfittarget(PriceScale*익절포인트수2,PointStop);
}
Else
{
SetStopProfittarget(PriceScale*익절포인트수3,PointStop);
}
즐거운 하루되세요
> 동백초보 님이 쓴 글입니다.
> 제목 : 수식 문의 드립니다.
> 안녕하세요.
아래 수식에서 익절 틱수를 시간에 따라 변경하고 싶은데 어떻게 하면 되나요?
08시~15시 익절 160틱
15시~익일 05시 익절 400틱
05시~07시 익절 160틱
이렇게 변경하고 싶습니다.
부탁 드립니다.
input : StartTime(080000),EndTime(070000);
input : 익절포인트수(400),손절포인트수(80);
input : 타주기분(60),P(5),Period(5);
var : S1(0),D1(0),TM(0),TF(0),cnt(0),entry(0),bbup(0),bbdn(0);
var : sum1(0),mav1(0),sum2(0),mav2(0),sum3(0),mav3(0),avgv(0),avgv1(0),Tcond(False);
Array : CC[100](0);
avgv = ma(c,Period);
avgv1 =ma(c,20);
bbup = BollBandUp(20,2);
bbdn = BollBandDown(20,2);
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);
}
}
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
entry = 0;
}
if D1 > 0 then
{
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
entry = entry+1;
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF = TM%타주기분;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and 타주기분 > 1 and TF < TF[1]) or
(Bdate == Bdate[1] and 타주기분 > 1 and TM >= TM[1]+타주기분) or
(Bdate == Bdate[1] and 타주기분 == 1 and TM > TM[1]) Then
{
for cnt = 1 to 99
{
CC[cnt] = CC[cnt-1][1];
}
}
CC[0] = C;
if CC[P+2] > 0 then
{
sum1 = 0;
sum2 = 0;
sum3 = 0;
for cnt = 0 to P-1
{
sum1 = sum1 + CC[cnt];
sum2 = sum2 + CC[cnt+1];
sum3 = sum3 + CC[cnt+2];
}
mav1 = sum1/P;
mav2 = sum2/P;
mav3 = sum3/P;
if MarketPosition <= 0
and mav1>mav2+10 Then
Buy("b",AtMarket);
if MarketPosition >= 0
and mav1<mav2-10 Then
Sell("s",AtMarket);
}
}
SetStopProfittarget(PriceScale*익절포인트수,PointStop);
SetStopLoss(PriceScale*손절포인트수,PointStop);