커뮤니티
부탁드립니다
2016-11-01 14:36:09
128
글번호 103584
조건을 모두 충족하는 수식 부탁드립니다.
- 1. 수식요청_1.JPG (0.08 MB)
- 2. 수식요청_2.JPG (0.02 MB)
답변 1
예스스탁 예스스탁 답변
2016-11-01 17:31:08
안녕하세요
예스스탁입니다.
아래 내용 참고하시기 바랍니다.
input : A틱수(10),B틱수(20),C틱수(30),A_1틱수(-10),B_1틱수(-20),C_1틱수(-30);
var : A틱(0),B틱(0),C틱(0),A_1틱(0),B_1틱(0),C_1틱(0);
var : TT(0),T1(0),entry(0),HH(0),LL(0);
A틱 = dayopen+PriceScale*A틱수;
b틱 = dayopen+PriceScale*B틱수;
c틱 = dayopen+PriceScale*C틱수;
A_1틱 = dayopen+PriceScale*A_1틱수;
b_1틱 = dayopen+PriceScale*B_1틱수;
C_1틱 = dayopen+PriceScale*C_1틱수;
TT = TotalTrades;
if Bdate != Bdate[1] Then{
T1 = TotalTrades;
HH = H;
LL = L;
}
if MarketPosition == 0 Then
entry = TT-T1;
else
entry = (TT-T1)+1;
if H > HH Then
HH = H;
if L < LL Then
LL = L;
#당일 첫진입
if entry == 0 Then{
#A_1틱보다 A틱에 먼저 도달하면 매수
if MarketPosition == 0 and HH < A틱 and LL > A_1틱 and H < A틱 Then
buy("b1",AtStop,A틱);
#A1틱보다 A_1틱에 먼저 도달하면 매도
if MarketPosition == 0 and LL > A_1틱 and HH < A틱 and L > A_1틱 Then
Sell("s1",AtStop,A_1틱);
}
#당일 첫진입 이후
if entry >= 1 Then{
#무포지션 상태에서 B틱이상 상승 후 A_1틱까지 도달하지 않은 상태에서 상승해 A틱에 도달하면 매수
if MarketPosition == 0 and highest(H,BarsSinceExit(1)) > B틱 and lowest(L,BarsSinceExit(1)) > A_1틱 and H < A틱 Then
buy("b2",AtStop,A틱);
#무포지션 상태에서 B_1틱이하로 하락 후 A틱까지 도달하지 않은 상태에서 하락해 B틱에 도달하면 매수
if MarketPosition == 0 and lowest(L,BarsSinceExit(1)) < B_1틱 and highest(H,BarsSinceExit(1)) < A틱 and L > A_1틱 Then
Sell("s2",AtStop,A_1틱);
#매수후
if MarketPosition == 1 Then{
#A_1틱 도달하면 매도로 스위칭
Sell("bs",AtStop,A_1틱);
#C틱에 도달하면 청산
exitlong("bp",Atlimit,C틱);
}
if MarketPosition == -1 Then{
#A틱 도달하면 매수로 스위칭
buy("sb",AtStop,a틱);
#C_1틱에 도달하면 청산
ExitShort("sp",Atlimit,C_1틱);
}
}
즐거운 하루되세요
> 불기둥짱 님이 쓴 글입니다.
> 제목 : 부탁드립니다
> 조건을 모두 충족하는 수식 부탁드립니다.