커뮤니티
1분으로 쪼개기 추가 질문드립니다
2017-11-11 01:13:02
142
글번호 114097
1) 60분 봉을 1분으로 쪼개 달라고 문의드렸었는데요.
수정해서 받은 수식을 응용하려고 하다보니 잘 안되네요. 한번 봐주세요.
진입, 청산부분만 따로 가져왔습니다.
b1, b2의 매수 기준 가격과 x1, x2의 매도 기준 가격을 설정한 다음 아래와 같이 하였습니다. 그 외의 조건식은 거의 동일합니다. 그런데 진입조건이 되도 전혀 주문을 안하네요....
뭐가 문제인가요?
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
and MarketPosition == 0
Then Condition1 = true;
Else Condition1 = false;
if Ovalue[0]<=b2+PriceScale*1
and Cvalue[0]>b2+PriceScale*1
and (Hvalue[0]-Cvalue[0])+(Ovalue[0]-Lvalue[0])<=(Cvalue[0]-Ovalue[0])*2
and MarketPosition == 0
Then Condition2 = true;
Else Condition2 = false;
if Ovalue[0]>=x1-PriceScale*1
and Cvalue[0]<x1-PriceScale*1
and (Hvalue[0]-Ovalue[0])+(Cvalue[0]-Lvalue[0])<=(Ovalue[0]-Cvalue[0])*2
and MarketPosition == 0
Then Condition3 = true;
Else Condition3 = false;
if Ovalue[0]>=x2-PriceScale*1
and Cvalue[0]<x2-PriceScale*1
and (Hvalue[0]-Ovalue[0])+(Cvalue[0]-Lvalue[0])<=(Ovalue[0]-Cvalue[0])*2
and MarketPosition == 0
Then Condition4 = true;
Else Condition4 = false;
}
if Condition1 == true Then Buy("매수1",AtLimit,b1);
if Condition2 == true Then Buy("매수2",AtLimit,b2);
if Condition3 == true Then Sell("매도1",AtLimit,x1);
if Condition4 == true Then Sell("매도2",AtLimit,x2);
setstoploss(pricescale*31,pointstop);
if MarketPosition == 1 then {
If c<entryprice-PriceScale*1 and barssinceentry>=60
then ExitLong("매수본청",AtLimit,entryprice);
if IsEntryName("매수1")
then exitlong("매수1익",AtLimit,b1e);
if IsEntryName("매수2")
then exitlong("매수2익",AtLimit,b2e);
}
if MarketPosition == -1 then {
If c>entryprice+PriceScale*1 and barssinceentry>=60
then ExitShort("매도본청",AtLimit,entryprice);
if IsEntryName("매도1")
then ExitShort("매도1익",AtLimit,x1e);
if IsEntryName("매도2")
then ExitShort("매도2익",AtLimit,x2e);
}
2) 60분봉기준으로 진입조건이 성립했으면 다음 60분동안 내내 진입대기상태로 있어야 하는데, 주신 수식은 1분 동안만 대기후 조건이 사라져 버리는 것 같습니다. 조건 성립후 45분, 50분에도 진입이 되어야 하는데 항상 10:01분 11:01분 23:01분에만 진입하더군요... 이것도 확인 부탁드립니다.
3) 진입한 캔들이 완성되기 전에 익절이 가능한가요?
setstoploss(pricescale*17,pointstop);
if MarketPosition == 1 then
{ if IsEntryName("매수1")
then exitlong("매수1익",AtLimit, eee); }
기본손절은 17틱 잡아두고, 매수 조건에 따라 진입을 했는데 진입 직후 바로 익절가격(eee)에 도달했다면 청산이 되나요? 위의 식으로는 진입캔들이 완성되고 다음 캔들에서 청산하더군요.
진입캔들 생성도중 익절청산하는 방법이 있다면 알려주시기 바랍니다.
4) 그리고 매수 진입이후 청산과 동시에 매도조건이 충족할때 바로 진입하려면(스위칭) 어떻게 해야 하나요. 예를 들의 1)의 수식에서 b1과 x1이 같은 가격일때 '매수본청'으로 청산할때 동시에 매도 조건이 맞는 경우가 많은데 바로 매수청산과 함께 매도진입할 수 있는 수식을 알려주시면 감사하겠습니다.
답변 1
예스스탁 예스스탁 답변
2017-11-13 14:13:29
안녕하세요
예스스탁입니다.
1.2
if TF < TF[1] Then
{
Condition1 = false;
Condition2 = false;
Condition3 = false;
Condition4 = false;
Condition11 = Condition1[1];
Condition22 = Condition2[1];
Condition33 = Condition3[1];
Condition44 = Condition4[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
and MarketPosition == 0
Then Condition1 = true;
if Ovalue[0]<=b2+PriceScale*1
and Cvalue[0]>b2+PriceScale*1
and (Hvalue[0]-Cvalue[0])+(Ovalue[0]-Lvalue[0])<=(Cvalue[0]-Ovalue[0])*2
and MarketPosition == 0
Then Condition2 = true;
if Ovalue[0]>=x1-PriceScale*1
and Cvalue[0]<x1-PriceScale*1
and (Hvalue[0]-Ovalue[0])+(Cvalue[0]-Lvalue[0])<=(Ovalue[0]-Cvalue[0])*2
and MarketPosition == 0
Then Condition3 = true;
if Ovalue[0]>=x2-PriceScale*1
and Cvalue[0]<x2-PriceScale*1
and (Hvalue[0]-Ovalue[0])+(Cvalue[0]-Lvalue[0])<=(Ovalue[0]-Cvalue[0])*2
and MarketPosition == 0
Then Condition4 = true;
}
if Condition11 == true Then Buy("매수1",AtLimit,b1);
if Condition22 == true Then Buy("매수2",AtLimit,b2);
if Condition33 == true Then Sell("매도1",AtLimit,x1);
if Condition44 == true Then Sell("매도2",AtLimit,x2);
setstoploss(pricescale*31,pointstop);
if MarketPosition == 1 then
{
If c<entryprice-PriceScale*1 and barssinceentry>=60
then ExitLong("매수본청",AtLimit,entryprice);
if IsEntryName("매수1")
then exitlong("매수1익",AtLimit,b1e);
if IsEntryName("매수2")
then exitlong("매수2익",AtLimit,b2e);
}
if MarketPosition == -1 then
{
If c>entryprice+PriceScale*1 and barssinceentry>=60
then ExitShort("매도본청",AtLimit,entryprice);
if IsEntryName("매도1")
then ExitShort("매도1익",AtLimit,x1e);
if IsEntryName("매도2")
then ExitShort("매도2익",AtLimit,x2e);
}
3
if문은 봉완성시에만 조건만족 여부를 판단합니다.
매수진입과 진입명을 파악하기 위해서는 최고 한개봉은 완성되어야 하므로
진입봉에서 청산신호가 발생하게 할수 없습니다.
4
진입식에서는 진입조건에 MarketPosition == 0이라는 조건이 없으면 스위칭이 됩니다.
올리신 식에서는 각조건에서 MarketPosition == 0조건 삭제하면 됩니다.
즐거운 하루되세요
> 마인드마스터 님이 쓴 글입니다.
> 제목 : 1분으로 쪼개기 추가 질문드립니다
> 1) 60분 봉을 1분으로 쪼개 달라고 문의드렸었는데요.
수정해서 받은 수식을 응용하려고 하다보니 잘 안되네요. 한번 봐주세요.
진입, 청산부분만 따로 가져왔습니다.
b1, b2의 매수 기준 가격과 x1, x2의 매도 기준 가격을 설정한 다음 아래와 같이 하였습니다. 그 외의 조건식은 거의 동일합니다. 그런데 진입조건이 되도 전혀 주문을 안하네요....
뭐가 문제인가요?
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
and MarketPosition == 0
Then Condition1 = true;
Else Condition1 = false;
if Ovalue[0]<=b2+PriceScale*1
and Cvalue[0]>b2+PriceScale*1
and (Hvalue[0]-Cvalue[0])+(Ovalue[0]-Lvalue[0])<=(Cvalue[0]-Ovalue[0])*2
and MarketPosition == 0
Then Condition2 = true;
Else Condition2 = false;
if Ovalue[0]>=x1-PriceScale*1
and Cvalue[0]<x1-PriceScale*1
and (Hvalue[0]-Ovalue[0])+(Cvalue[0]-Lvalue[0])<=(Ovalue[0]-Cvalue[0])*2
and MarketPosition == 0
Then Condition3 = true;
Else Condition3 = false;
if Ovalue[0]>=x2-PriceScale*1
and Cvalue[0]<x2-PriceScale*1
and (Hvalue[0]-Ovalue[0])+(Cvalue[0]-Lvalue[0])<=(Ovalue[0]-Cvalue[0])*2
and MarketPosition == 0
Then Condition4 = true;
Else Condition4 = false;
}
if Condition1 == true Then Buy("매수1",AtLimit,b1);
if Condition2 == true Then Buy("매수2",AtLimit,b2);
if Condition3 == true Then Sell("매도1",AtLimit,x1);
if Condition4 == true Then Sell("매도2",AtLimit,x2);
setstoploss(pricescale*31,pointstop);
if MarketPosition == 1 then {
If c<entryprice-PriceScale*1 and barssinceentry>=60
then ExitLong("매수본청",AtLimit,entryprice);
if IsEntryName("매수1")
then exitlong("매수1익",AtLimit,b1e);
if IsEntryName("매수2")
then exitlong("매수2익",AtLimit,b2e);
}
if MarketPosition == -1 then {
If c>entryprice+PriceScale*1 and barssinceentry>=60
then ExitShort("매도본청",AtLimit,entryprice);
if IsEntryName("매도1")
then ExitShort("매도1익",AtLimit,x1e);
if IsEntryName("매도2")
then ExitShort("매도2익",AtLimit,x2e);
}
2) 60분봉기준으로 진입조건이 성립했으면 다음 60분동안 내내 진입대기상태로 있어야 하는데, 주신 수식은 1분 동안만 대기후 조건이 사라져 버리는 것 같습니다. 조건 성립후 45분, 50분에도 진입이 되어야 하는데 항상 10:01분 11:01분 23:01분에만 진입하더군요... 이것도 확인 부탁드립니다.
3) 진입한 캔들이 완성되기 전에 익절이 가능한가요?
setstoploss(pricescale*17,pointstop);
if MarketPosition == 1 then
{ if IsEntryName("매수1")
then exitlong("매수1익",AtLimit, eee); }
기본손절은 17틱 잡아두고, 매수 조건에 따라 진입을 했는데 진입 직후 바로 익절가격(eee)에 도달했다면 청산이 되나요? 위의 식으로는 진입캔들이 완성되고 다음 캔들에서 청산하더군요.
진입캔들 생성도중 익절청산하는 방법이 있다면 알려주시기 바랍니다.
4) 그리고 매수 진입이후 청산과 동시에 매도조건이 충족할때 바로 진입하려면(스위칭) 어떻게 해야 하나요. 예를 들의 1)의 수식에서 b1과 x1이 같은 가격일때 '매수본청'으로 청산할때 동시에 매도 조건이 맞는 경우가 많은데 바로 매수청산과 함께 매도진입할 수 있는 수식을 알려주시면 감사하겠습니다.