커뮤니티
바쁘신대 수정 부탁드립니다
2013-10-23 21:20:42
168
글번호 68765
아래식은 야간장 시가를 기준가로 하는 매매식입니다
이식을 토대로 기준가를 주간장 당일 시가로 변경하고 싶습니다
아래식에서 야간장 시가로 되어 있는 수식은 전부 파악하여 주간장 당일 시가로 빠짐없이 변경 부탁드립니다
바쁘신대 수고가 많으시며 항상 시스템 초보들을 위해 고생 해주시는 부분 정말 감사합니다
input : 매수진입별횟수(2),매도진입별횟수(2),당일최대매수횟수(5),당일최대매도횟수(5);
var : direction(0),HH(0),LL(0),cnt(0),count(0),기준가(0);
var : Bcond1(false),Bcond2(false),Bcond3(false),Bcond4(false),Bcond5(false);
var : Scond1(false),Scond2(false),Scond3(false),Scond4(false),Scond5(false);
var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0),Didx(0);
var : Scnt1(0),Scnt2(0),Scnt3(0),Scnt4(0),Scnt5(0),Buycnt(0),Sellcnt(0);
if stime == 180000 or (stime > 180000 and stime[1] < 180000) Then
기준가 = O;
var1 = 기준가-4.0;
var2 = 기준가-2.0;
var3 = 기준가+2.0;
var4 = 기준가+4.0;
if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{
direction = 0;
Didx = 0;
}
count = 0;
Bcnt1 = 0;Bcnt2 = 0;Bcnt3 = 0;Bcnt4 = 0;
Scnt1 = 0;Scnt2 = 0;Scnt3 = 0;Scnt4 = 0;
Buycnt = 0;
Sellcnt = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) and EntryTime(cnt) >= 090000 and EntryTime(cnt) <= 151500 Then{
count = count+1;
if IsEntryName("b1",cnt) == true Then Bcnt1 = Bcnt1+1;
if IsEntryName("b2",cnt) == true Then Bcnt2 = Bcnt2+1;
if IsEntryName("b3",cnt) == true Then Bcnt3 = Bcnt3+1;
if IsEntryName("b4",cnt) == true Then Bcnt4 = Bcnt4+1;
if IsEntryName("s1",cnt) == true Then Scnt1 = Scnt1+1;
if IsEntryName("s2",cnt) == true Then Scnt2 = Scnt2+1;
if IsEntryName("s3",cnt) == true Then Scnt3 = Scnt3+1;
if IsEntryName("s4",cnt) == true Then Scnt4 = Scnt4+1;
if MarketPosition(cnt) == 1 then
Buycnt = Buycnt+1;
if MarketPosition(cnt) == -1 then
SEllcnt = Sellcnt+1;
}
}
if stime >= 090000 and stime <= 151500 then{
Didx = Didx+1;
if Didx > 1 Then{
if crossup(C,var1) Then {
direction = 1;
HH = H;
}
if crossup(C,var2) Then {
direction = 2;
HH = H;
}
if crossup(C,var3) Then {
direction = 3;
HH = H;
}
if crossup(C,var4) Then {
direction = 4;
HH = H;
}
if CrossDown(C,var1) Then {
direction = -1;
LL = L;
}
if CrossDown(C,var2) Then {
direction = -2;
LL = L;
}
if CrossDown(C,var3) Then{
direction = -3;
LL = L;
}
if CrossDown(C,var4) Then {
direction = -4;
LL = L;
}
}
if H > HH Then HH = H;
if L < LL Then LL = L;
Bcond1 = (count == 0 and countif(direction == 1 and direction[1] != 1,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 1 and direction[1] != 1,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 1 and direction[1] != 1,BarsSinceExit(1)) >= 1);
Bcond2 = (count == 0 and countif(direction == 2 and direction[1] != 2,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 2 and direction[1] != 2,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 2 and direction[1] != 2,BarsSinceExit(1)) >= 1);
Bcond3 = (count == 0 and countif(direction == 3 and direction[1] != 3,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 3 and direction[1] != 3,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 3 and direction[1] != 3,BarsSinceExit(1)) >= 1);
Bcond4 = (count == 0 and countif(direction == 4 and direction[1] != 4,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 4 and direction[1] != 4,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 4 and direction[1] != 4,BarsSinceExit(1)) >= 1);
Scond1 = (count == 0 and countif(direction == -1 and direction[1] != -1,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -1 and direction[1] != -1,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -1 and direction[1] != -1,BarsSinceExit(1)) >= 1);
Scond2 = (count == 0 and countif(direction == -2 and direction[1] != -2,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -2 and direction[1] != -2,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -2 and direction[1] != -2,BarsSinceExit(1)) >= 1);
Scond3 = (count == 0 and countif(direction == -3 and direction[1] != -3,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -3 and direction[1] != -3,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -3 and direction[1] != -3,BarsSinceExit(1)) >= 1);
Scond4 = (count == 0 and countif(direction == -4 and direction[1] != -4,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -4 and direction[1] != -4,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -4 and direction[1] != -4,BarsSinceExit(1)) >= 1);
if stime > 090000 and stime < 150000 then{
if BuyCnt < 당일최대매수횟수 then{
if direction == 1 and HH >= var1+0.5 and Bcond1 == true and Bcnt1 < 매수진입별횟수 Then buy("b1",AtLimit,HH-0.4);
if direction == 2 and HH >= var2+0.5 and Bcond2 == true and Bcnt2 < 매수진입별횟수 Then buy("b2",AtLimit,HH-0.4);
if direction == 3 and HH >= var3+0.5 and Bcond3 == true and Bcnt3 < 매수진입별횟수 Then buy("b3",AtLimit,HH-0.4);
if direction == 4 and HH >= var4+0.5 and Bcond4 == true and Bcnt4 < 매수진입별횟수 Then buy("b4",AtLimit,HH-0.4);
}
if Sellcnt < 당일최대매도횟수 then{
if direction == -1 and LL <= var1-0.5 and Scond1 == true and Scnt1 < 매도진입별횟수 Then Sell("s1",AtLimit,LL+0.4);
if direction == -2 and LL <= var2-0.5 and Scond2 == true and Scnt2 < 매도진입별횟수 Then Sell("s2",AtLimit,LL+0.4);
if direction == -3 and LL <= var3-0.5 and Scond3 == true and Scnt3 < 매도진입별횟수 Then Sell("s3",AtLimit,LL+0.4);
if direction == -4 and LL <= var4-0.5 and Scond4 == true and Scnt4 < 매도진입별횟수 Then Sell("s4",AtLimit,LL+0.4);
}
}
}
답변 1
예스스탁 예스스탁 답변
2013-10-24 00:16:40
안녕하세요
예스스탁입니다.
input : 매수진입별횟수(2),매도진입별횟수(2),당일최대매수횟수(5),당일최대매도횟수(5);
var : direction(0),HH(0),LL(0),cnt(0),count(0),기준가(0);
var : Bcond1(false),Bcond2(false),Bcond3(false),Bcond4(false),Bcond5(false);
var : Scond1(false),Scond2(false),Scond3(false),Scond4(false),Scond5(false);
var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0),Didx(0);
var : Scnt1(0),Scnt2(0),Scnt3(0),Scnt4(0),Scnt5(0),Buycnt(0),Sellcnt(0);
if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{
기준가 = O;
var1 = 기준가-4.0;
var2 = 기준가-2.0;
var3 = 기준가+2.0;
var4 = 기준가+4.0;
if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{
direction = 0;
Didx = 0;
}
count = 0;
Bcnt1 = 0;Bcnt2 = 0;Bcnt3 = 0;Bcnt4 = 0;
Scnt1 = 0;Scnt2 = 0;Scnt3 = 0;Scnt4 = 0;
Buycnt = 0;
Sellcnt = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) and EntryTime(cnt) >= 090000 and EntryTime(cnt) <= 151500 Then{
count = count+1;
if IsEntryName("b1",cnt) == true Then Bcnt1 = Bcnt1+1;
if IsEntryName("b2",cnt) == true Then Bcnt2 = Bcnt2+1;
if IsEntryName("b3",cnt) == true Then Bcnt3 = Bcnt3+1;
if IsEntryName("b4",cnt) == true Then Bcnt4 = Bcnt4+1;
if IsEntryName("s1",cnt) == true Then Scnt1 = Scnt1+1;
if IsEntryName("s2",cnt) == true Then Scnt2 = Scnt2+1;
if IsEntryName("s3",cnt) == true Then Scnt3 = Scnt3+1;
if IsEntryName("s4",cnt) == true Then Scnt4 = Scnt4+1;
if MarketPosition(cnt) == 1 then
Buycnt = Buycnt+1;
if MarketPosition(cnt) == -1 then
SEllcnt = Sellcnt+1;
}
}
if stime >= 090000 and stime <= 151500 then{
Didx = Didx+1;
if Didx > 1 Then{
if crossup(C,var1) Then {
direction = 1;
HH = H;
}
if crossup(C,var2) Then {
direction = 2;
HH = H;
}
if crossup(C,var3) Then {
direction = 3;
HH = H;
}
if crossup(C,var4) Then {
direction = 4;
HH = H;
}
if CrossDown(C,var1) Then {
direction = -1;
LL = L;
}
if CrossDown(C,var2) Then {
direction = -2;
LL = L;
}
if CrossDown(C,var3) Then{
direction = -3;
LL = L;
}
if CrossDown(C,var4) Then {
direction = -4;
LL = L;
}
}
if H > HH Then HH = H;
if L < LL Then LL = L;
Bcond1 = (count == 0 and countif(direction == 1 and direction[1] != 1,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 1 and direction[1] != 1,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 1 and direction[1] != 1,BarsSinceExit(1)) >= 1);
Bcond2 = (count == 0 and countif(direction == 2 and direction[1] != 2,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 2 and direction[1] != 2,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 2 and direction[1] != 2,BarsSinceExit(1)) >= 1);
Bcond3 = (count == 0 and countif(direction == 3 and direction[1] != 3,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 3 and direction[1] != 3,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 3 and direction[1] != 3,BarsSinceExit(1)) >= 1);
Bcond4 = (count == 0 and countif(direction == 4 and direction[1] != 4,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 4 and direction[1] != 4,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 4 and direction[1] != 4,BarsSinceExit(1)) >= 1);
Scond1 = (count == 0 and countif(direction == -1 and direction[1] != -1,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -1 and direction[1] != -1,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -1 and direction[1] != -1,BarsSinceExit(1)) >= 1);
Scond2 = (count == 0 and countif(direction == -2 and direction[1] != -2,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -2 and direction[1] != -2,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -2 and direction[1] != -2,BarsSinceExit(1)) >= 1);
Scond3 = (count == 0 and countif(direction == -3 and direction[1] != -3,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -3 and direction[1] != -3,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -3 and direction[1] != -3,BarsSinceExit(1)) >= 1);
Scond4 = (count == 0 and countif(direction == -4 and direction[1] != -4,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -4 and direction[1] != -4,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -4 and direction[1] != -4,BarsSinceExit(1)) >= 1);
if stime > 090000 and stime < 150000 then{
if BuyCnt < 당일최대매수횟수 then{
if direction == 1 and HH >= var1+0.5 and Bcond1 == true and Bcnt1 < 매수진입별횟수 Then buy("b1",AtLimit,HH-0.4);
if direction == 2 and HH >= var2+0.5 and Bcond2 == true and Bcnt2 < 매수진입별횟수 Then buy("b2",AtLimit,HH-0.4);
if direction == 3 and HH >= var3+0.5 and Bcond3 == true and Bcnt3 < 매수진입별횟수 Then buy("b3",AtLimit,HH-0.4);
if direction == 4 and HH >= var4+0.5 and Bcond4 == true and Bcnt4 < 매수진입별횟수 Then buy("b4",AtLimit,HH-0.4);
}
if Sellcnt < 당일최대매도횟수 then{
if direction == -1 and LL <= var1-0.5 and Scond1 == true and Scnt1 < 매도진입별횟수 Then Sell("s1",AtLimit,LL+0.4);
if direction == -2 and LL <= var2-0.5 and Scond2 == true and Scnt2 < 매도진입별횟수 Then Sell("s2",AtLimit,LL+0.4);
if direction == -3 and LL <= var3-0.5 and Scond3 == true and Scnt3 < 매도진입별횟수 Then Sell("s3",AtLimit,LL+0.4);
if direction == -4 and LL <= var4-0.5 and Scond4 == true and Scnt4 < 매도진입별횟수 Then Sell("s4",AtLimit,LL+0.4);
}
}
}
즐거운 하루되세요
> 리치존 님이 쓴 글입니다.
> 제목 : 바쁘신대 수정 부탁드립니다
> 아래식은 야간장 시가를 기준가로 하는 매매식입니다
이식을 토대로 기준가를 주간장 당일 시가로 변경하고 싶습니다
아래식에서 야간장 시가로 되어 있는 수식은 전부 파악하여 주간장 당일 시가로 빠짐없이 변경 부탁드립니다
바쁘신대 수고가 많으시며 항상 시스템 초보들을 위해 고생 해주시는 부분 정말 감사합니다
input : 매수진입별횟수(2),매도진입별횟수(2),당일최대매수횟수(5),당일최대매도횟수(5);
var : direction(0),HH(0),LL(0),cnt(0),count(0),기준가(0);
var : Bcond1(false),Bcond2(false),Bcond3(false),Bcond4(false),Bcond5(false);
var : Scond1(false),Scond2(false),Scond3(false),Scond4(false),Scond5(false);
var : Bcnt1(0),Bcnt2(0),Bcnt3(0),Bcnt4(0),Bcnt5(0),Didx(0);
var : Scnt1(0),Scnt2(0),Scnt3(0),Scnt4(0),Scnt5(0),Buycnt(0),Sellcnt(0);
if stime == 180000 or (stime > 180000 and stime[1] < 180000) Then
기준가 = O;
var1 = 기준가-4.0;
var2 = 기준가-2.0;
var3 = 기준가+2.0;
var4 = 기준가+4.0;
if stime == 90000 or (stime > 090000 and stime[1] < 090000) Then{
direction = 0;
Didx = 0;
}
count = 0;
Bcnt1 = 0;Bcnt2 = 0;Bcnt3 = 0;Bcnt4 = 0;
Scnt1 = 0;Scnt2 = 0;Scnt3 = 0;Scnt4 = 0;
Buycnt = 0;
Sellcnt = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) and EntryTime(cnt) >= 090000 and EntryTime(cnt) <= 151500 Then{
count = count+1;
if IsEntryName("b1",cnt) == true Then Bcnt1 = Bcnt1+1;
if IsEntryName("b2",cnt) == true Then Bcnt2 = Bcnt2+1;
if IsEntryName("b3",cnt) == true Then Bcnt3 = Bcnt3+1;
if IsEntryName("b4",cnt) == true Then Bcnt4 = Bcnt4+1;
if IsEntryName("s1",cnt) == true Then Scnt1 = Scnt1+1;
if IsEntryName("s2",cnt) == true Then Scnt2 = Scnt2+1;
if IsEntryName("s3",cnt) == true Then Scnt3 = Scnt3+1;
if IsEntryName("s4",cnt) == true Then Scnt4 = Scnt4+1;
if MarketPosition(cnt) == 1 then
Buycnt = Buycnt+1;
if MarketPosition(cnt) == -1 then
SEllcnt = Sellcnt+1;
}
}
if stime >= 090000 and stime <= 151500 then{
Didx = Didx+1;
if Didx > 1 Then{
if crossup(C,var1) Then {
direction = 1;
HH = H;
}
if crossup(C,var2) Then {
direction = 2;
HH = H;
}
if crossup(C,var3) Then {
direction = 3;
HH = H;
}
if crossup(C,var4) Then {
direction = 4;
HH = H;
}
if CrossDown(C,var1) Then {
direction = -1;
LL = L;
}
if CrossDown(C,var2) Then {
direction = -2;
LL = L;
}
if CrossDown(C,var3) Then{
direction = -3;
LL = L;
}
if CrossDown(C,var4) Then {
direction = -4;
LL = L;
}
}
if H > HH Then HH = H;
if L < LL Then LL = L;
Bcond1 = (count == 0 and countif(direction == 1 and direction[1] != 1,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 1 and direction[1] != 1,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 1 and direction[1] != 1,BarsSinceExit(1)) >= 1);
Bcond2 = (count == 0 and countif(direction == 2 and direction[1] != 2,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 2 and direction[1] != 2,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 2 and direction[1] != 2,BarsSinceExit(1)) >= 1);
Bcond3 = (count == 0 and countif(direction == 3 and direction[1] != 3,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 3 and direction[1] != 3,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 3 and direction[1] != 3,BarsSinceExit(1)) >= 1);
Bcond4 = (count == 0 and countif(direction == 4 and direction[1] != 4,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == 4 and direction[1] != 4,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == 4 and direction[1] != 4,BarsSinceExit(1)) >= 1);
Scond1 = (count == 0 and countif(direction == -1 and direction[1] != -1,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -1 and direction[1] != -1,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -1 and direction[1] != -1,BarsSinceExit(1)) >= 1);
Scond2 = (count == 0 and countif(direction == -2 and direction[1] != -2,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -2 and direction[1] != -2,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -2 and direction[1] != -2,BarsSinceExit(1)) >= 1);
Scond3 = (count == 0 and countif(direction == -3 and direction[1] != -3,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -3 and direction[1] != -3,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -3 and direction[1] != -3,BarsSinceExit(1)) >= 1);
Scond4 = (count == 0 and countif(direction == -4 and direction[1] != -4,Didx) >= 1) or
(count >= 1 and MarketPosition != 0 and countif(direction == -4 and direction[1] != -4,BarsSinceEntry) >= 1) or
(count >= 1 and MarketPosition == 0 and countif(direction == -4 and direction[1] != -4,BarsSinceExit(1)) >= 1);
if stime > 090000 and stime < 150000 then{
if BuyCnt < 당일최대매수횟수 then{
if direction == 1 and HH >= var1+0.5 and Bcond1 == true and Bcnt1 < 매수진입별횟수 Then buy("b1",AtLimit,HH-0.4);
if direction == 2 and HH >= var2+0.5 and Bcond2 == true and Bcnt2 < 매수진입별횟수 Then buy("b2",AtLimit,HH-0.4);
if direction == 3 and HH >= var3+0.5 and Bcond3 == true and Bcnt3 < 매수진입별횟수 Then buy("b3",AtLimit,HH-0.4);
if direction == 4 and HH >= var4+0.5 and Bcond4 == true and Bcnt4 < 매수진입별횟수 Then buy("b4",AtLimit,HH-0.4);
}
if Sellcnt < 당일최대매도횟수 then{
if direction == -1 and LL <= var1-0.5 and Scond1 == true and Scnt1 < 매도진입별횟수 Then Sell("s1",AtLimit,LL+0.4);
if direction == -2 and LL <= var2-0.5 and Scond2 == true and Scnt2 < 매도진입별횟수 Then Sell("s2",AtLimit,LL+0.4);
if direction == -3 and LL <= var3-0.5 and Scond3 == true and Scnt3 < 매도진입별횟수 Then Sell("s3",AtLimit,LL+0.4);
if direction == -4 and LL <= var4-0.5 and Scond4 == true and Scnt4 < 매도진입별횟수 Then Sell("s4",AtLimit,LL+0.4);
}
}
}
다음글
이전글