Q&A 게시판 | HOME > Q&A 게시판 |
작성자 :
예스스탁
작성일 : 2019-02-22 17:04:45
조회수 : 581
Re:지표 수식 부탁드립니다
안녕하세요
메타프로그램은 사용경험이 없어 수식내용을 알지 못합니다.
구현하고자 하시는 지표의 내용을 올려주시기 바랍니다.
즐거운 하루되세요
>> linlin 님이 쓴 글입니다.
>> 제목 : 지표 수식 부탁드립니다 2019년 번창하는 한해기 되기를 바랍니다.
다음의 지표식은 MT4를 이용하여 매매에 참고하던 지표입니다. 이 지표를 예스트레이더코인 차트에서 사용하고 싶습니다. 수식 전환을 부탁드립니다. 감사합니다.
-- 다음 --
//yinyangcandle.mq4
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Aqua
#property indicator_color2 Magenta
#property indicator_color3 DodgerBlue
#property indicator_color4 Red
#property indicator_color5 SpringGreen
#property indicator_color6 Gold
#property indicator_width1 5
#property indicator_width2 5
#property indicator_width3 5
#property indicator_width4 5
#property indicator_width5 5
#property indicator_width6 5
// indicator buffer declaration
Double Open_S[];
Double Close_S[];
Double Open_M[];
Double Close_M[];
Double Open_L[];
Double Close_L[];
// variable declaration
Extern int Average_Period_S = 3;
Extern int Average_Period_M = 25;
Extern int Average_Period_L = 75;
Int int()
{
// indicator buffer index
SetIndexBuffer(0,Open_S);
SetIndexBuffer(1,Close_S);
SetIndexBuffer(2,Open_M);
SetIndexBuffer(3,Close_M);
SetIndexBuffer(4,Open_L);
SetIndexBuffer(5,Close_L);
//indicator lavel
SetIndexLabel(0,”Open(“+Average_Period_S+”)”);
SetIndexLabel(1,”Close(“+Average_Period_S+”)”);
SetIndexLabel(2,”Open(“+Average_Period_M+”)”);
SetIndexLabel(3,”Close(“+Average_Period_M+”)”);
SetIndexLabel(4,”Open(“+Average_Period_L+”)”);
SetIndexLabel(5,”Close(“+Average_Period_L+”)”);
//indicator style
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(4,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(5,DRAW_HISTOGRAM,STYLE_SOLID);
/indicator DrawBegin
SetIndexDrawBegin(0,Average_Period_S+1);
SetIndexDrawBegin(1,Average_Period_S+1);
SetIndexDrawBegin(2,Average_Period_M+1);
SetIndexDrawBegin(3,Average_Period_M+1);
SetIndexDrawBegin(4,Average_Period_L+1);
SetIndexDrawBegin(5,Average_Period_L+1);
return(0);
}
int start()
{
// short term yinyangcandle calculation
//short term yinyangcandle close price calculation
int limit = Bars -IindicatorCounted();
for(int i = 0; i < limit; ++)
{
double Close_Sum =0;
for(int j = i; j < i + Average_Period_S; j++)
{
Close_Sum + = Close[j];
}
Close_S[i] = Close_Sum / Average_Period_S;
Close_S[i]=NormalizeDouble(Close-S[i],MarketInfo(Symbol(), MODE_DIGITS));
}
// short term yinyangcandle opening price calculation
for(i = 0; I < limit; i++)
{
double Open_Sum = 0;
for(j =i; j < i + Average_Period_S; j++)
{
Open_Sum + = Close[j + 1];
}
Open_S[i] = Open_Sum / Average_Period_S;
Open_S[i]=NormalizeDouble(Open_S[i],MarketInfo(Symbol(), MODE_DIGITS));
}
// middle term yinyangcandle calculation
// middle term yinyangcandle close price calculation
for(i = 0; i < limit; i++)
{
Close_Sum = 0;
for(j = i; j < i + Average_Period_M; j++)
{
Close_Sum + = Close[j];
}
Close_M[i] = Close_Sum / Average_Period_M;
Close_M[i]=NormalizeDouble(Close_M[i],MarketInfo(symbol(), MODE_DIGITS));
}
// middle term yinyangcandle opening price calculation
for(i = 0; i < limit; i++)
{
Open_Sum = 0;
for(j = i; j < i + Average_Period_M; j++)
{
Open_Sum += Close[j+1];
}
Open_M[i] =Open_Sum / Average_Period_M;
Open_M[i]=NormalizeDouble(Open_M[i],MarketInfo(Symbol(), MODE_DIGITS));
}
// long term yinyangcandle calculation
// long term yinyangcandle close price calculation
for(i = 0; i < limit; i++)
{
Close_Sum = 0;
for(j = i; j < i + Average_Period_L; j++)
{
Close_Sum + = Close[j];
}
Close_L[i] = Close_Sum / Average_Period_L;
Close_L[i]=NormalizeDouble(Close_L[i],MarketInfo(symbol(), MODE_DIGITS));
}
//long term yinyangcandle opening price calculation
for(I = 0; i<limit; i++)
{
Open_Sum = 0;
for(j = i; j < i + Average_Period_L; j++)
{
Open_Sum + = Close[j + 1];
}
Open_L[i] =Open_Sum / Average_Period_L;
Open_L[i]=NormalizeDouble(Open_L[i],MarketInfo(symbol(), MODE_DIGITS));
}
return(0);
}