예스스탁
예스스탁 답변
2022-11-09 11:38:24
안녕하세요
예스스탁입니다.
if문은 봉완성시를 기준으로 합니다.
현재 올리신 수식은 봉완성시 지정한 endtime조건을 만족하는 봉이 완성되면 청산을 하게 되어 있습니다.
지정한 차트 주기에서 완성봉 기준으로 시간을 셋팅해서 사용하시는 내용이면 기존식 사용하시면 되고
봉 중간에 있는 시간이면 당일청산함수를 이용하셔야 합니다.
일반적으로는 당일청산은 아래와 같이 당일청산함수를 이용해 처리합니다.
새벽4시는 40000입니다.
현재 올리신 수식에 새벽 4시가 400000으로 지정되어 있습니다.
40시00분00초로 잘못된 내용입니다.
시간설정에 유의하시기 바랍니다.
1
input : starttime(130000),endtime(40000),n(30);
var : Tcond(false),hh(0),h1(0),ll(0),l1(0);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
hh = h;
ll = l;
h1 = hh[1];
l1 = ll[1];
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
if h > hh Then
hh = h;
if l < ll Then
ll = l;
if tcond == true and h1 > 0 and l1 > 0 then
{
if crossup(C,l1+(h1-l1)*1.236+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*1.000+PriceScale*n) Then
buy();
if crossup(C,l1-(h1-l1)*0.618+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*0.500+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*0.236+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*0.000+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*-0.236+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*-0.382+PriceScale*n) Then
buy();
if CrossDown(C,l1+(h1-l1)*1.236-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*1.000-PriceScale*n) Then
sell();
if CrossDown(C,l1-(h1-l1)*0.618-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*0.500-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*0.236-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*-0.000-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*-0.236-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*-0.382-PriceScale*n) Then
sell();
}
if MarketPosition == 1 then
{
if crossup(c,h1+PriceScale*10) Then
exitlong();
if CrossDown(c,l1-PriceScale*10) Then
exitlong();
}
if MarketPosition == -1 then
{
if crossup(c,h1+PriceScale*10) Then
ExitShort();
if CrossDown(c,l1-PriceScale*10) Then
ExitShort();
}
2
input : starttime(110000),endtime(50000),n(30),손절틱수(100);
var : Tcond(false),hh(0),h1(0),ll(0),l1(0),bentry(0),sentry(0);
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
bentry = 0;
sentry = 0;
hh = h;
ll = l;
h1 = hh[1];
l1 = ll[1];
}
if MarketPosition == 1 and MarketPosition != MarketPosition[1] Then
bentry = bentry+1;
if MarketPosition == -1 and MarketPosition != MarketPosition[1] Then
sentry = sentry+1;
if NextBarSdate == sDate Then
{
if NextBarOpen >= C Then
{
if bentry < 2 Then
Buy("b2",AtStop,NextBarOpen+PriceScale*20);
if sentry < 2 Then
Sell("s2",AtStop,NextBarOpen-PriceScale*20);
}
if NextBarOpen <= C Then
{
ExitLong("bx2",AtStop,NextBarOpen-PriceScale*10);
ExitShort ("sx2",AtStop,NextBarOpen+PriceScale*10);
}
}
if MarketPosition > 1 and sentry < 2 Then
Sell("sss",AtStop,EntryPrice-10);
if MarketPosition < -1 and bentry < 2 Then
Buy("sss1",AtStop,EntryPrice+10);
if NextBarSdate == sDate Then
{
if NextBarOpen <= C Then
{
if bentry < 2 Then
Buy("b3",AtStop,NextBarOpen+PriceScale*20);
if sentry < 2 Then
Sell("s3",AtStop,NextBarOpen-PriceScale*20);
}
if NextBarOpen >= C Then
{
ExitLong("bx3",AtStop,NextBarOpen-PriceScale*10);
ExitShort ("sx3",AtStop,NextBarOpen+PriceScale*10);
}
if MarketPosition > 1 and bentry < 2 Then
Sell("ssss",AtStop,EntryPrice-10);
if MarketPosition < -1 and sentry < 2 Then
Buy("ssss1",AtStop,EntryPrice+10); }
if NextBarSdate != sDate Then
{
if NextBarOpen <= C Then
{
if bentry < 2 Then
Buy("b4",AtStop,NextBarOpen+PriceScale*20);
if sentry < 2 Then
Sell("s4",AtStop,NextBarOpen-PriceScale*20);
}
if NextBarOpen >= C Then
{
ExitLong("bx4",AtStop,NextBarOpen-PriceScale*10);
ExitShort ("sx4",AtStop,NextBarOpen+PriceScale*10);
}
if MarketPosition > 1 and sentry < 2 Then
Sell("sssss",AtStop,EntryPrice-10);
if MarketPosition < -1 and bentry < 2 Then
Buy("sssss1",AtStop,EntryPrice+10); }
SetStopLoss(PriceScale*손절틱수,PointStop);
3
input : starttime(080000),endtime(060000),손절틱수(40);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
IF Tcond == true Then
{
if CountIf(H>H[1]and L>L[1],6) == 6 Then
Sell();
if CountIf(H<H[1]and L<L[1],4) == 4 Then
ExitShort();
}
SetStopLoss(PriceScale*손절틱수,PointStop);
4
input : starttime(080000),endtime(060000),손절틱수(40);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
IF Tcond == true Then
{
if CountIf(H<H[1]and L<L[1],6) == 6 Then
Buy();
if CountIf(H>H[1]and L>L[1],3) == 3 Then
ExitLong();
}
SetStopLoss(PriceScale*손절틱수,PointStop);
5
input : starttime(080000),endtime(060000),손절틱수(40);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
IF Tcond == true Then
{
if CountIf(H<H[1]and L<L[1],3) == 3 Then
Buy();
if CountIf(H>H[1]and L>L[1],6) == 6 Then
ExitLong();
}
SetStopLoss(PriceScale*손절틱수,PointStop);
6
input : starttime(080000),endtime(060000),손절틱수(40);
var : Tcond(false);
IF Endtime > starttime Then
SetStopEndofday(Endtime);
Else
{
if sDate != sDate[1] Then
SetStopEndofday(Endtime);
}
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
IF Endtime <= starttime Then
{
SetStopEndofday(0);
}
}
IF Tcond == true Then
{
if CountIf(H>H[1]and L>L[1],3) == 3 Then
Sell();
if CountIf(H<H[1]and L<L[1],6) == 6 Then
ExitShort();
}
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 푸른 님이 쓴 글입니다.
> 제목 : 문의 드립니다
> 1.
300분봉 매매에서 청산시간을 임의대로 지정하는게 가능한지요.
해외선물이 섬머타임으로 8시 시작이면 특정시간을 지정해서 청산식이 안될듯하고
300분봉의 특성상 5시간 마디로 시간설정을해서 청산시간이 정해지는거
아닌가 생각해서 문의드립니다.
아래 수식어에서
매매시간 (13 :00 ~ 익일 04 :00 ) , 청산시간 익일 04 :00
포함한 수식어로 부탁드립니다.
input : starttime(130000),endtime(400000),n(30);
var : Tcond(false),hh(0),h1(0),ll(0),l1(0);
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
hh = h;
ll = l;
h1 = hh[1];
l1 = ll[1];
}
if h > hh Then
hh = h;
if l < ll Then
ll = l;
if tcond == true and h1 > 0 and l1 > 0 then
{
if crossup(C,l1+(h1-l1)*1.236+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*1.000+PriceScale*n) Then
buy();
if crossup(C,l1-(h1-l1)*0.618+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*0.500+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*0.236+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*0.000+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*-0.236+PriceScale*n) Then
buy();
if crossup(C,l1+(h1-l1)*-0.382+PriceScale*n) Then
buy();
if CrossDown(C,l1+(h1-l1)*1.236-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*1.000-PriceScale*n) Then
sell();
if CrossDown(C,l1-(h1-l1)*0.618-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*0.500-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*0.236-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*-0.000-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*-0.236-PriceScale*n) Then
sell();
if CrossDown(C,l1+(h1-l1)*-0.382-PriceScale*n) Then
sell();
}
if MarketPosition == 1 then
{
if crossup(c,h1+PriceScale*10) Then
exitlong();
if CrossDown(c,l1-PriceScale*10) Then
exitlong();
}
if MarketPosition == -1 then
{
if crossup(c,h1+PriceScale*10) Then
ExitShort();
if CrossDown(c,l1-PriceScale*10) Then
ExitShort();
}
2.
아래 수식어는 180분봉 매매자료입니다.
매수 매도 각각 진입2회및 손절 100틱을 추가로 부탁드립니다.
input : starttime(110000),endtime(500000),n(30);
var : Tcond(false),hh(0),h1(0),ll(0),l1(0);
if (sdate != sdate[1] and stime >= endtime) or
(sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then
{
Tcond = false;
if MarketPosition == 1 Then
ExitLong("bx");
if MarketPosition == -1 Then
ExitShort("sx");
}
if (sdate != sdate[1] and stime >= starttime) or
(sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then
{
Tcond = true;
hh = h;
ll = l;
h1 = hh[1];
l1 = ll[1];
}
if NextBarSdate == sDate Then
{
if NextBarOpen >= C Then
{
Buy("b2",AtStop,NextBarOpen+PriceScale*20);
Sell("s2",AtStop,NextBarOpen-PriceScale*20);
}
if NextBarOpen <= C Then
{
ExitLong("bx2",AtStop,NextBarOpen-PriceScale*10);
ExitShort ("sx2",AtStop,NextBarOpen+PriceScale*10);
}
}
if MarketPosition > 1 Then
Sell("sss",AtStop,EntryPrice-10);
if MarketPosition < -1 Then
Buy("sss1",AtStop,EntryPrice+10);
if NextBarSdate == sDate Then
{
if NextBarOpen <= C Then
{
Buy("b3",AtStop,NextBarOpen+PriceScale*20);
Sell("s3",AtStop,NextBarOpen-PriceScale*20);
}
if NextBarOpen >= C Then
{
ExitLong("bx3",AtStop,NextBarOpen-PriceScale*10);
ExitShort ("sx3",AtStop,NextBarOpen+PriceScale*10);
}
if MarketPosition > 1 Then
Sell("ssss",AtStop,EntryPrice-10);
if MarketPosition < -1 Then
Buy("ssss1",AtStop,EntryPrice+10); }
if NextBarSdate != sDate Then
{
if NextBarOpen <= C Then
{
Buy("b4",AtStop,NextBarOpen+PriceScale*20);
Sell("s4",AtStop,NextBarOpen-PriceScale*20);
}
if NextBarOpen >= C Then
{
ExitLong("bx4",AtStop,NextBarOpen-PriceScale*10);
ExitShort ("sx4",AtStop,NextBarOpen+PriceScale*10);
}
if MarketPosition > 1 Then
Sell("sssss",AtStop,EntryPrice-10);
if MarketPosition < -1 Then
Buy("sssss1",AtStop,EntryPrice+10); }
3.
해외선물매매에서 150분봉 캔들의 완성시 고점과 저점이 높아지는 150분봉 캔들이
6회 상승시 매도 , 150분봉 캔들 고점 저점이 낮아지는 4회 하락시 청산되는 수식어
손절40틱 매매시간 08:00~익일 06:00 미청산시 익일 06:00시 동시청산
4.
해외선물매매에서 150분봉 캔들의 완성시 고점과 저점이 낮아지는 150분봉 캔들이
6회 하락시 매수 , 150분봉 캔들 고점 저점이 높아지는 3회 상승시 청산되는 수식어
손절40틱 매매시간 08:00~익일 06:00 미청산시 익일 06:00시 동시청산
5.
해외선물매매에서 150분봉 캔들의 완성시 고점과 저점이 낮아지는 150분봉 캔들이
3회 하락시 매수 , 150분봉 캔들 고점 저점이 높아지는 6회 상승시 청산되는 수식어
손절40틱 매매시간 08:00~익일 06:00 미청산시 익일 06:00시 동시청산
6.
해외선물매매에서 150분봉 캔들의 완성시 고점과 저점이 낮아지는 150분봉 캔들이
3회 상승시 매도 , 150분봉 캔들 고점 저점이 낮아지는 6회 하락시 청산되는 수식어
손절40틱 매매시간 08:00~익일 06:00 미청산시 06:00시 동시청산