[MT4指标]Fibo-Average-2B
主图指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
/*------------------------------------------------------------------+
| Fibo-Average-2B.mq4 |
| Copyright ? 2011 |
| [email protected] |
+------------------------------------------------------------------*/
#property copyright \"Copyright ? 2011\"
#property link \"[email protected]\"
//----------------------------------
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Yellow
//+------------------------------------------------------------------+
extern int FiboNumPeriod = 15;// Numbers in the following integer sequence;
extern int nAppliedPrice = 0;// PRICE_CLOSE=0; PRICE_OPEN=1; PRICE_HIGH=2; PRICE_LOW=3; PRICE_MEDIAN=4; PRICE_TYPICAL=5; PRICE_WEIGHTED=6;
extern int maPeriod = 55;// Averaging period for calculation;
extern int maMethod = 0;// MODE_SMA=0; MODE_EMA=1; MODE_SMMA=2; MODE_LWMA=3;
//----
double MainBuffer;
double maBuffer;
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0, MainBuffer);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(1, maBuffer);
SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
return(0);
}
//+------------------------------------------------------------------+
int start()
{
int i, j, nCountedBars;
int F;
ArrayResize(F, FiboNumPeriod);
ArrayInitialize(F, 0);
double A;
nCountedBars = IndicatorCounted();
i = Bars - nCountedBars;
//----
while(i >= 0)
{
for(j = 0; j < FiboNumPeriod; j++)
{
A += (AppliedPrice(nAppliedPrice, i + F[j]));
if(j == 0) F[j+1] = 1;
if(j == 1) F[j+1] = 2;
if(j >= 2) F[j+1] = F[j] + F[j-1];
}
MainBuffer = A / FiboNumPeriod;
A = 0;
i--;
}
i = Bars - nCountedBars;
while(i >= 0)
{
maBuffer = iMAOnArray(MainBuffer, 0, maPeriod, 0, maMethod, i);
i--;
}
//----
}
//+------------------------------------------------------------------+
double AppliedPrice(int nAppliedPrice, int nIndex)
{
double aPrice;
switch(nAppliedPrice)
{
case 0: aPrice = Close[nIndex]; break;
case 1: aPrice = Open[nIndex]; break;
case 2: aPrice = High[nIndex]; break;
case 3: aPrice = Low[nIndex]; break;
case 4: aPrice = (High[nIndex]+Low[nIndex]) / 2.0; break;
case 5: aPrice = (High[nIndex]+Low[nIndex] + Close[nIndex]) / 3.0; break;
case 6: aPrice = (High[nIndex]+Low[nIndex] + 2 * Close[nIndex]) / 4.0; break;
default: aPrice = 0.0;
}
return(aPrice);
}
//+------------------------------------------------------------------+
发表于:2015-11-15 13:14只看该作者
2楼
感谢分享,谢谢
韬客社区www.talkfx.co
发表于:2016-05-14 15:59只看该作者
3楼
学习学习
韬客社区www.talkfx.co
发表于:2016-05-29 04:55只看该作者
4楼
lu tb
韬客社区www.talkfx.co
发表于:2016-08-04 16:12只看该作者
6楼
试试看看
韬客社区www.talkfx.co
发表于:2016-08-09 13:24只看该作者
8楼
试试看看
韬客社区www.talkfx.co
发表于:2016-12-07 09:09只看该作者
9楼
谢谢分享
韬客社区www.talkfx.co
发表于:2016-12-07 14:25只看该作者
10楼
感谢分享
韬客社区www.talkfx.co
发表于:2017-08-07 06:50只看该作者
11楼
666
发表于:2017-08-08 00:34只看该作者
12楼
看看~~~~~~~~~~~~~~~~~~~~~~~
韬客社区www.talkfx.co