커뮤니티
지난번 수식에서 한번더 문의 드립니다
2017-11-21 21:55:09
187
글번호 114384
상단은 60분 차트이고,
아래는 1분 차트입니다.
1분 수식의 청산조건 중 하나는 기준선(주황색선) 아래로 역돌파시(60분기준) 진입가에서 청산한다가 있었습니다. 그런데 보시는 바와 같이 진입캔들 이후 60분이 지나고 다음 60분봉에서 조정이 왔는데도 진입가 청산이 이루어 지지 않고, 결국 하락하면서 손절되어 버렸습니다.
제 예상으로는 60분 동안만 조정(본절 청산)을 기다리다가, 60분이 지나면서 조건이 풀려버린것 같습니다. 종가가 진입가 보다 낮을때(매수기준) 계속 본절청산을 기다릴수 있도록 수식 수정 부탁드립니다.
- 1. 본절청산오류.png (0.02 MB)
답변 1
예스스탁 예스스탁 답변
2017-11-22 13:46:30
안녕하세요
예스스탁입니다.
Inputs: 매수1(0), 매수1익(0), 매도1(0), 매도1익(0);
Vars : b1(0), b1e(0), s1(0), s1e(0),
M1(0), D1(0), TM(0), TF(0), cnt(0), TM1(0), TF1(0);
var : Bentry(false),Sentry(false);
Array : Ovalue[10](0),Hvalue[10](0),Lvalue[10](0),Cvalue[10](0);
b1=매수1; b1e=매수1익;
s1=매도1; s1e=매도1익;
if Bdate != Bdate[1] Then{
M1 = TimeToMinutes(stime);
D1 = sdate;
}
if D1 > 0 then{
if sdate == D1 Then
TM = TimeToMinutes(stime)-M1;
Else
TM = TimeToMinutes(stime)+1440-M1;
TF = TM%60;
if Bdate != Bdate[1] or (Bdate == Bdate[1] and TF < TF[1]) Then
{
Ovalue[0] = O;
Hvalue[0] = H;
Lvalue[0] = L;
for cnt = 1 to 9{
Ovalue[cnt] = Ovalue[cnt-1][1];
Hvalue[cnt] = Hvalue[cnt-1][1];
Lvalue[cnt] = Lvalue[cnt-1][1];
Cvalue[cnt] = Cvalue[cnt-1][1];
}
Condition1 = false;
Condition2 = false;
Condition11 = Condition1[1];
Condition22 = Condition2[1];
if MarketPosition <= 0 Then
Bentry = true;
if MarketPosition >= 0 Then
Sentry = true;
}
#Hvalue[0]보다 큰 고가가 출력하면 값갱신
if H > Hvalue[0] Then
Hvalue[0] = H;
#Lvalue[0]보다 작은 저가가 출력하면 값갱신
if L < Lvalue[0] Then
Lvalue[0] = L;
#Cvalue[0]는 매봉종가
Cvalue[0] = C;
if (TF == 59) then {
if Ovalue[0]<=b1+PriceScale*1
and Cvalue[0]>b1+PriceScale*1
and (Hvalue[0]-Cvalue[0])+(Ovalue[0]-Lvalue[0])<=(Cvalue[0]-Ovalue[0])*2
then Condition1 = true;
if Ovalue[0]>=s1-PriceScale*1
and Cvalue[0]<s1-PriceScale*1
and (Hvalue[0]-Ovalue[0])+(Cvalue[0]-Lvalue[0])<=(Ovalue[0]-Cvalue[0])*2
Then Condition2 = true;
}
if Condition11 == true and Bentry == true Then Buy("매수1",AtLimit,b1);
if Condition22 == true and Sentry == true Then Sell("매도1",AtLimit,s1);
if MarketPosition == 1 then {
Bentry = false;
if IsEntryName("매수1") then
exitlong("매수1익",AtLimit,b1e);
if C > entryprice and barssinceentry >= 200 then
exitlong("el01",atstop,entryprice+(highest(h,barssinceentry)-entryprice)*0.4);
if TF == 59 Then {
Condition3 = false;
if Cvalue[0] < entryprice then
Condition3 = true;
}
if Condition3 == true then
ExitLong ("el00",AtLimit,entryprice);
}
Else
Condition3 = false;
if MarketPosition == -1 then {
Sentry = false;
if IsEntryName("매도1") then
ExitShort("매도1익",AtLimit,s1e);
if C < EntryPrice and BarsSinceEntry >= 200 then
exitshort("es01",atstop,entryprice-(entryprice-lowest(l,barssinceentry))*0.4);
if TF == 59 Then {
Condition4 = false;
if Cvalue[0] > entryprice then
Condition4 = true;
}
if Condition4 == true then
ExitShort ("es00",AtLimit,entryprice);
}
Else
Condition4 = false;
}
#손절 및 청산
setstoploss(pricescale*31,pointstop);
즐거운 하루되세요
> 마인드마스터 님이 쓴 글입니다.
> 제목 : 지난번 수식에서 한번더 문의 드립니다
> 상단은 60분 차트이고,
아래는 1분 차트입니다.
1분 수식의 청산조건 중 하나는 기준선(주황색선) 아래로 역돌파시(60분기준) 진입가에서 청산한다가 있었습니다. 그런데 보시는 바와 같이 진입캔들 이후 60분이 지나고 다음 60분봉에서 조정이 왔는데도 진입가 청산이 이루어 지지 않고, 결국 하락하면서 손절되어 버렸습니다.
제 예상으로는 60분 동안만 조정(본절 청산)을 기다리다가, 60분이 지나면서 조건이 풀려버린것 같습니다. 종가가 진입가 보다 낮을때(매수기준) 계속 본절청산을 기다릴수 있도록 수식 수정 부탁드립니다.