커뮤니티
질문
2018-01-19 20:05:20
112
글번호 115935
아래수식을 이전 다른수식처럼 ETF에서 사용하고자 합니다. kodex와 kodex인버스로 나누어 걸을수 있도록 교정부탁드립니다. 감사합니다.
Inputs: Length(10), ATRs(1.5), Pval(0.05);
Variables: KUpper(0), BuySetup(False), BuyBase(0);
Variables: KLower(0), SellSetup(False), SellBase(0);
KUpper = KeltnerChannel(Close, Length, ATRs);
KLower = KeltnerChannel(Close, Length, -ATRs);
Condition1 = Crossup(Close, KUpper);
Condition2 = CrossDown(Close, KLower);
If MarketPosition() == 1 OR Close < MA(close, Length) Then
BuySetup = False;
Else
If Condition1 Then Begin
BuySetup = True;
BuyBase = High;
End;
If MarketPosition() == -1 OR Close > MA(Close, Length) Then
SellSetup = False;
Else
If Condition2 Then Begin
SellSetup = True;
SellBase = Low;
End;
//Description : Keltner Channel Long Entry
If BuySetup Then
Buy ("KC_LE", AtStop, BuyBase + Pval);
//Description : Keltner Channel Short Entry
If SellSetup Then
Sell ("KC_SE", AtStop, SellBase - Pval);
답변 1
예스스탁 예스스탁 답변
2018-01-23 10:05:21
안녕하세요
예스스탁입니다.
1.
Input : Length(10), ATRs(1.5), Pval(0.05);
Var : KUpper(0,data2), BuySetup(False,data2), BuyBase(0,data2);
Var : KLower(0,data2), SellSetup(False,data2), SellBase(0,data2);
var : cond1(false,data2),cond2(false,data2),mav(0,data2);
KUpper = data2(KeltnerChannel(Close, Length, ATRs));
KLower = data2(KeltnerChannel(Close, Length, -ATRs));
Cond1 = data2(Crossup(Close, KUpper));
Cond2 = data2(CrossDown(Close, KLower));
mav =data2(ma(C,Length));
If MarketPosition() == 1 OR data2(Close < mav) Then
BuySetup = False;
Else
If Cond1 Then Begin
BuySetup = True;
BuyBase = data2(H);
End;
if MarketPosition == 1 then
{
If Cond2 Then {
SellSetup = True;
SellBase = data2(L);
}
if data2(Close > mav) Then
SellSetup = false;
}
Else
SellSetup = false;
If BuySetup[1] == true and data2(H >= BuyBase + Pval) Then
Buy ("KC_LE");
If SellSetup[1] == true and data2(L <= SellBase - Pval) Then
ExitLong("KC_SE");
2
Input : Length(10), ATRs(1.5), Pval(0.05);
Var : KUpper(0,data2), BuySetup(False,data2), BuyBase(0,data2);
Var : KLower(0,data2), SellSetup(False,data2), SellBase(0,data2);
var : cond1(false,data2),cond2(false,data2),mav(0,data2);
KUpper = data2(KeltnerChannel(Close, Length, ATRs));
KLower = data2(KeltnerChannel(Close, Length, -ATRs));
Cond1 = data2(Crossup(Close, KUpper));
Cond2 = data2(CrossDown(Close, KLower));
mav = data2(ma(C,Length));
if MarketPosition == 1 then
{
If Cond1 Then {
BuySetup = True;
BuyBase = data2(h);
}
if data2(Close < mav) Then
BuySetup = False;
}
Else
BuySetup = False;
If MarketPosition() == 1 OR data2(Close > MAV) Then
SellSetup = False;
Else
If Cond2 Then Begin
SellSetup = True;
SellBase = data2(L);
End;
If BuySetup[1] and data2(H >= BuyBase + Pval) Then
ExitLong("KC_LE");
If SellSetup[1] and data2(L <= SellBase - Pval) Then
buy("KC_SE");
즐거운 하루되세요
> 이주엽 님이 쓴 글입니다.
> 제목 : 질문
> 아래수식을 이전 다른수식처럼 ETF에서 사용하고자 합니다. kodex와 kodex인버스로 나누어 걸을수 있도록 교정부탁드립니다. 감사합니다.
Inputs: Length(10), ATRs(1.5), Pval(0.05);
Variables: KUpper(0), BuySetup(False), BuyBase(0);
Variables: KLower(0), SellSetup(False), SellBase(0);
KUpper = KeltnerChannel(Close, Length, ATRs);
KLower = KeltnerChannel(Close, Length, -ATRs);
Condition1 = Crossup(Close, KUpper);
Condition2 = CrossDown(Close, KLower);
If MarketPosition() == 1 OR Close < MA(close, Length) Then
BuySetup = False;
Else
If Condition1 Then Begin
BuySetup = True;
BuyBase = High;
End;
If MarketPosition() == -1 OR Close > MA(Close, Length) Then
SellSetup = False;
Else
If Condition2 Then Begin
SellSetup = True;
SellBase = Low;
End;
//Description : Keltner Channel Long Entry
If BuySetup Then
Buy ("KC_LE", AtStop, BuyBase + Pval);
//Description : Keltner Channel Short Entry
If SellSetup Then
Sell ("KC_SE", AtStop, SellBase - Pval);
다음글
이전글