커뮤니티
[STAD_02] Opening Gap
2014-06-06 21:13:53
215
글번호 75651
2. 전략내용
//매수진입
일봉상의 이평이 정배열이고 첫봉의 종가가 전일 일봉상의 저가보다 낮으면 매수 (A문장)
일봉상의 이평이 역배열이고 첫봉의 종가가 전일 일봉상의 저가보다 낮으면 N봉 최고가 돌파시 매수 (B문장)
input : P1(20), p2(40);
input : HLperiod(20), ARmult(4), Div(40);
Var: StopPrice(0), BullTrend(false), BearTrend(true);
Var: SellOnSwingHigh(false), BuyOnSwingLow(false), MP(0);
var : sumV1(0), sumV2(0), ShortDayAvg(0), LongDayAvg(0), count(0);
##분봉에서 일봉이평을 구함
sumV1 = 0;
sumV2 = 0;
for count = 0 to p2-1 {
if count < p1 then
sumV1 = sumV1 + DayClose(count);
if count < p2 then
sumV2 = sumV2 + DayClose(count);
}
ShortDayAvg = sumV1 / P1; //분봉에서 일봉20일 이평
LongDayAvg = sumV2 / P2; //분봉에서 일봉40일 이평
##
BullTrend = ShortDayAvg >= LongDayAvg;
BearTrend = ShortDayAvg < LongDayAvg;
If Date <> Date[1] then {
SellOnSwingHigh = False;
BuyOnSwingLow = False;
-------------------------------------------------------------
If BullTrend then {
If Close < dayLow(1) and C > dayOpen then {
Buy();
BuyOnSwingLow = True; A열
}
If Close > dayHIgh(1) then
SellOnSwingHigh = True;
}
--------------------------------------------------------------------------
일봉상의 이평이 정배열이고 첫봉의 종가가 전일 일봉상의 저가보다 낮으면 매수 (A문장)
If BearTrend then {
If Close > dayHIgh(1) and C < dayOPen then {
Sell();
SellOnSwingHigh = True;
}
If Close < dayLow(1) then
BuyOnSwingLow = True; B열
}
}
---------------------------------------------------------------
If date == date[1] Then {
If SellOnSwingHigh then
Sell("Sell",atstop, lowest(L,HLPeriod));;
If BuyOnSwingLow then C열
Buy("Buy",atstop,highest(H,HLPeriod));
--------------------------------------------------------------------
일봉상의 이평이 역배열이고 첫봉의 종가가 전일 일봉상의 저가보다 낮으면 N봉 최고가 돌파시 매수(B문장)
*질문입니다
A열의 BuyOnSwingLow = True; 는 삭제해야지 맞는거 아닌가요? 왜냐하면
B열의 BuyOnSwingLow = True; 가 C열의 If BuyOnSwingLow then 을 충족시키기
때문에 굳이 A열의 BuyOnSwingLow = True; 가 있을 이유가 있는지 궁금합니다
If MarketPosition == -1 then
SellOnSwingHigh = false;
If MarketPosition == 1 then
BuyOnSwingLow = false;
}
MP = MarketPosition;
if MP == 1 and MP[1] <> 1 then
StopPrice = low - ma(range,40)*ARmult;
if MP == -1 and MP[1] <> -1 then
StopPrice = High + ma(range,40)*ARmult;
If MP == 1 then {
exitlong ("ExitLong", atstop, stopprice );
stopprice = stopprice + (low-stopprice)/Div;
}
If MP == -1 then {
exitshort ("ExitShort",atstop, stopprice );
stopprice = stopprice - (stopprice-high)/Div;
}
setstoploss(2.0);
SetStopEndofday(1500);
답변 1
예스스탁 예스스탁 답변
2014-06-09 11:46:41
안녕하세요
예스스탁입니다.
Buy("Buy",atstop,highest(H,HLPeriod));
위 신호는 당일 첫봉이
정배열+Close < dayLow(1) and C > dayOpen 조건이 만족하거나
역배열+Close < dayLow(1) 조건이 만족하면
발생이 허용한다는 내용입니다.
A열이 없으면 당일 첫봉에서 매수가 나오고
이후 매도로 스위칭이 되고
다시 상승추세시 매수로 스위칭을 하지 못합니다.
즐거운 하루되세요
> cinamon 님이 쓴 글입니다.
> 제목 : [STAD_02] Opening Gap
> 2. 전략내용
//매수진입
일봉상의 이평이 정배열이고 첫봉의 종가가 전일 일봉상의 저가보다 낮으면 매수 (A문장)
일봉상의 이평이 역배열이고 첫봉의 종가가 전일 일봉상의 저가보다 낮으면 N봉 최고가 돌파시 매수 (B문장)
input : P1(20), p2(40);
input : HLperiod(20), ARmult(4), Div(40);
Var: StopPrice(0), BullTrend(false), BearTrend(true);
Var: SellOnSwingHigh(false), BuyOnSwingLow(false), MP(0);
var : sumV1(0), sumV2(0), ShortDayAvg(0), LongDayAvg(0), count(0);
##분봉에서 일봉이평을 구함
sumV1 = 0;
sumV2 = 0;
for count = 0 to p2-1 {
if count < p1 then
sumV1 = sumV1 + DayClose(count);
if count < p2 then
sumV2 = sumV2 + DayClose(count);
}
ShortDayAvg = sumV1 / P1; //분봉에서 일봉20일 이평
LongDayAvg = sumV2 / P2; //분봉에서 일봉40일 이평
##
BullTrend = ShortDayAvg >= LongDayAvg;
BearTrend = ShortDayAvg < LongDayAvg;
If Date <> Date[1] then {
SellOnSwingHigh = False;
BuyOnSwingLow = False;
-------------------------------------------------------------
If BullTrend then {
If Close < dayLow(1) and C > dayOpen then {
Buy();
BuyOnSwingLow = True; A열
}
If Close > dayHIgh(1) then
SellOnSwingHigh = True;
}
--------------------------------------------------------------------------
일봉상의 이평이 정배열이고 첫봉의 종가가 전일 일봉상의 저가보다 낮으면 매수 (A문장)
If BearTrend then {
If Close > dayHIgh(1) and C < dayOPen then {
Sell();
SellOnSwingHigh = True;
}
If Close < dayLow(1) then
BuyOnSwingLow = True; B열
}
}
---------------------------------------------------------------
If date == date[1] Then {
If SellOnSwingHigh then
Sell("Sell",atstop, lowest(L,HLPeriod));;
If BuyOnSwingLow then C열
Buy("Buy",atstop,highest(H,HLPeriod));
--------------------------------------------------------------------
일봉상의 이평이 역배열이고 첫봉의 종가가 전일 일봉상의 저가보다 낮으면 N봉 최고가 돌파시 매수(B문장)
*질문입니다
A열의 BuyOnSwingLow = True; 는 삭제해야지 맞는거 아닌가요? 왜냐하면
B열의 BuyOnSwingLow = True; 가 C열의 If BuyOnSwingLow then 을 충족시키기
때문에 굳이 A열의 BuyOnSwingLow = True; 가 있을 이유가 있는지 궁금합니다
If MarketPosition == -1 then
SellOnSwingHigh = false;
If MarketPosition == 1 then
BuyOnSwingLow = false;
}
MP = MarketPosition;
if MP == 1 and MP[1] <> 1 then
StopPrice = low - ma(range,40)*ARmult;
if MP == -1 and MP[1] <> -1 then
StopPrice = High + ma(range,40)*ARmult;
If MP == 1 then {
exitlong ("ExitLong", atstop, stopprice );
stopprice = stopprice + (low-stopprice)/Div;
}
If MP == -1 then {
exitshort ("ExitShort",atstop, stopprice );
stopprice = stopprice - (stopprice-high)/Div;
}
setstoploss(2.0);
SetStopEndofday(1500);
다음글
이전글