发表于:2005-05-28 23:47只看该作者
2楼
除非有朋友把指标转换成mt4的...........
发表于:2005-05-29 01:16只看该作者
3楼
//+------------------------------------------------------------------+
//| T3MACO.mq4 |
//| Perky_z |
//| http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ |
//+------------------------------------------------------------------+
#property copyright "Perky_z hack of Mojos Program"
#property link "http://groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
extern int MA_Period = 5;
extern double b = 0.7;
double MapBuffer;
extern int FastEMA=5;
extern int SlowEMA=8;
double e1,e2,e3,e4,e5,e6;
double c1,c2,c3,c4;
double n,w1,w2,b2,b3;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators setting
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Red);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
IndicatorShortName("T3_ MACO "+MA_Period);
SetIndexBuffer(0,MapBuffer);
//---- variable reset
e1=0; e2=0; e3=0; e4=0; e5=0; e6=0;
c1=0; c2=0; c3=0; c4=0;
n=0;
w1=0; w2=0;
b2=0; b3=0;
b2=b*b;
b3=b2*b;
c1=-b3;
c2=(3*(b2+b3));
c3=-3*(2*b2+b+b3);
c4=(1+3*b+b3+3*b2);
n=MA_Period;
if (n<1) n=1;
n = 1 + 0.5*(n-1);
w1 = 2 / (n + 1);
w2 = 1 - w1;
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit=Bars;
//---- indicator calculation
for(int i=limit; i>=0; i--)
{
e1 = w1*(iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_OPEN,i)) + w2*e1;
e2 = w1*e1 + w2*e2;
e3 = w1*e2 + w2*e3;
e4 = w1*e3 + w2*e4;
e5 = w1*e4 + w2*e5;
e6 = w1*e5 + w2*e6;
MapBuffer=c1*e6 + c2*e5 + c3*e4 + c4*e3;
}
//----
return(0);
}
//+------------------------------------------------------------------+
[ Last edited by 老正 on 2005-5-30 at 09:32 ]
韬客社区www.talkfx.co
发表于:2005-05-29 01:19只看该作者
4楼
//+------------------------------------------------------------------+
//| Custom Aroon_v1.mq4 |
//| rafcamara |
//| Has corrected - Ramdass |
//+------------------------------------------------------------------+
#property copyright "rafcamara"
#property link "[email protected]"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 Red
//---- indicator parameters
extern int AroonPeriod=10;
extern int CountBars=300;
//---- indicator buffers
double AroonUpBuffer;
double AroonDnBuffer;
int HighBarBuffer;
int LowBarBuffer;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorBuffers(2);
SetIndexBuffer(0, AroonUpBuffer);
SetIndexBuffer(1, AroonDnBuffer);
//---- drawing settings
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
IndicatorDigits(1);
//---- indicator buffers mapping
if(!SetIndexBuffer(0,AroonUpBuffer) && !SetIndexBuffer(1,AroonDnBuffer))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("Aroon Up & Dn_v1("+AroonPeriod+")");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Aroon Up & Dn |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars+AroonPeriod+1);
SetIndexDrawBegin(1,Bars-CountBars+AroonPeriod+1);
double AroonUp,AroonDn;
int ArPer,limit,i;
int UpBarDif,DnBarDif;
// int HighBarBuffer;
// int LowBarBuffer;
int counted_bars=IndicatorCounted();
ArPer=AroonPeriod; //Short name
//---- check for possible errors
if(counted_bars<0) return(-1);
if(AroonPeriod<1) return(-1);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=ArPer;i++) AroonUpBuffer[CountBars-i]=0.0;
for(i=1;i<=ArPer;i++) AroonDnBuffer[CountBars-i]=0.0;
}
//---- last counted bar will be recounted
//if(counted_bars>0) counted_bars--;
limit=CountBars-AroonPeriod;
//----Calculation---------------------------
for( i=0; i
发表于:2005-05-29 01:19只看该作者
5楼
//+------------------------------------------------------------------+
//| mc.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
//---- indicator buffers
double ind_buffer1;
double ind_buffer2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexDrawBegin(1,SignalSMA);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
//---- indicator buffers mapping
if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
SetIndexLabel(0,"MACD");
SetIndexLabel(1,"Signal");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0; i
韬客社区www.talkfx.co
发表于:2005-05-29 01:23只看该作者
6楼
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2.mq4
//| Ramdass - Conversion only
//+------------------------------------------------------------------+
#property copyright "Author - OlegVS, GOODMAN"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Crimson
//---- input parameters
extern int K=30;
extern double Kstop=0.5;
extern int Kperiod=150;
extern int PerADX=14;
extern int CountBars=350;
//---- buffers
double val1;
double val2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,108);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,108);
SetIndexBuffer(0,val1);
SetIndexBuffer(1,val2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2 |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars+PerADX);
SetIndexDrawBegin(1,Bars-CountBars+PerADX);
int i,shift,counted_bars=IndicatorCounted();
int i1,i2;
double Range,AvgRange,smin,smax,SsMax,SsMin,SSP,price;
bool uptrend,old;
//----
if(Bars<=PerADX+1) return(0);
//---- initial zero
if(counted_bars=0; shift--)
{
SSP=MathCeil(Kperiod/iADX(NULL,0,PerADX,PRICE_CLOSE,MODE_MAIN,1));
Range=0;
AvgRange=0;
for (i1=shift; i1<=shift+SSP; i1++)
{AvgRange=AvgRange+MathAbs(High[i1]-Low[i1]);
}
Range=AvgRange/(SSP+1);
SsMax=High[shift]; SsMin=Low[shift];
for (i2=shift;i2<=shift+SSP-1;i2++)
{
price=High[i2];
if(SsMax=price) SsMin=price;
}
smin = SsMin+(SsMax-SsMin)*K/100;
smax = SsMax-(SsMax-SsMin)*K/100;
val1[shift]=0;
val2[shift]=0;
if (Close[shift]smax)
{
uptrend = true;
}
if (uptrend!=old && uptrend==true) {val1[shift]=Low[shift]-Range*Kstop;}
if (uptrend!=old && uptrend==false) {val2[shift]=High[shift]+Range*Kstop;}
old=uptrend;
}
return(0);
}
//+------------------------------------------------------------------+
[ Last edited by 老正 on 2005-5-30 at 09:32 ]
韬客社区www.talkfx.co
发表于:2005-05-29 01:30只看该作者
7楼
但是这两个都用了未来数据,不是很理想
发表于:2005-05-29 01:30只看该作者
8楼
//+------------------------------------------------------------------+
//| NRTR.mq4 |
//| |
//| Ramdass - Conversion only |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Violet
//---- input parameters
extern int AveragePeriod=10;
extern int CountBars=300;
//---- buffers
double value1;
double value2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,159);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,159);
SetIndexBuffer(0,value1);
SetIndexBuffer(1,value2);
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| NRTR |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>Bars) CountBars=Bars;
SetIndexDrawBegin(0,Bars-CountBars+1);
SetIndexDrawBegin(1,Bars-CountBars+1);
int i,counted_bars=IndicatorCounted();
double value;
double trend=0,dK,AvgRange,price;
//----
if(Bars<=AveragePeriod) return(0);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=AveragePeriod;i++) value1[Bars-i]=0.0;
for(i=1;i<=AveragePeriod;i++) value2[Bars-i]=0.0;
}
AvgRange=0;
for (i=1 ; i<=AveragePeriod ; i++) AvgRange+= MathAbs(High-Low);
if (Symbol() == "USDJPY" || Symbol() == "GBPJPY" || Symbol() == "EURJPY")
{dK = (AvgRange/AveragePeriod)/100;}
else {dK = AvgRange/AveragePeriod;}
if (Close[CountBars-1] > Open[CountBars-1])
{
value1[CountBars - 1] = Close[CountBars - 1] * (1 - dK);
trend = 1; value2[CountBars - 1] = 0.0;
}
if (Close[CountBars-1] < Open[CountBars-1]) {
value2[CountBars - 1] = Close[CountBars - 1] * (1 + dK);
trend = -1; value1[CountBars - 1] = 0.0;
}
//----
i=CountBars-1;
while(i>=0)
{
value1=0; value2=0;
if (trend >= 0)
{
if (Close > price) price = Close;
value = price * (1 - dK);
if (Close < value)
{
price = Close;
value = price * (1 + dK);
trend = -1;
}
}
else
{
if (trend <= 0)
{
if (Close < price) price = Close;
value = price * (1 + dK);
if (Close > value)
{
price = Close;
value = price * (1 - dK);
trend = 1;
}
}
}
if (trend == 1) {value1=value; value2=0.0;}
if (trend == -1) {value2=value; value1=0.0;}
i--;
}
return(0);
}
//+------------------------------------------------------------------+
[ Last edited by 老正 on 2005-5-30 at 09:33 ]
发表于:2005-05-29 01:31只看该作者
9楼
//+------------------------------------------------------------------+
//| NRTR WATR.mq4 |
//| |
//| Ramdass - Conversion only |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int AveragePeriod=10;
extern int Variant=2;
extern int CountBars=300;
//---- buffers
double value1;
double value2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
IndicatorBuffers(2);
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,167);
SetIndexStyle(1,DRAW_ARROW);
SetIndexArrow(1,167);
SetIndexBuffer(0,value1);
SetIndexBuffer(1,value2);
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| NRTR WATR |
//+------------------------------------------------------------------+
int start()
{
if (CountBars>=Bars) CountBars=Bars - AveragePeriod - 2;
// CountBars = CountBars - AveragePeriod - 3;
SetIndexDrawBegin(0,Bars-CountBars+1);
SetIndexDrawBegin(1,Bars-CountBars+1);
int i,i2,bar,counted_bars=IndicatorCounted();
double value,WATR;
double trend=1,dK,AvgRange,price,AveragePeriod_D;
AveragePeriod_D=AveragePeriod;
//----
if(Bars<=AveragePeriod) return(0);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=AveragePeriod;i++) value1[Bars-i]=0.0;
for(i=1;i<=AveragePeriod;i++) value2[Bars-i]=0.0;
}
AvgRange=0;
if ((Variant == 2) || (Variant == 3))
{
for (i=AveragePeriod; i>=1; i--)
{
dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
AvgRange=AvgRange + dK*MathAbs(High-Low);
}
if (Symbol()=="USDJPY" || Symbol()=="GBPJPY" || Symbol()=="EURJPY")
{WATR = AvgRange/AveragePeriod_D/100;}
else
{WATR = AvgRange/AveragePeriod_D;}
}
if (Variant == 1)
{
for (i=1; i<=AveragePeriod; i++)
{
dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
AvgRange=AvgRange + dK*MathAbs(High[CountBars + i]-Low[CountBars + i]);
}
WATR = AvgRange/AveragePeriod_D;
}
if (Close[CountBars-1] > Open[CountBars-1])
{
value1[CountBars - 1] = Close[CountBars - 1] * (1 - WATR);
trend = 1; value2[CountBars - 1] = 0.0;
}
if (Close[CountBars-1] < Open[CountBars-1])
{
value2[CountBars - 1] = Close[CountBars - 1] * (1 + WATR);
trend = -1; value1[CountBars - 1] = 0.0;
}
//----
bar=CountBars;
while(bar>=0)
{
value1[bar]=0.0; value2[bar]=0.0;
if (Variant == 3)
{
AvgRange=0;
for (i=1; i<=AveragePeriod; i++)
{
dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
AvgRange=AvgRange+ dK*MathAbs(High[bar + i]-Low[bar + i]);
}
WATR = AvgRange/AveragePeriod_D;
}
if (trend == 1)
{
if (Close[bar] > price) price = Close[bar];
value = price * (1 - WATR);
if (Close[bar] < value)
{
price = Close[bar];
value = price * (1 + WATR);
trend = -1;
}
}
if (trend == -1)
{
if (Close[bar] < price) price = Close[bar];
value = price * (1 + WATR);
if (Close[bar] > value)
{
price = Close[bar];
value = price * (1 - WATR);
trend = 1;
}
}
if (trend == 1) {value1[bar]=value; value2[bar]=0.0;}
if (trend == -1) {value2[bar]=value; value1[bar]=0.0;}
bar--;
}
return(0);
}
//+------------------------------------------------------------------+
[ Last edited by 老正 on 2005-5-30 at 09:33 ]
韬客社区www.talkfx.co
发表于:2005-05-29 02:49只看该作者
10楼
以上贴的源码编译的时候可能出现问题,试试加上中括号试试
韬客社区www.talkfx.co
11楼
谢谢!!
韬客社区www.talkfx.co
发表于:2005-05-30 01:39只看该作者
12楼
Originally posted by Zukunft at 2005-5-29 10:49 以上贴的源码编译的时候可能出现问题,试试加上中括号试试
遇到矛盾 先站在对方的立场上想想问题,先试着去理解别人
● 如何使用WinMTR查询平台连接流畅度