[求助]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 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容