커뮤니티
수정 부탁드립니다.
2018-11-23 15:26:35
246
글번호 123835
1.
그림과 같이 지정한 시간에 당일청산이 이루어지지 않고 있습니다.
아래식의 ##당일 청산1, ##당일 청산2 두가지 모두 안되는듯 합니다.
어떤게 좋은지 몰라 두가지 적어 놓았습니다.
종목은 항셍이며 지정하는 시간, 한국시간 02시 전에 무조건 청산이 될 수 있게 요청드립니다.
##주말청산과 ##특정일청산도 다시한번 봐주시길 요청드립니다.
2. 이전봉 N(10)개의 평균 거래량이 몇 이상 조건을 추가 요청드립니다.
input : 시작시간(101800), 진입종료(002400);
input : 당일청산시간1(003300);
input : 한국주말청산1(004200) ;
input : 특정일종료날짜(20181018), 특정일종료시간(004200);
input : 손절(120), 익절1(80),익절1하락퍼센트(0.9);
var : BH(0),SL(0),HE(0),LE(0);
var : Tcond(False);
### 지표
input : P21(30), P22(70), P23(400); ## 30 60
var21 = ma(C,P21);
var22 = ma(C,P22);
var23 = ma(C,P23);
########
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
}
if stime == 진입종료 or (stime > 진입종료 and stime[1] < 진입종료) Then{
Tcond = false;
}
if Tcond == true Then{
if crossup(var22,var23)
Then
buy("매수");
if CrossDown(var22,var23)
Then
sell("매도");
}
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 then{
ExitLong("B익절1",AtStop,BH-(BH-EntryPrice)*익절1하락퍼센트);
}
ExitLong("B손절",AtStop,HE-PriceScale*손절);
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 then{
ExitShort("S익절1",AtStop,SL+(EntryPrice-SL)*익절1하락퍼센트);
}
ExitShort("S손절",AtStop,LE+PriceScale*손절);
}
##### 당일 청산 1
if 당일청산시간1 <= sTime and sTime <당일청산시간1 then {
if MarketPosition == 1 then{
ExitLong("B장종료1");
}
if MarketPosition == -1 then{
ExitShort("S장종료1");
}
}
##### 당일 청산 2
if DayOfWeek(bdate) == 1 and
((sdate != sdate[1] and stime >= 당일청산시간1) or
(sdate == sdate[1] and stime >= 당일청산시간1 and stime[1] < 당일청산시간1)) Then
{
if MarketPosition == 1 Then
ExitLong("B장종료D1");
if MarketPosition == -1 Then
ExitShort("S장종료D1");
}
#####특정일청산
if sdate == 특정일종료날짜 and
((sdate != sdate[1] and stime >= 특정일종료시간) or
(sdate == sdate[1] and stime >= 특정일종료시간 and stime[1] < 특정일종료시간)) Then
{
if MarketPosition == 1 Then
exitlong("B특정일종료");
if MarketPosition == -1 Then
ExitShort("S특정일종료");
}
#####한국주말청산
if DayOfWeek(bdate) == 5 and
((sdate != sdate[1] and stime >= 한국주말청산1) or
(sdate == sdate[1] and stime >= 한국주말청산1 and stime[1] < 한국주말청산1)) Then
{
if MarketPosition == 1 Then
ExitLong("B주말청산1");
if MarketPosition == -1 Then
ExitShort("S주말청산1");
}
- 1. 장종료.jpg (0.07 MB)
답변 1
예스스탁 예스스탁 답변
2018-11-27 10:01:30
안녕하세요?
문의하신 내용 답변드립니다.
특정 시간 지정하여 당일청산 하는 식을 조금 복잡하게 작성해 놓으셨는데,
식을 단순화 시켜서 작성해 보시는 것이 좋을것 같습니다.
[당일청산] - 1시 30분봉 완성 시점에 당일청산(틱차트이면 if stime >= 013000 then )
if stime == 013000 then {
exitlong();
exitshort();
}
[특정일 당일청산]
if sdate == 특정일종료날짜 and stime == 013000 then {
exitlong();
exitshort();
}
[주말 당일청산]
if DayOfWeek(bdate) == 5 and stime == 013000 then {
exitlong();
exitshort();
}
최근 10개봉 거래량 N이상
if Ma(V,10) > N and ~~
감사합니다.
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 수정 부탁드립니다.
> 1.
그림과 같이 지정한 시간에 당일청산이 이루어지지 않고 있습니다.
아래식의 ##당일 청산1, ##당일 청산2 두가지 모두 안되는듯 합니다.
어떤게 좋은지 몰라 두가지 적어 놓았습니다.
종목은 항셍이며 지정하는 시간, 한국시간 02시 전에 무조건 청산이 될 수 있게 요청드립니다.
##주말청산과 ##특정일청산도 다시한번 봐주시길 요청드립니다.
2. 이전봉 N(10)개의 평균 거래량이 몇 이상 조건을 추가 요청드립니다.
input : 시작시간(101800), 진입종료(002400);
input : 당일청산시간1(003300);
input : 한국주말청산1(004200) ;
input : 특정일종료날짜(20181018), 특정일종료시간(004200);
input : 손절(120), 익절1(80),익절1하락퍼센트(0.9);
var : BH(0),SL(0),HE(0),LE(0);
var : Tcond(False);
### 지표
input : P21(30), P22(70), P23(400); ## 30 60
var21 = ma(C,P21);
var22 = ma(C,P22);
var23 = ma(C,P23);
########
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
}
if stime == 진입종료 or (stime > 진입종료 and stime[1] < 진입종료) Then{
Tcond = false;
}
if Tcond == true Then{
if crossup(var22,var23)
Then
buy("매수");
if CrossDown(var22,var23)
Then
sell("매도");
}
if MarketPosition == 1 Then{
BH = highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 then{
ExitLong("B익절1",AtStop,BH-(BH-EntryPrice)*익절1하락퍼센트);
}
ExitLong("B손절",AtStop,HE-PriceScale*손절);
}
if MarketPosition == -1 Then{
SL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 then{
ExitShort("S익절1",AtStop,SL+(EntryPrice-SL)*익절1하락퍼센트);
}
ExitShort("S손절",AtStop,LE+PriceScale*손절);
}
##### 당일 청산 1
if 당일청산시간1 <= sTime and sTime <당일청산시간1 then {
if MarketPosition == 1 then{
ExitLong("B장종료1");
}
if MarketPosition == -1 then{
ExitShort("S장종료1");
}
}
##### 당일 청산 2
if DayOfWeek(bdate) == 1 and
((sdate != sdate[1] and stime >= 당일청산시간1) or
(sdate == sdate[1] and stime >= 당일청산시간1 and stime[1] < 당일청산시간1)) Then
{
if MarketPosition == 1 Then
ExitLong("B장종료D1");
if MarketPosition == -1 Then
ExitShort("S장종료D1");
}
#####특정일청산
if sdate == 특정일종료날짜 and
((sdate != sdate[1] and stime >= 특정일종료시간) or
(sdate == sdate[1] and stime >= 특정일종료시간 and stime[1] < 특정일종료시간)) Then
{
if MarketPosition == 1 Then
exitlong("B특정일종료");
if MarketPosition == -1 Then
ExitShort("S특정일종료");
}
#####한국주말청산
if DayOfWeek(bdate) == 5 and
((sdate != sdate[1] and stime >= 한국주말청산1) or
(sdate == sdate[1] and stime >= 한국주말청산1 and stime[1] < 한국주말청산1)) Then
{
if MarketPosition == 1 Then
ExitLong("B주말청산1");
if MarketPosition == -1 Then
ExitShort("S주말청산1");
}