커뮤니티
문의 드립니다
2016-10-11 18:02:39
115
글번호 102816
제가 1분봉 기준입니다. ₩
20개봉 동안 최고가가 증가하지 않을때 20개봉 중 최고가에 매수 주문을 하고 싶습니다
20개봉 동안 최저가가 감소하지 않을때 20개 봉 중 최저가로 매도 주문을 하고 싶습니다.
수식을 만들어보았지만 시스템을 돌리면 프로그램이 꺼져서 문제가 있는것 같습니다
언제나 감사합니다
var : frame(0),countt(0),cnt(0),count(0);
Array : Hval[20](0),Lval[20](0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
Frame = timetominutes(090000);
if dayindex == 0 or Frame<frame[1] then{
Hval[0] = H;
for countt = 1 to 19{
Hval[countt] = Hval[countt-1][1];
if hval == hval[19] then condition1 ==true;
}
}
if dayindex == 0 or frame <frame[1] then{
Lval[0] = L;
for countt = 1 to 19{
Lval[countt] = Lval[countt-1][1];
if Lval == Lval[19] then condition2 ==true;
}
}
if MarketPosition == 0 and count == 0
AND stime >=090000 and sTime < 141400 and condition1 ==true Then{
buy("b",AtStop,hval[0]);
}
if MarketPosition == 0 and count == 0
AND stime >=090000 and sTime < 141400 and condition2 ==true Then{
sell("s",AtStop,lval[0]);
}
SetStopProfittarget(0.5,PointStop);
SetStopLoss(0.5,PointStop);
SetStopEndofday(143000);
답변 1
예스스탁 예스스탁 답변
2016-10-12 09:06:25
안녕하세요
예스스탁입니다.
1
hval == hval[19]
배열변수에 방번호를 지정하지 않으면
어떤 방의 값을 호출하는지 알수없어 다운되게 됩니다.
아래와 같이 지정해 주셔야 합니다.
hval[0] == hval[19]
2
변수에 값의 저장은 = 입니다. == 은 같다라는 의미입니다.
if hval == hval[19] then condition1 ==true;
3
변수에 값이 한번 저장되면 다음에 다른 값이 할당되지 전까지
계속 그값을 유지하게 됩니다.
작성하신 식에서 condition1과 condition2는 false로 초기화되는 곳이 없습니다.
내용상 for문전에 false로 초기화하고 값저장되게 하셔야 합니다.
4
var : frame(0),countt(0),cnt(0),count(0);
Array : Hval[20](0),Lval[20](0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
Frame = timetominutes(090000);
if dayindex == 0 or Frame<frame[1] then{
Hval[0] = H;
Condition1 = false;
for countt = 1 to 19{
Hval[countt] = Hval[countt-1][1];
}
if hval[0] == hval[19] then
condition1 =true;
}
if dayindex == 0 or frame <frame[1] then{
Lval[0] = L;
Condition2 = false;
for countt = 1 to 19{
Lval[countt] = Lval[countt-1][1];
}
if Lval[0] == Lval[19] then
condition2 = true;
}
if MarketPosition == 0 and count == 0
AND stime >=090000 and sTime < 141400 and condition1 ==true Then{
buy("b",AtStop,hval[0]);
}
if MarketPosition == 0 and count == 0
AND stime >=090000 and sTime < 141400 and condition2 ==true Then{
sell("s",AtStop,lval[0]);
}
SetStopProfittarget(0.5,PointStop);
SetStopLoss(0.5,PointStop);
SetStopEndofday(143000);
5
문의하신 내용이시면
20개봉 동안 최고가가 증가하지 않을때 20개봉 중 최고가에 매수
20개봉 동안 최저가가 감소하지 않을때 20개 봉 중 최저가로 매도
아래와 같이 간단히 작성이 됩니다.
작성하신 수식에서 의도를 파악하기 힘든 if문과 for문이 있습니다,
아래식 참고하시기 바랍니다.
var : cnt(0),count(0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
var1 = highest(H,20);
var2 = lowest(L,20);
if MarketPosition == 0 and count == 0
AND stime >=090000 and sTime < 141400 and var1 == var1[1] Then{
buy("b",AtStop,var1);
}
if MarketPosition == 0 and count == 0
AND stime >=090000 and sTime < 141400 and var2 == var2[1] Then{
sell("s",AtStop,var2);
}
SetStopProfittarget(0.5,PointStop);
SetStopLoss(0.5,PointStop);
SetStopEndofday(143000);
즐거운 하루되세요
> 파손 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> 제가 1분봉 기준입니다. ₩
20개봉 동안 최고가가 증가하지 않을때 20개봉 중 최고가에 매수 주문을 하고 싶습니다
20개봉 동안 최저가가 감소하지 않을때 20개 봉 중 최저가로 매도 주문을 하고 싶습니다.
수식을 만들어보았지만 시스템을 돌리면 프로그램이 꺼져서 문제가 있는것 같습니다
언제나 감사합니다
var : frame(0),countt(0),cnt(0),count(0);
Array : Hval[20](0),Lval[20](0);
count = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
count = count+1;
}
Frame = timetominutes(090000);
if dayindex == 0 or Frame<frame[1] then{
Hval[0] = H;
for countt = 1 to 19{
Hval[countt] = Hval[countt-1][1];
if hval == hval[19] then condition1 ==true;
}
}
if dayindex == 0 or frame <frame[1] then{
Lval[0] = L;
for countt = 1 to 19{
Lval[countt] = Lval[countt-1][1];
if Lval == Lval[19] then condition2 ==true;
}
}
if MarketPosition == 0 and count == 0
AND stime >=090000 and sTime < 141400 and condition1 ==true Then{
buy("b",AtStop,hval[0]);
}
if MarketPosition == 0 and count == 0
AND stime >=090000 and sTime < 141400 and condition2 ==true Then{
sell("s",AtStop,lval[0]);
}
SetStopProfittarget(0.5,PointStop);
SetStopLoss(0.5,PointStop);
SetStopEndofday(143000);