답변완료
DMI 값 세부공식 문의
다른증권사와 DMI 값이 차이가 있어 문의를 하여 알려주신
키움수식의 답변의 값이 실제 키움 HTS의 지표의 값과 차이가 있습니다.
그래서 키움의 함수 설명 확인해보니 알려주신 수식과 일치합니다.
혹시 짐작되시는 부분 있으면 알려주시면 감사하겠습니다.
다른 증권사에서도 예스랭귀지의 DMI 값을 사용하고 싶습니다.
예스랭귀지에서 적용하는
ADX
DiPlus
DiMinus
세부공식을 알려주시면 감사하겠습니다.
//-----------------------------------------------------
// 알려주신 키움 세부공식
input : Period(10);
var : Plus(0),Minus(0),adxv(0);
plus = Ema(iff(H-H[1]>0 && H-H[1]>L[1]-L,H-H[1],0),Period)/
Ema(max(max(H-L,abs(C[1]-H)),abs(C[1]-L)),Period)*100;
Minus = ema(iff(L[1]-L>0 && H-H[1]<L[1]-L,L[1]-L,0),Period)/
ema(max(max(H-L,abs(C[1]-H)),abs(C[1]-L)),Period)*100;
adxv = Ema(abs(plus-Minus)/(plus+Minus),period)*100;
plot1(plus);
plot2(minus);
plot3(adxv);
//-----------------------------------------------------
2021-01-06
518
글번호 145161
지표
답변완료
시스템 수정
자주 질문드려 죄송합니다
수정해주신 수식을 확인해보니 제가 의도한대로 적용되고 있는것 같습니다
그런데 아래의 올려주신 수식이 1번식과 2번식이 있는데요
수식을 여러차례 확인해보아도 차이점이 없는것 같아
다시한번 질문드려봅니다.
확인부탁드리면 감사하겠습니다
------------------------------------------------
안녕하세요
예스스탁입니다.
1번식은 매수1,매수2,매수3 중에 한개이상 진입하고
최저가 진입가에서 3%,5%,10%에서 매수4,매수5,매수6으로 추가 진입합니다.
만약 매수1,매수2,매수3이 모두 진입한 이후에
3개진입의 최저가에서 3%,5%,10%에서 매수4,매수5,매수6으로 추가 진입을 원하시면
2번식 이용하시면 됩니다.
1
INPUT : 매수(0), 매도조건(1);
var : cond(False),LP(0);
var1 = ma(C,3);
var2 = ma(C,5);
var3 = ma(C,10);
var4 = ma(C,60);
value1 = 0;
if value1 == 0 and C < Var4 and CrossDown(c,var3) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수3");
}
}
if value1 == 0 and C < var4 and CrossDown(c,var2) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수2");
}
}
if value1 == 0 and C < Var4 and CrossDown(c,var1) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수1");
}
}
if MarketPosition == 1 Then
{
if 매수 == 1 Then
Cond = true;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수1" Then
{
if LP == 0 or (LP > 0 and LatestEntryPrice(0) < LP) Then
LP = LatestEntryPrice(0);
Condition1 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수2" Then
{
if LP == 0 or (LP > 0 and LatestEntryPrice(0) < LP) Then
LP = LatestEntryPrice(0);
Condition2 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수3" Then
{
if LP == 0 or (LP > 0 and LatestEntryPrice(0) < LP) Then
LP = LatestEntryPrice(0);
Condition3 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수4" Then
{
Condition4 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수5" Then
{
Condition5 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수6" Then
{
Condition6 = true;
}
if Condition3 == true or Condition2 == true or Condition1 == true Then
{
if Condition4 == False Then
Buy("매수4",AtLimit,LP*0.97);
if Condition4 == true and Condition5 == False Then
Buy("매수5",AtLimit,LP*0.95);
if Condition4 == true and Condition5 == true and Condition6 == False Then
Buy("매수6",AtLimit,LP*0.90);
}
if 매도조건 == 1 Then
{
ExitLong("bx1",AtLimit,AvgEntryPrice*1.05,"",Floor(MaxContracts*0.2),1);
ExitLong("bx2",AtLimit,AvgEntryPrice*1.08,"",Floor(MaxContracts*0.5),1);
ExitLong("bx3",AtLimit,AvgEntryPrice*1.10);
}
if 매도조건 == 2 Then
{
ExitLong("bx",AtLimit,AvgEntryPrice*1.15);
}
}
Else
{
LP = 0;
Condition1 = False;
Condition2 = False;
Condition3 = False;
Condition4 = False;
Condition5 = False;
Condition6 = False;
}
2
INPUT : 매수(0), 매도조건(1);
var : cond(False),LP(0);
var1 = ma(C,3);
var2 = ma(C,5);
var3 = ma(C,10);
var4 = ma(C,60);
value1 = 0;
if value1 == 0 and C < Var4 and CrossDown(c,var3) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수3");
}
}
if value1 == 0 and C < var4 and CrossDown(c,var2) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수2");
}
}
if value1 == 0 and C < Var4 and CrossDown(c,var1) and cond == False Then
{
if MarketPosition == 0 or (MarketPosition == 1 and C < LP and Condition1 == False) Then
{
value1 = 1;
Buy("매수1");
}
}
if MarketPosition == 1 Then
{
if 매수 == 1 Then
Cond = true;
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수1" Then
{
if LP == 0 or (LP > 0 and LatestEntryPrice(0) < LP) Then
LP = LatestEntryPrice(0);
Condition1 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수2" Then
{
if LP == 0 or (LP > 0 and LatestEntryPrice(0) < LP) Then
LP = LatestEntryPrice(0);
Condition2 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수3" Then
{
if LP == 0 or (LP > 0 and LatestEntryPrice(0) < LP) Then
LP = LatestEntryPrice(0);
Condition3 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수4" Then
{
Condition4 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수5" Then
{
Condition5 = true;
}
if CurrentContracts > CurrentContracts[1] and LatestEntryName(0) == "매수6" Then
{
Condition6 = true;
}
if Condition3 == true and Condition2 == true and Condition1 == true Then
{
if Condition4 == False Then
Buy("매수4",AtLimit,LP*0.97);
if Condition4 == true and Condition5 == False Then
Buy("매수5",AtLimit,LP*0.95);
if Condition4 == true and Condition5 == true and Condition6 == False Then
Buy("매수6",AtLimit,LP*0.90);
}
if 매도조건 == 1 Then
{
ExitLong("bx1",AtLimit,AvgEntryPrice*1.05,"",Floor(MaxContracts*0.2),1);
ExitLong("bx2",AtLimit,AvgEntryPrice*1.08,"",Floor(MaxContracts*0.5),1);
ExitLong("bx3",AtLimit,AvgEntryPrice*1.10);
}
if 매도조건 == 2 Then
{
ExitLong("bx",AtLimit,AvgEntryPrice*1.15);
}
}
Else
{
LP = 0;
Condition1 = False;
Condition2 = False;
Condition3 = False;
Condition4 = False;
Condition5 = False;
Condition6 = False;
}
2021-01-06
402
글번호 145157
시스템