안녕하세요, 비트코인 변동성 돌파전략을 개발중인데요,
당일 매매횟수가 0 이면 entry 값으로 매수를 하구요,
매매횟수가 1 이상이면 당일 고가에 매수를 하는 전략을 짜고 있습니다.
var : weight(0),entry(0),k(0);
k = iff(dayclose(1) > dayclose(2),1,0.4);
weight = (dayhigh(1) - daylow(1)) * k;
entry = weight + dayopen;
if marketposition == 0 then begin
if entriestoday(date) == 0 and h < entry then buy("Entry",atstop,entry);
else if entriestoday(date) > 0 and h < dayhigh and barssinceexit(1) > 3 then buy("Re Entry",atstop,dayhigh);
end;
if marketposition == 1 then begin
if nextbarstime == 085000 then exitlong("Exit",atmarket);
if dayopen - weight < l then exitlong("Cut",atstop,dayopen - weight);
end;
## entriestoday(사용자함수)
Input : nDate(Numeric);
Var : Count(0);
Count = 0 ;
For Value1 = 0 To 10 {
If EntryDate(Value1) == nDate Then
Count = Count + 1;
}
EntriesToday = Count;
그런데 당일 매매횟수가 0번이어서 entry 값에 매수가 들어가야 하는데 re entry, 즉 당일 고가에 매수가 들어가고 있습니다.
해결 방법 좀 알 수 있을까요?
답변 1
예스스탁
예스스탁 답변
2021-06-08 13:12:57
안녕하세요
예스스탁입니다.
사용하시는 당일진입횟수 카운트하는 식은 국내거래소 종목에만 맞는 수식입니다.
24시간 장에서는 맞지가 않습니다.
아래와 같이 수식에서 별도로 계산해 사용하셔야 합니다.
var : weight(0),entry(0),k(0);
var : DayEntryCount(0);
if Bdate != Bdate[1] Then
DayEntryCount = 0;
if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or
(MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then
DayEntryCount = DayEntryCount+1;
k = iff(dayclose(1) > dayclose(2),1,0.4);
weight = (dayhigh(1) - daylow(1)) * k;
entry = weight + dayopen;
if marketposition == 0 then
begin
if DayEntryCount == 0 and h < entry then
buy("Entry",atstop,entry);
if DayEntryCount > 0 and h < dayhigh and barssinceexit(1) > 3 then
buy("Re Entry",atstop,dayhigh);
end;
if marketposition == 1 then begin
if nextbarstime == 085000 then exitlong("Exit",atmarket);
if dayopen - weight < l then exitlong("Cut",atstop,dayopen - weight);
end;
즐거운 하루되세요
> 엠씨용가 님이 쓴 글입니다.
> 제목 : 안녕하세요 ^^
> 안녕하세요, 비트코인 변동성 돌파전략을 개발중인데요,
당일 매매횟수가 0 이면 entry 값으로 매수를 하구요,
매매횟수가 1 이상이면 당일 고가에 매수를 하는 전략을 짜고 있습니다.
var : weight(0),entry(0),k(0);
k = iff(dayclose(1) > dayclose(2),1,0.4);
weight = (dayhigh(1) - daylow(1)) * k;
entry = weight + dayopen;
if marketposition == 0 then begin
if entriestoday(date) == 0 and h < entry then buy("Entry",atstop,entry);
else if entriestoday(date) > 0 and h < dayhigh and barssinceexit(1) > 3 then buy("Re Entry",atstop,dayhigh);
end;
if marketposition == 1 then begin
if nextbarstime == 085000 then exitlong("Exit",atmarket);
if dayopen - weight < l then exitlong("Cut",atstop,dayopen - weight);
end;
## entriestoday(사용자함수)
Input : nDate(Numeric);
Var : Count(0);
Count = 0 ;
For Value1 = 0 To 10 {
If EntryDate(Value1) == nDate Then
Count = Count + 1;
}
EntriesToday = Count;
그런데 당일 매매횟수가 0번이어서 entry 값에 매수가 들어가야 하는데 re entry, 즉 당일 고가에 매수가 들어가고 있습니다.
해결 방법 좀 알 수 있을까요?