안녕하세요?
아래수식에 당일청산(setendofday)을 적용하면 진입을 빼먹는 경우가 생깁니다.
즉 해외선물에서 오늘 아침 055500에 당일청산되고, 첫번째 진입신호가 나오지 않습니다.
당일청산(setendofday)제거하면 정상적으로 진입됩니다.
수정부탁드리겠습니다.
감사합니다.
var : bentry(0,data1),sentry(0,data1);
var : H3(0,data3),H5(0,data5);
if data1(bdate != bdate[1]) Then
{
bentry = 0;
sentry = 0;
}
if MarketPosition(0) == 1 and MarketPosition(0) != MarketPosition(0)[1] Then
bentry = bentry+1;
if MarketPosition(0) == -1 and MarketPosition(0) != MarketPosition(0)[1] Then
sentry = sentry+1;
if data3(bdate != bdate[1]) Then
H3 = data3(H);
if data3(H) > H3 Then
H3 = data3(H);
if data5(bdate != bdate[1]) Then
H5 = Data5(H);
if data5(H) > H5 Then
H5 = data5(H);
if bentry < 1 and data2(C) <= H3 and DayHigh-PriceScale*10 > C and C < O Then
buy("bb");
if bentry < 1 and data2(C) <= H3 and DayOpen-PriceScale*10 > C and C < O Then
buy("b");
if sentry < 1 and data4(C) <= H5 and DayOpen+PriceScale*10 < C and C > O Then
sell("s");
if sentry < 1 and data4(C) <= H5 and DayLow+PriceScale*10 < C and C > O Then
sell("ss");
////////////////////////////////////////////////////////////////////////////////////////////
if MarketPosition == 1 then
{
if bentry < 1 and CrossDown(data2(C),H3) Then
ExitLong("bx");
}
///////////////////////////////////////////////////////////////////////////////////////////
if MarketPosition == -1 then
{
if sentry < 1 and CrossDown(data4(C),H5) Then
ExitShort("sx");
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
if MarketPosition == 1 then
{
if data1(highest(H,BarsSinceEntry)) >= EntryPrice+PriceScale*1 Then
ExitLong("bxx",AtStop,data1(highest(H,BarsSinceEntry))-PriceScale*100);
}
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
if MarketPosition == -1 then
{
if data1(Lowest(L,BarsSinceEntry)) <= EntryPrice-PriceScale*1 Then
ExitShort("sxx",AtStop,data1(Lowest(L,BarsSinceEntry))+PriceScale*100);
}
//////////////////////////////////////////////////////////////////////////////////////////
setendofday(055500);
답변 1
예스스탁
예스스탁 답변
2019-10-30 14:29:55
안녕하세요
예스스탁입니다.
SetStopEndofday는 당일청산 함수로 지정한 시간이후에 밤 0시까지 진입을 막게 됩니다.
해외선물에서 새벽에 청산하시거나
국내선물 복합장에서 새벽에 청산하실때는
당일청산을 아래와 같이 설정하셔야 하니다.
if sdate != sdate[1] then
SetStopEndofday(055500);
if bdate != bdate[1] then
SetStopEndofday(0);
즐거운 하루되세요
> 하늘북 님이 쓴 글입니다.
> 제목 : 문의드립니다.
> 안녕하세요?
아래수식에 당일청산(setendofday)을 적용하면 진입을 빼먹는 경우가 생깁니다.
즉 해외선물에서 오늘 아침 055500에 당일청산되고, 첫번째 진입신호가 나오지 않습니다.
당일청산(setendofday)제거하면 정상적으로 진입됩니다.
수정부탁드리겠습니다.
감사합니다.
var : bentry(0,data1),sentry(0,data1);
var : H3(0,data3),H5(0,data5);
if data1(bdate != bdate[1]) Then
{
bentry = 0;
sentry = 0;
}
if MarketPosition(0) == 1 and MarketPosition(0) != MarketPosition(0)[1] Then
bentry = bentry+1;
if MarketPosition(0) == -1 and MarketPosition(0) != MarketPosition(0)[1] Then
sentry = sentry+1;
if data3(bdate != bdate[1]) Then
H3 = data3(H);
if data3(H) > H3 Then
H3 = data3(H);
if data5(bdate != bdate[1]) Then
H5 = Data5(H);
if data5(H) > H5 Then
H5 = data5(H);
if bentry < 1 and data2(C) <= H3 and DayHigh-PriceScale*10 > C and C < O Then
buy("bb");
if bentry < 1 and data2(C) <= H3 and DayOpen-PriceScale*10 > C and C < O Then
buy("b");
if sentry < 1 and data4(C) <= H5 and DayOpen+PriceScale*10 < C and C > O Then
sell("s");
if sentry < 1 and data4(C) <= H5 and DayLow+PriceScale*10 < C and C > O Then
sell("ss");
////////////////////////////////////////////////////////////////////////////////////////////
if MarketPosition == 1 then
{
if bentry < 1 and CrossDown(data2(C),H3) Then
ExitLong("bx");
}
///////////////////////////////////////////////////////////////////////////////////////////
if MarketPosition == -1 then
{
if sentry < 1 and CrossDown(data4(C),H5) Then
ExitShort("sx");
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
if MarketPosition == 1 then
{
if data1(highest(H,BarsSinceEntry)) >= EntryPrice+PriceScale*1 Then
ExitLong("bxx",AtStop,data1(highest(H,BarsSinceEntry))-PriceScale*100);
}
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
if MarketPosition == -1 then
{
if data1(Lowest(L,BarsSinceEntry)) <= EntryPrice-PriceScale*1 Then
ExitShort("sxx",AtStop,data1(Lowest(L,BarsSinceEntry))+PriceScale*100);
}
//////////////////////////////////////////////////////////////////////////////////////////
setendofday(055500);