커뮤니티
여전히 진입자체를 안하네요
2017-11-13 17:18:05
135
글번호 114145
수식 전체 올려봅니다.
아래와 같이 매수기준가, 매도기준가 직접입력해서 진입청산하는 수식입니다.
그런데 조건이 맞아도 전혀 진입을 안합니다. 문제를 찾아주세요.
변수 S1으로 잡아주셨던 것은 M1(매도변수랑 중복이라)으로 바꾼거 말고는 거의 그대로 입니다.
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);
Array : Ovalue[10](0),Hvalue[10](0),Lvalue[10](0),Cvalue[10](0);
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];
}
}
#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 < TF[1] Then
{
Condition1 = false;
Condition2 = false;
Condition11 = Condition1[1];
Condition22 = Condition2[1];
}
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;
Else Condition1 = false;
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;
Else Condition2 = false;
}
if Condition11 == true Then Buy("매수1",AtLimit,b1);
if Condition22 == true Then Sell("매도1",AtLimit,s1);
#손절 및 청산
setstoploss(pricescale*15,pointstop);
if MarketPosition == 1 then {
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 { if Cvalue[0] < entryprice then
ExitLong ("el00",AtLimit,entryprice);
}
}
if MarketPosition == -1 then {
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 { if Cvalue[0] > entryprice then
ExitShort ("es00",AtLimit,entryprice);
}
}
}
답변 2
예스스탁 예스스탁 답변
2017-11-14 11:26:42
안녕하세요
예스스탁입니다.
올리신 수식에 b1,b1e,s1,s1e변에 할당된 값이 없어
아래와 같이 임의로 지정해서 적용했습니다.
b1 = DayHigh(1);
s1 = daylow(1);
b1e = b1+1;
s1e = s1-1;
첨부된 그림과 같이 신호가 발생합니다.
기존 사용하시는 변수값으로 조건충족을 확인하시기 바랍니다.
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);
Array : Ovalue[10](0),Hvalue[10](0),Lvalue[10](0),Cvalue[10](0);
b1 = DayHigh(1);
s1 = daylow(1);
b1e = b1+1;
s1e = s1-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];
}
#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 Then Buy("매수1",AtLimit,b1);
if Condition22 == true Then Sell("매도1",AtLimit,s1);
#손절 및 청산
setstoploss(pricescale*15,pointstop);
if MarketPosition == 1 then {
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 { if Cvalue[0] < entryprice then
ExitLong ("el00",AtLimit,entryprice);
}
}
if MarketPosition == -1 then {
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 { if Cvalue[0] > entryprice then
ExitShort ("es00",AtLimit,entryprice);
}
}
}
즐거운 하루되세요
> 마인드마스터 님이 쓴 글입니다.
> 제목 : 여전히 진입자체를 안하네요
> 수식 전체 올려봅니다.
아래와 같이 매수기준가, 매도기준가 직접입력해서 진입청산하는 수식입니다.
그런데 조건이 맞아도 전혀 진입을 안합니다. 문제를 찾아주세요.
변수 S1으로 잡아주셨던 것은 M1(매도변수랑 중복이라)으로 바꾼거 말고는 거의 그대로 입니다.
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);
Array : Ovalue[10](0),Hvalue[10](0),Lvalue[10](0),Cvalue[10](0);
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];
}
}
#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 < TF[1] Then
{
Condition1 = false;
Condition2 = false;
Condition11 = Condition1[1];
Condition22 = Condition2[1];
}
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;
Else Condition1 = false;
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;
Else Condition2 = false;
}
if Condition11 == true Then Buy("매수1",AtLimit,b1);
if Condition22 == true Then Sell("매도1",AtLimit,s1);
#손절 및 청산
setstoploss(pricescale*15,pointstop);
if MarketPosition == 1 then {
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 { if Cvalue[0] < entryprice then
ExitLong ("el00",AtLimit,entryprice);
}
}
if MarketPosition == -1 then {
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 { if Cvalue[0] > entryprice then
ExitShort ("es00",AtLimit,entryprice);
}
}
}
마인드마스터
2017-11-14 13:39:55
마인드마스터 님에 의해 삭제된 답변입니다.
다음글