답변완료
문의 드립니다.
항상 감사드립니다.
아래 수식은 종가에 진입하고 거래시간 종료에 청산하는 수식인데요.
아래 내용으로 수정 부탁드립니다.
1. 조건 완성시 즉시 진입
2. 익절 두번 연속, 손절이 두번 연속될 경우, 거래 종료
3. 거래시간내에 진입한 거래가 종료전에 익절, 손절이 안될 경우, 거래시간 종료이후에 같은 조건으로 익절, 손절 청산.
input : ntime1(5),n1(10),n2(30);
input : StartTime(222500),EndTime(010000);
input : 익절틱수(50),손절틱수(40);
var : S1(0),D1(0),TM(0),TF1(0),TF2(0),cnt(0);
var : Tcond(false);
Array : H1[50](0),L1[50](0),H2[50](0),L2[50](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;
if Bdate != Bdate[1] Then
{
S1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then
{
if sdate == D1 Then
TM = TimeToMinutes(stime)-S1;
Else
TM = TimeToMinutes(stime)+1440-S1;
TF1 = TM%ntime1;
if Bdate != Bdate[1] or
(Bdate == Bdate[1] and ntime1 > 1 and TF1 < TF1[1]) or
(Bdate == Bdate[1] and ntime1 > 1 and TM >= TM[1]+ntime1) or
(Bdate == Bdate[1] and ntime1 == 1 and TM > TM[1]) Then
{
H1[0] = H;
L1[0] = L;
For cnt = 1 to 49
{
H1[cnt] = H1[cnt-1][1];
L1[cnt] = L1[cnt-1][1];
}
}
if H1[0] > 0 and H > H1[0] Then
H1[0] = H;
if L1[0] > 0 and L < L1[0] Then
L1[0] = L;
if Tcond == true Then
{
if H1[n1] > 0 and H1[n1] > 0 and C > H1[n1] and C > H1[n2] and C > O and !(H <= H[1] and L >= L[1]) Then
Buy();
if L1[n1] > 0 and L1[n2] > 0 and C < L1[n1] and C < L1[n2] and C < O and !(H <= H[1] and L >= L[1]) Then
Sell();
if MarketPosition == 1 Then
ExitLong("bx",AtStop,L-PriceScale*1);
if MarketPosition == -1 Then
ExitShort("sx",AtStop,H+PriceScale*1);
}
}
SetStopProfittarget(PriceScale*익절틱수,PointStop);
SetStopLoss(PriceScale*손절틱수,PointStop);
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);
}
}
2021-10-30
813
글번호 153271
시스템
답변완료
지표 부탁드립니다.
안녕하세요?
이평에다가 + 역이평을 추가할 수 있는지요?
오늘도 부탁드려봅니다.
좋은 주말 되세요...
Input : Period1(5), Period2(20), Period3(60);
var1 = ma(C,Period1);
var2 = ma(C,Period2);
var3 = ma(C,Period3);
Plot1(var1, "이동평균1");
Plot2(var2, "이동평균2");
Plot3(var3, "이동평균3");
2021-10-29
947
글번호 153252
지표