818期货学习网 > 外汇知识 > 顺势而为:外汇交易中的道氏理论 >
2014-10-04 17:14 来源:818期货学习网
手工计算轴心点数据是非常麻烦的,有些网站提供了相应的计算数据,比如Mataf.net,同时我们也在下面提供了一个在MT4.0上使用比较广泛的轴心点源代码:
#property indicator_chart_window
//#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 Orange
#property indicator_color2 DarkBlue
#property indicator_color3 Maroon
#property indicator_color4 DarkBlue
#property indicator_color5 Maroon
#property indicator_color6 Green
#property indicator_color7 Green
//----input parameters
//----buffers
double PBuffer[];
double S1Buffer[];
double R1Buffer[];
double S2Buffer[];
double R2Buffer[];
double S3Buffer[];
double R3Buffer[];
string Pivot="Pivot Point",Supl="S1",Res1="R1";
string Sup2= "S2", Res2="R2",Sup3="S3",Res3="R3";
int fontsize=10;
double P,SI,Rl,S2,R2,S3,R3;
double LastHigh,LastLow,x;
//+ +
//| Custor indicator deinitialization function |
SetlndexBuffer (5,S3Buffer);
SetlndexBuffer (6,R3Buffer);
//--- name for DataWindow and indicator subwindow label
short_name="Pivot Point";
IndicatorShortName(short_name);
SetlndexLabel(0,short_name);
//----
SetlndexDrawBegin(0,1);
//----
//----
return (0);
//+ +
//| Custom indicator iteration function |
//+ +
int start ()
{
int counted_bars=IndicatorCounted();
int limit,i;
//----indicator calculation
if(counted_bars==0)
{
x=Period();
if(x>240)return (-1);
if (counted_bars<0)return(-1);
//---- last counted bar will be recounted
//if (counted_bars>0)counted_bars--;
limit=(Bars-counted_bars)-1;
for(i=limit;i>=0;i—-)
{
if(High[i+l]>LastHigh) LastHigh=High[i+l];
if(Low[i+l]<LastLow) LastLow=Low[i+l];
if(TimeDay(Time[i])!=TimeDay(Time[i+l]))
{
P=(LastHigh+LastLow+Close[i+l])/3;
Rl=(2*P)+LastLow;
S1=(2*P)-LastHigh;
R2=P+(LastHigh-LastLow);
S2=P-(LastHigh-LastLow);
R3=(2*P)+(LastHigh-(2*LastLow));
S3=(2*P)-((2*LastHigh)-LastLow);
LastLow=Open[i];
LastHigh=Open[i];
S1Buffer[i]=S1;
R1Buffer[i]=R1;
S2Buffer[i]=S2;
R2Buffer[i]=R2;
S3Buffer[i]=S3;
R3Buffer[i]=R3;
}
//----
retum (0);
}
//+ +
© Copyright 2014 818期货学习网 All Rights Reserved. 51La 浙ICP备14000419号-1