[求助]mt4指标,公式里的x值怎么改,谢谢 [金字塔]
- 咨询内容:
//+------------------------------------------------------------------+
//| 1111.mq4 |
//| Copyright ?2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
extern int MaxPer = 500; //Maximal period analysed
extern int MinPer = 1; //Minimal period analysed
extern int bar2update = 1; //Nombre de barres entre chaque update
double FlatBuf[]; //Flattened close price buffer
int LastUpdate=0;
string ShName="";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,FlatBuf);
//Correct if needed MinPer and MaxPer
if(MinPer<2) MinPer=2;
if(MaxPer<MinPer) MaxPer=MinPer;
//Correct if needed Bar2Update
if(bar2update<0) bar2update=1;
//---- name for DataWindow and indicator subwindow label
ShName=" 1111("+MinPer+" to "+MaxPer+" Periods)";
IndicatorShortName(ShName);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//Check Enough Bars
if(Bars<3*MaxPer)
{
Print(" Not Enough bars! - you need 3*MaxPer -> " + DoubleToStr(3*MaxPer,0));
return(0);
}
else
IndicatorShortName(ShName);
//Check bar2update
if(bar2update<1) bar2update=1;
//Check Update needed
if(Time[0]-LastUpdate>=bar2update*Period()*60)
{
LastUpdate=Time[0];
//--- Call main function
ComputeIt(1);
}
//----
return(0);
}
//+------------------------------------------------------------------+
int ComputeIt(int x)
{
int i;
int k;
double a;
double b;
//---- Set flatBuf to 0
for(i=0;i<=3*MaxPer+2;i++)
{
FlatBuf=0;
}
//Calculate flattened price
a=Close[x+3*MaxPer-1];
b=(Close[x]-a)/(x+3*MaxPer-2);
for(i=3*MaxPer;i>=1;i--)
FlatBuf=Close[x+i-1]-(a+b*(3*MaxPer-i));
return(0);
}
公式里的x值是什么 红色部分 - 金字塔客服:
你这个怎么着也得发到MT4论坛吧?
- 用户回复:
主要是我想改成金字塔指标,x那不知道如何改
- 网友回复: 所以说你发到MT4论坛让人给你解释一下。。。你只发代码不发解释我们也看不懂。。。
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 511411198 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容