커뮤니티
문의드립니다
2015-07-21 00:41:21
110
글번호 88693
안녕하세요
해외선물(Crude oil 종목 적용)
파라볼릭지표와 누적손익을 이용한 시스템식 부탁드립니다.
매매횟수 = 1차 진입 1회, 2차 진입 1회
진입조건= 당일 파라볼릭(0.1)이 Cross UP or Cross Down 한적이 있다.
------------------------------------------
Input : af(0.01), maxAF(0.1),af1(0.02), maxAF1(0.2);
Var : value(0),value1(0);
value = sar(af,maxAF);
value1 = sar(af1,maxAF1);
1차 진입조건=진입조건을 만족하고 C > value and C > value1 일때는 buy("매수1")로진입,
C < value and C < value1 일때는 sell("매도1")로진입
1차 청산조건 = a) 매수1청산은 C < value and C < value1 or 진입후 수익률에 따라
Trailing stop 적용 (아래수식적용)
b) 매도1청산은 매수청산의 반대
c) 매수1또는 매도1 청산후 수익이 +로 발생되면 당일 장종료
input : 수익률1(20),감소1(10),수익률2(30),감소2(20);
var : HH(0),LL(0);
if MarketPosition == 1 Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice*(1+수익률1/100) and HH < EntryPrice*(1+수익률2/100) Then
ExitLong("bx1",AtStop,HH*(1-감소1/100));
if HH >= EntryPrice*(1+수익률2/100) Then
ExitLong("bx2",AtStop,HH*(1-감소2/100));
}
if MarketPosition == -1 Then{
LL = Lowest(L,BarsSinceEntry);
if LL <= EntryPrice*(1-수익률1/100) and LL > EntryPrice*(1-수익률2/100) Then
ExitShort("sx1",AtStop,LL*(1+감소1/100));
if LL <= EntryPrice*(1+수익률2/100) Then
ExitShort("sx2",AtStop,LL*(1+감소2/100));
}
## 상기식에서 사용된 수익률및 감소를 N틱 이상이면 N1틱 감소로 변경하여
별도로 추가작성하여 주세요.
% 와 틱 비교하여 사용하고자합니다.
===================================================================================
2차 진입조건 = a)1차 진입조건과 동일(매수2 or 매도2)
b) 1차 청산에서 손실이 발생된 경우만 진입.
2차 청산조건 = a)1차 청산에서 발생된 손실만큼 수익이발생되면 Trailing stop적용
(최고가,저가 대비 N 틱 청산)
b) 매수2청산은 C < value and C < value1
매도2청산은 C > value and C > value1
a or b 일때 청산
==> 포지션 보유시 당일 장종료(16시)에 일괄청산.
감사합니다.
답변 1
예스스탁 예스스탁 답변
2015-07-21 11:44:14
안녕하세요
예스스탁입니다.
1.%
Input : af(0.01), maxAF(0.1),af1(0.02), maxAF1(0.2);
Var : value(0),value1(0);
input : 수익률1(20),감소1(10),수익률2(30),감소2(20),N2(5);
var : HH(0),LL(0),entry(0),Start(false);
value = sar(af,maxAF);
value1 = sar(af1,maxAF1);
if Bdate != Bdate[1] Then{
Start = true;
Condition1 = false;
Condition2 = false;
entry = 0;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if crossup(value,value1) Then
Condition1 = true;
if CrossDown(value,value1) Then
Condition2 = true;
if Start == true then{
if entry == 0 and MarketPosition == 0 and Condition1 == true and C > value and C > value1 Then
buy("매수1");
if entry == 0 and MarketPosition == 0 and Condition2 == true and C > value and C > value1 Then
sell("매도1");
if entry == 1 and PositionProfit(1) < 0 and MarketPosition == 0 and Condition1 == true and C > value and C > value1 Then
buy("매수2");
if entry == 1 and PositionProfit(1) < 0 and MarketPosition == 0 and Condition2 == true and C > value and C > value1 Then
sell("매도2");
}
if MarketPosition == 1 and IsEntryName("매수1") == true Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice*(1+수익률1/100) and HH < EntryPrice*(1+수익률2/100) Then
ExitLong("bx11",AtStop,HH*(1-감소1/100));
if HH >= EntryPrice*(1+수익률2/100) Then
ExitLong("bx12",AtStop,HH*(1-감소2/100));
if C < value and C < value1 Then
exitlong("bx13");
}
if MarketPosition == -1 and IsEntryName("매도1") == true Then{
LL = Lowest(L,BarsSinceEntry);
if LL <= EntryPrice*(1-수익률1/100) and LL > EntryPrice*(1-수익률2/100) Then
ExitShort("sx11",AtStop,LL*(1+감소1/100));
if LL <= EntryPrice*(1-수익률2/100) Then
ExitShort("sx12",AtStop,LL*(1+감소2/100));
if C > value and C > value1 Then
ExitShort("sx13");
}
if MarketPosition == 1 and IsEntryName("매수2") == true Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice+abs(PositionProfit(1)) Then
ExitLong("bx21",AtStop,HH-PriceScale*N2);
if C < value and C < value1 Then
exitlong("bx22");
}
if MarketPosition == -1 and IsEntryName("매도2") == true Then{
LL = Lowest(L,BarsSinceEntry);
if LL <= EntryPrice-abs(PositionProfit(1)) Then
ExitShort("sx21",AtStop,LL+PriceScale*N2);
if C > value and C > value1 Then
ExitShort("sx22");
}
if stime == 060000 or (stime > 060000 and stime[1] < 060000) Then{
Start = false;
exitlong();
ExitShort();
}
2.틱
Input : af(0.01), maxAF(0.1),af1(0.02), maxAF1(0.2);
Var : value(0),value1(0);
input : 수익률틱1(20),감소틱1(10),수익률틱2(30),감소틱2(20),N2(5);
var : HH(0),LL(0),entry(0),Start(false);
value = sar(af,maxAF);
value1 = sar(af1,maxAF1);
if Bdate != Bdate[1] Then{
Start = true;
Condition1 = false;
Condition2 = false;
entry = 0;
}
if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then
entry = entry+1;
if crossup(value,value1) Then
Condition1 = true;
if CrossDown(value,value1) Then
Condition2 = true;
if Start == true then{
if entry == 0 and MarketPosition == 0 and Condition1 == true and C > value and C > value1 Then
buy("매수1");
if entry == 0 and MarketPosition == 0 and Condition2 == true and C > value and C > value1 Then
sell("매도1");
if entry == 1 and PositionProfit(1) < 0 and MarketPosition == 0 and Condition1 == true and C > value and C > value1 Then
buy("매수2");
if entry == 1 and PositionProfit(1) < 0 and MarketPosition == 0 and Condition2 == true and C > value and C > value1 Then
sell("매도2");
}
if MarketPosition == 1 and IsEntryName("매수1") == true Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice+PriceScale*수익률틱1 and HH < EntryPrice+PriceScale*수익률틱2 Then
ExitLong("bx11",AtStop,HH-PriceScale*감소틱1);
if HH >= EntryPrice+PriceScale*수익률틱2 Then
ExitLong("bx12",AtStop,HH-PriceScale*감소틱2);
if C < value and C < value1 Then
exitlong("bx13");
}
if MarketPosition == -1 and IsEntryName("매도1") == true Then{
LL = Lowest(L,BarsSinceEntry);
if LL <= EntryPrice-PriceScale*수익률틱1 and LL > EntryPrice-PriceScale*수익률틱2 Then
ExitShort("sx11",AtStop,LL+PriceScale*감소틱1);
if LL <= EntryPrice-PriceScale*수익률틱2 Then
ExitShort("sx12",AtStop,LL+PriceScale*감소틱2);
if C > value and C > value1 Then
ExitShort("sx13");
}
if MarketPosition == 1 and IsEntryName("매수2") == true Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice+abs(PositionProfit(1)) Then
ExitLong("bx21",AtStop,HH-PriceScale*N2);
if C < value and C < value1 Then
exitlong("bx22");
}
if MarketPosition == -1 and IsEntryName("매도2") == true Then{
LL = Lowest(L,BarsSinceEntry);
if LL <= EntryPrice-abs(PositionProfit(1)) Then
ExitShort("sx21",AtStop,LL+PriceScale*N2);
if C > value and C > value1 Then
ExitShort("sx22");
}
if stime == 060000 or (stime > 060000 and stime[1] < 060000) Then{
Start = false;
exitlong();
ExitShort();
}
즐거운 하루되세요
> 베드로 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 안녕하세요
해외선물(Crude oil 종목 적용)
파라볼릭지표와 누적손익을 이용한 시스템식 부탁드립니다.
매매횟수 = 1차 진입 1회, 2차 진입 1회
진입조건= 당일 파라볼릭(0.1)이 Cross UP or Cross Down 한적이 있다.
------------------------------------------
Input : af(0.01), maxAF(0.1),af1(0.02), maxAF1(0.2);
Var : value(0),value1(0);
value = sar(af,maxAF);
value1 = sar(af1,maxAF1);
1차 진입조건=진입조건을 만족하고 C > value and C > value1 일때는 buy("매수1")로진입,
C < value and C < value1 일때는 sell("매도1")로진입
1차 청산조건 = a) 매수1청산은 C < value and C < value1 or 진입후 수익률에 따라
Trailing stop 적용 (아래수식적용)
b) 매도1청산은 매수청산의 반대
c) 매수1또는 매도1 청산후 수익이 +로 발생되면 당일 장종료
input : 수익률1(20),감소1(10),수익률2(30),감소2(20);
var : HH(0),LL(0);
if MarketPosition == 1 Then{
HH = highest(H,BarsSinceEntry);
if HH >= EntryPrice*(1+수익률1/100) and HH < EntryPrice*(1+수익률2/100) Then
ExitLong("bx1",AtStop,HH*(1-감소1/100));
if HH >= EntryPrice*(1+수익률2/100) Then
ExitLong("bx2",AtStop,HH*(1-감소2/100));
}
if MarketPosition == -1 Then{
LL = Lowest(L,BarsSinceEntry);
if LL <= EntryPrice*(1-수익률1/100) and LL > EntryPrice*(1-수익률2/100) Then
ExitShort("sx1",AtStop,LL*(1+감소1/100));
if LL <= EntryPrice*(1+수익률2/100) Then
ExitShort("sx2",AtStop,LL*(1+감소2/100));
}
## 상기식에서 사용된 수익률및 감소를 N틱 이상이면 N1틱 감소로 변경하여
별도로 추가작성하여 주세요.
% 와 틱 비교하여 사용하고자합니다.
===================================================================================
2차 진입조건 = a)1차 진입조건과 동일(매수2 or 매도2)
b) 1차 청산에서 손실이 발생된 경우만 진입.
2차 청산조건 = a)1차 청산에서 발생된 손실만큼 수익이발생되면 Trailing stop적용
(최고가,저가 대비 N 틱 청산)
b) 매수2청산은 C < value and C < value1
매도2청산은 C > value and C > value1
a or b 일때 청산
==> 포지션 보유시 당일 장종료(16시)에 일괄청산.
감사합니다.
다음글
이전글