예스스탁
예스스탁 답변
2023-03-21 09:06:28
안녕하세요
예스스탁입니다.
올리신 내용에는 반대로 변경할 부분이 진입식 하나만 있습니다.
익절, 손절 강제청산을 사용한다면
일절틱수와 손절틱수 지정을 반대로 하시면 됩니다.
기존 익절틱수(100),손절틱수(50), 변경 익절틱수(50),손절틱수(100)
input : ntime(60),n(20);
input : 익절틱수(50),손절틱수(100);
input : StartTime(70000),EndTime(45000);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),SumSqrt(0),Stdv(0);
var : sum(0),BBmd(0),Bbup(0),BBdn(0);
Array : CC[100](0);
var : Tcond(false);
if (NextBarSdate != sdate and NextBarStime >= EndTime) or
(NextBarSdate == sdate and NextBarStime >= EndTime and stime < EndTime) Then
Tcond = False;
if (NextBarSdate != sdate and NextBarStime >= StartTime) or
(NextBarSdate == sdate and NextBarStime >= StartTime and stime < StartTime) Then
{
Tcond = true;
S1 = TimeToMinutes(NextBarStime);
D1 = NextBarSdate;
}
if D1 > 0 then
{
if NextBarSdate == D1 Then
TM = TimeToMinutes(NextBarStime)-S1;
Else
TM = TimeToMinutes(NextBarStime)+1440-S1;
TF = TM%ntime;
if NextBarSdate != sdate or
(NextBarSdate == sdate and ntime > 1 and TF < TF[1]) or
(NextBarSdate == sdate and ntime > 1 and TM >= TM[1]+ntime) or
(NextBarSdate == sdate and ntime == 1 and TM > TM[1]) Then
{
var1 = NextBarOpen;
}
if Tcond == true and MarketPosition >= 0 Then
Buy("시작매수",AtLimit,var1-PriceScale*n);
}
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);
}
}
즐거운 하루되세요
> 예스요 님이 쓴 글입니다.
> 제목 : 문의 드립니다.~~~~
> 수고하십니다,
아래식의 손익의 결과가
완전히 반대로 되는 식을 부탁드립니다.
input : ntime(60),n(20);
input : 익절틱수(100),손절틱수(50);
input : StartTime(70000),EndTime(45000);
var : S1(0),D1(0),TM(0),TF(0);
var : cnt(0),SumSqrt(0),Stdv(0);
var : sum(0),BBmd(0),Bbup(0),BBdn(0);
Array : CC[100](0);
var : Tcond(false);
if (NextBarSdate != sdate and NextBarStime >= EndTime) or
(NextBarSdate == sdate and NextBarStime >= EndTime and stime < EndTime) Then
Tcond = False;
if (NextBarSdate != sdate and NextBarStime >= StartTime) or
(NextBarSdate == sdate and NextBarStime >= StartTime and stime < StartTime) Then
{
Tcond = true;
S1 = TimeToMinutes(NextBarStime);
D1 = NextBarSdate;
}
if D1 > 0 then
{
if NextBarSdate == D1 Then
TM = TimeToMinutes(NextBarStime)-S1;
Else
TM = TimeToMinutes(NextBarStime)+1440-S1;
TF = TM%ntime;
if NextBarSdate != sdate or
(NextBarSdate == sdate and ntime > 1 and TF < TF[1]) or
(NextBarSdate == sdate and ntime > 1 and TM >= TM[1]+ntime) or
(NextBarSdate == sdate and ntime == 1 and TM > TM[1]) Then
{
var1 = NextBarOpen;
}
if Tcond == true and MarketPosition >= 0 Then
Sell("시작매도",AtStop,var1-PriceScale*n);
}
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);
}
}