请高手帮忙一下,将下列MT4.0公式改成飞狐或通达信的
MT4.0指标源码如下:
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 Red
//Buffers for drawing
double slow_k;
double slow_d;
//Buffers for counting
double ema_buffer_k;
double ema_buffer_d;
double mav;
double var1;
double var2;
//Start
int init()
{
IndicatorBuffers(7);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,slow_k);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,slow_d);
SetIndexBuffer(2, ema_buffer_k);
SetIndexBuffer(3, ema_buffer_d);
SetIndexBuffer(4, mav);
SetIndexBuffer(5, var1);
SetIndexBuffer(6, var2);
IndicatorShortName("MyKD");
return(0);
}
//Stop
int deinit()
{
return(0);
}
//Run
int start()
{
int filled_bars = IndicatorCounted();
//Recount last bar
if(filled_bars > 0)
filled_bars--;
//How many bars do i need to calculate?
int limit = Bars - filled_bars;
//Calculate KD for the price
int i;
for(i=0; i < limit ; i++)
{
mav = (2*Close+High+Low)/4;
var1 = Low[Lowest(NULL, 0, MODE_LOW, 34, i)];
var2 = High[Highest(NULL, 0, MODE_LOW, 34, i)];
ema_buffer_k = (mav - var1)/(var2 - var1)*100;
}
for(i=0; i < limit ; i++)
slow_k = iMAOnArray(ema_buffer_k, Bars, 13, 0, MODE_EMA, i);
for(i=0; i < limit ; i++)
ema_buffer_d = 0.667*slow_k[i+1] + 0.333*slow_k;
for(i=0; i < limit ; i++)
slow_d = iMAOnArray(ema_buffer_d, Bars, 2, 0, MODE_EMA, i);
return(0);
}
发表于:2008-11-25 08:33只看该作者
2楼
金卡绣球《MT4行情接口》
jk8.com
发表于:2008-11-25 11:39只看该作者
3楼
:lol :lol :lol :lol :lol
韬客社区www.talkfx.co
发表于:2008-11-26 10:15只看该作者
4楼
飞狐的,看下是不是jk8.com Pica1321.gifJK8.COM_1126KD.rar
金卡绣球《MT4行情接口》
jk8.com
发表于:2016-09-02 01:34只看该作者
5楼
谢谢发这么好的东西
韬客社区www.talkfx.co