adsa
发表于 2018-7-21 08:24:14
Signals during the EU/US se
xiaolin998
发表于 2018-7-25 02:21:35
的顶顶顶顶顶的顶顶顶顶顶
q124063679
发表于 2018-8-11 00:24:44
111111111111111111111111
索德斯勒
发表于 2018-8-11 00:44:25
看不懂啊!
antioa
发表于 2018-8-11 11:25:16
学习一下,感谢楼主
ColdME
发表于 2018-8-14 22:19:18
看看什么鬼
peterzhu2004
发表于 2018-8-20 21:32:15
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
阿迪
发表于 2018-8-30 23:46:11
sdfsafsadfsadfsdafsa
15506110051
发表于 2018-8-30 23:47:43
//+------------------------------------------------------------------+
//| Phase Adaptive_v1.0 600+.mq4 |
//| Copyright © 2016, TrendLaboratory |
//| http://finance.groups.yahoo.com/group/TrendLaboratory |
//| E-mail: igorad2003@yahoo.co.uk |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, TrendLaboratory"
#property link "http://finance.groups.yahoo.com/group/TrendLaboratory"
#property link "http://newdigital-world.com/forum.php"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 clrDeepSkyBlue
#property indicator_width1 2
#property indicator_level1 90
#property indicator_level2 180
#property indicator_level3 270
#property indicator_minimum 0
#property indicator_maximum 360
enum ENUM_PRICE
{
close, // Close
open, // Open
high, // High
low, // Low
median, // Median
typical, // Typical
weightedClose, // Weighted Close
heikenAshiClose, // Heiken Ashi Close
heikenAshiOpen, // Heiken Ashi Open
heikenAshiHigh, // Heiken Ashi High
heikenAshiLow, // Heiken Ashi Low
heikenAshiMedian, // Heiken Ashi Median
heikenAshiTypical, // Heiken Ashi Typical
heikenAshiWeighted // Heiken Ashi Weighted Close
};
#define pi 3.14159265358979323846
//---- input parameters
input ENUM_TIMEFRAMES TimeFrame = 0; // Timeframe
input ENUM_PRICE Price = 0; // Price
input double CyclePeriod = 15; // Cycle Period Ratio
input bool AdaptiveModeOn = false; // Adaptive Mode On/Off
input double Alpha =0.07; // Cycle Smoothing Factor(eg. 0.07)
input int MedianPeriod = 5; // Period of Moving Median
input int DCsmooth = 5; // Period of Dominant Cycle Smoothing
//---- buffers
double phase[];
double iprice[];
int timeframe, draw_begin;
string TF, IndicatorName;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
timeframe = TimeFrame;
if(timeframe <= Period()) timeframe = Period();
TF = tf(timeframe);
IndicatorDigits(5);
//---- indicators
IndicatorBuffers(2);
SetIndexBuffer(0, phase); SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(1,iprice);
//----
IndicatorName = WindowExpertName();
IndicatorShortName(IndicatorName+"["+TF+"]("+Price+","+DoubleToStr(CyclePeriod,2)+")");
SetIndexLabel(0,"Phase");
//----
draw_begin = MathMax(2,Bars - iBars(NULL,timeframe)*timeframe/Period() + 50);
SetIndexDrawBegin(0,draw_begin);
return(0);
}
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Phase Adaptive_v1.0 600+ |
//+------------------------------------------------------------------+
int start()
{
int shift, limit, counted_bars=IndicatorCounted();
//----
if(counted_bars > 0) limit = Bars - counted_bars - 1;
if(counted_bars < 0) return(0);
if(counted_bars < 1)
{
limit = Bars - 1;
for(int i=limit;i>=0;i--)
{
phase = EMPTY_VALUE;
}
}
if(timeframe != Period())
{
limit = MathMax(limit,timeframe/Period());
for(shift = 0;shift < limit;shift++)
{
int y = iBarShift(NULL,timeframe,Time);
phase = iCustom(NULL,TimeFrame,IndicatorName,0,Price,CyclePeriod,AdaptiveModeOn,Alpha,MedianPeriod,DCsmooth,0,y);
}
return(0);
}
else _adaptivePhase(limit);
//----
return(0);
}
//+------------------------------------------------------------------+
void _adaptivePhase(int limit)
{
double ;
for(int shift=limit;shift>=0;shift--)
{
if(Price <= 6) iprice = iMA(NULL,0,1,0,0,(int)Price,shift);
else
if(Price > 6 && Price <= 13) iprice = HeikenAshi(0,(int)Price-7,shift);
if(AdaptiveModeOn)
{
double cyclelen = cyclePeriod(iprice,Alpha,MedianPeriod,DCsmooth,shift);
int domcycle = MathMax(1,MathFloor(CyclePeriod*cyclelen));
}
else domcycle = MathMax(1,MathFloor(CyclePeriod));
double realPart = 0;
double imagPart = 0;
for(int i=0;i<domcycle;i++)
{
if(domcycle > 0)
{
double weight = iprice;
realPart += MathCos(2*pi*i/domcycle)*weight;
imagPart += MathSin(2*pi*i/domcycle)*weight;
}
}
if(MathAbs(realPart) > 0.001) phase = MathArctan(imagPart/realPart); else phase = 0.5*pi*Sign(imagPart);
if(realPart < 0) phase = phase + pi;
phase = phase + pi/2;
if(phase < 0) phase = phase + 2*pi;
if(phase > 2*pi) phase = phase - 2*pi;
phase = 180*phase/pi;
}
}
double Sign(double value)
{
if(value > 0) return( 1);
if(value < 0) return(-1);
return(0);
}
double DeltaPhase[], aPrice, smooth, cycle, Q1, I1, iPeriod, cPeriod;
datetime prevcptime;
double cyclePeriod(double& price[],double alpha,int median,int dcsmooth,int bar)
{
double DC, MedianDelta = 0;
if(ArraySize(DeltaPhase) != Bars)
{
ArraySetAsSeries(DeltaPhase,false);
ArrayResize(DeltaPhase,Bars);
ArraySetAsSeries(DeltaPhase,true);
}
if(prevcptime != Time)
{
for(int i=6;i>=1;i--)
{
cycle = cycle;
if(i < 4)
{
aPrice= aPrice;
cPeriod = cPeriod;
}
if(i < 3) smooth = smooth;
}
I1 = I1;
Q1 = Q1;
iPeriod = iPeriod;
prevcptime = Time;
}
aPrice = price;
if(bar < Bars - 3) smooth = (aPrice + 2*aPrice + 2*aPrice + aPrice)/6;
cycle = (1 - 0.5*alpha)*(1 - 0.5*alpha)*(smooth - 2*smooth + smooth) + 2*(1-alpha)*cycle - (1-alpha)*(1-alpha)*cycle;
if(bar > Bars - 7) cycle = (aPrice - 2*aPrice + aPrice)/4;
Q1 = (0.0962*cycle + 0.5769*cycle - 0.5769*cycle - 0.0962*cycle)*(0.5 + 0.08*iPeriod);
I1 = cycle;
if(bar < Bars- median)
{
if(Q1 != 0 && Q1 != 0) DeltaPhase = (I1/Q1 - I1/Q1)/(1 + I1*I1/(Q1*Q1));
if(DeltaPhase < 0.1) DeltaPhase = 0.1;
if(DeltaPhase > 1.1) DeltaPhase = 1.1;
MedianDelta = MedianOnArray(DeltaPhase,median,bar);
if(MedianDelta == 0) DC = 15; else DC = 6.28318/MedianDelta + 0.5;
iPeriod = 0.33*DC + (1 - 2.0/(dcsmooth + 1))*iPeriod;
cPeriod = 0.15*iPeriod + 0.85*cPeriod;
}
if(cPeriod == 0) return(0);
return(cPeriod);
}
double MedianOnArray(double& price[],int per,int bar)
{
double median, array[];
ArrayResize(array,per);
for(int i=0;i<per;i++) array = price;
ArraySort(array,WHOLE_ARRAY,0,MODE_DESCEND);
int num = (int)MathRound((per - 1)*0.5);
if(MathMod(per,2) > 0) median = array; else median = 0.5*(array + array);
return(median);
}
// HeikenAshi Price
double haClose, haOpen, haHigh, haLow;
datetime prevhatime;
double HeikenAshi(int index,int price,int bar)
{
if(prevhatime != Time)
{
haClose = haClose;
haOpen = haOpen ;
haHigh = haHigh ;
haLow = haLow;
prevhatime = Time;
}
if(bar == Bars - 1)
{
haClose = Close;
haOpen = Open ;
haHigh = High ;
haLow = Low;
}
else
{
haClose = (Open + High + Low + Close)/4;
haOpen = (haOpen + haClose)/2;
haHigh = MathMax(High,MathMax(haOpen,haClose));
haLow = MathMin(Low ,MathMin(haOpen,haClose));
}
switch(price)
{
case0: return(haClose); break;
case1: return(haOpen ); break;
case2: return(haHigh ); break;
case3: return(haLow); break;
case4: return((haHigh + haLow)/2); break;
case5: return((haHigh + haLow + haClose)/3); break;
case6: return((haHigh + haLow + 2*haClose)/4); break;
default: return(haClose); break;
}
}
string tf(int itimeframe)
{
string result = "";
switch(itimeframe)
{
case PERIOD_M1: result = "M1" ;
case PERIOD_M5: result = "M5" ;
case PERIOD_M15:result = "M15";
case PERIOD_M30:result = "M30";
case PERIOD_H1: result = "H1" ;
case PERIOD_H4: result = "H4" ;
case PERIOD_D1: result = "D1" ;
case PERIOD_W1: result = "W1" ;
case PERIOD_MN1:result = "MN1";
default: result = "N/A";
}
if(result == "N/A")
{
if(itimeframe <PERIOD_H1 ) result = "M"+ (string)itimeframe;
if(itimeframe >= PERIOD_H1 ) result = "H"+ (string)(itimeframe/PERIOD_H1);
if(itimeframe >= PERIOD_D1 ) result = "D"+ (string)(itimeframe/PERIOD_D1);
if(itimeframe >= PERIOD_W1 ) result = "W"+ (string)(itimeframe/PERIOD_W1);
if(itimeframe >= PERIOD_MN1) result = "MN" + (string)(itimeframe/PERIOD_MN1);
}
return(result);
}
睿虎破译
发表于 2018-9-5 11:19:05
roFx 4.0 Forex Trading Strategy [修改]