接上一篇
3.行情类实现(主要是指标类函数)
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::AC(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period)
{
int h=iAC(symbol,period);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::AD(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,ENUM_APPLIED_VOLUME applied_volume)
{
int h=iAD(symbol,period,applied_volume);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::ADX(double &data0[],
double &data1[],
double &data2[],
int count,//获取几个值
string symbol, // 交易品种名称
ENUM_TIMEFRAMES period, // 周期
int adx_period // 平均周期
)
{
int adx_h=iADX(symbol,period,adx_period);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
ArraySetAsSeries(data2,true);
int a;
a=CopyBuffer(adx_h,0,0,count,data0);
a=CopyBuffer(adx_h,1,0,count,data1);
a=CopyBuffer(adx_h,2,0,count,data2);
IndicatorRelease(adx_h);
return(a);
}
//+------------------------------------------------------------------+
int Kline::ADXWilder(double &data0[],double &data1[],double &data2[],int count,string symbol,ENUM_TIMEFRAMES period,int adx_period)
{
int h=iADXWilder(symbol,period,adx_period);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
ArraySetAsSeries(data2,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
a=CopyBuffer(h,2,0,count,data2);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::AMA(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ama_period,int fast_ma_period,int slow_ma_period,int ama_shift,ENUM_APPLIED_PRICE applied_price)
{
int h=iAMA(symbol,period,ama_period,fast_ma_period,slow_ma_period,ama_shift,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::AO(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period)
{
int h=iAO(symbol,period);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::ATR(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period)
{
int h=iATR(symbol,period,ma_period);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Alligator(double &data0[],double &data1[],double &data2[],int count,string symbol,ENUM_TIMEFRAMES period,int jaw_period,int jaw_shift,int teeth_period,int teeth_shift,int lips_period,int lips_shift,ENUM_MA_METHOD ma_method,ENUM_APPLIED_PRICE applied_price)
{
int h=iAlligator(symbol,period,jaw_period,jaw_shift,teeth_period,teeth_shift,lips_period,lips_shift,ma_method,applied_price);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
ArraySetAsSeries(data2,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
a=CopyBuffer(h,2,0,count,data2);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::BWMFI(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,ENUM_APPLIED_VOLUME applied_volume)
{
int h=iBWMFI(symbol,period,applied_volume);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| The buffer numbers are the following: 0 - BASE_LINE, 1 - UPPER_BAND, 2 - LOWER_BAND |
//+------------------------------------------------------------------+
int Kline::Bands(double &data0[],double &data1[],double &data2[],int count,string symbol,ENUM_TIMEFRAMES period,int bands_period,int bands_shift,double deviation,ENUM_APPLIED_PRICE applied_price)
{
//int h=iCustom(symbol,period,"Examples\\BB",bands_period,bands_shift,deviation);
int h=iBands(symbol,period,bands_period,bands_shift,deviation,applied_price);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
ArraySetAsSeries(data2,true);
int a;
a=CopyBuffer(h,0,0,count,data2);//mid
a=CopyBuffer(h,1,0,count,data0);//up
a=CopyBuffer(h,2,0,count,data1);//low
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::BearsPower(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period)
{
int h=iBearsPower(symbol,period,ma_period);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::BullsPower(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period)
{
int h=iBullsPower(symbol,period,ma_period);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::CCI(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,ENUM_APPLIED_PRICE applied_price)
{
int h=iCCI(symbol,period,ma_period,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Chaikin(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int fast_ma_period,int slow_ma_period,ENUM_MA_METHOD ma_method,ENUM_APPLIED_VOLUME applied_volume)
{
int h=iChaikin(symbol,period,fast_ma_period,slow_ma_period,ma_method,applied_volume);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::DEMA(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,int ma_shift,ENUM_APPLIED_PRICE applied_price)
{
int h=iDEMA(symbol,period,ma_period,ma_shift,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::DeMarker(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period)
{
int h=iDeMarker(symbol,period,ma_period);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Envelopes(double &data0[],double &data1[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,int ma_shift,ENUM_MA_METHOD ma_method,ENUM_APPLIED_PRICE applied_price,double deviation)
{
int h=iEnvelopes(symbol,period,ma_period,ma_shift,ma_method,applied_price,deviation);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Force(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,ENUM_MA_METHOD ma_method,ENUM_APPLIED_VOLUME applied_volume)
{
int h=iForce(symbol,period,ma_period,ma_method,applied_volume);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::FrAMA(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,int ma_shift,ENUM_APPLIED_PRICE applied_price)
{
int h=iFrAMA(symbol,period,ma_period,ma_shift,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Fractals(double &data0[],double &data1[],int count,string symbol,ENUM_TIMEFRAMES period)
{
int h=iFractals(symbol,period);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Gator(double &data0[],double &data1[],int count,string symbol,ENUM_TIMEFRAMES period,int jaw_period,int jaw_shift,int teeth_period,int teeth_shift,int lips_period,int lips_shift,ENUM_MA_METHOD ma_method,ENUM_APPLIED_PRICE applied_price)
{
int h=iGator(symbol,period,jaw_period,jaw_shift,teeth_period,teeth_shift,lips_period,lips_shift,ma_method,applied_price);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Ichimoku(double &data0[],double &data1[],double &data2[],double &data3[],double &data4[],int count,string symbol,ENUM_TIMEFRAMES period,int tenkan_sen,int kijun_sen,int senkou_span_b)
{
int h=iIchimoku(symbol,period,tenkan_sen,kijun_sen,senkou_span_b);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
ArraySetAsSeries(data2,true);
ArraySetAsSeries(data3,true);
ArraySetAsSeries(data4,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
a=CopyBuffer(h,2,0,count,data2);
a=CopyBuffer(h,3,0,count,data3);
a=CopyBuffer(h,4,0,count,data4);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::MACD(double &data0[],double &data1[],int count,string symbol,ENUM_TIMEFRAMES period,int fast_ema_period,int slow_ema_period,int signal_period,ENUM_APPLIED_PRICE applied_price)
{
int h=iMACD(symbol,period,fast_ema_period,slow_ema_period,signal_period,applied_price);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::MFI(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,ENUM_APPLIED_VOLUME applied_volume)
{
int h=iMFI(symbol,period,ma_period,applied_volume);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::MA(double &data0[],
int count,//获取几个值
string symbol, // 交易品种名称
ENUM_TIMEFRAMES period, // 周期
int ma_period, // 平均周期
int ma_shift, // 平移
ENUM_MA_METHOD ma_method, // 平滑类型
ENUM_APPLIED_PRICE applied_price // 价格或者处理程序类型
)
{
int ma_h=iMA(symbol,period,ma_period,ma_shift,ma_method,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(ma_h,0,0,count,data0);
//释放句柄
IndicatorRelease(ma_h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Momentum(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int mom_period,ENUM_APPLIED_PRICE applied_price)
{
int h=iMomentum(symbol,period,mom_period,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::OBV(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,ENUM_APPLIED_VOLUME applied_volume)
{
int h=iOBV(symbol,period,applied_volume);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::OsMA(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int fast_ema_period,int slow_ema_period,int signal_period,ENUM_APPLIED_PRICE applied_price)
{
int h=iOsMA(symbol,period,fast_ema_period,slow_ema_period,signal_period,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::RSI(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,ENUM_APPLIED_PRICE applied_price)
{
int h=iRSI(symbol,period,ma_period,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::RVI(double &data0[],double &data1[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period)
{
int h=iRVI(symbol,period,ma_period);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::SAR(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,double step,double maximum)
{
int h=iSAR(symbol,period,step,maximum);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::StdDev(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,int ma_shift,ENUM_MA_METHOD ma_method,ENUM_APPLIED_PRICE applied_price)
{
int h=iStdDev(symbol,period,ma_period,ma_shift,ma_method,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| The buffer numbers: 0 - MAIN_LINE, 1 - SIGNAL_LINE. |
//+------------------------------------------------------------------+
int Kline::Stochastic(double &data0[],double &data1[],int count,string symbol,ENUM_TIMEFRAMES period,int Kperiod,int Dperiod,int slowing,ENUM_MA_METHOD ma_method,ENUM_STO_PRICE price_field)
{
int h=iStochastic(symbol,period,Kperiod,Dperiod,slowing,ma_method,price_field);
ArraySetAsSeries(data0,true);
ArraySetAsSeries(data1,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
a=CopyBuffer(h,1,0,count,data1);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::TEMA(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,int ma_shift,ENUM_APPLIED_PRICE applied_price)
{
int h=iTEMA(symbol,period,ma_period,ma_shift,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::TriX(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ma_period,ENUM_APPLIED_PRICE applied_price)
{
int h=iTriX(symbol,period,ma_period,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::VIDyA(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int cmo_period,int ema_period,int ma_shift,ENUM_APPLIED_PRICE applied_price)
{
int h=iVIDyA(symbol,period,cmo_period,ema_period,ma_shift,applied_price);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::Volumes(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,ENUM_APPLIED_VOLUME applied_volume)
{
int h=iVolumes(symbol,period,applied_volume);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int Kline::ZigZag(double &data0[],int count,string symbol,ENUM_TIMEFRAMES period,int ExtDepth,int ExtDeviation,int ExtBackstep)
{
int h=iCustom(symbol,period,"Examples\\ZigZag",ExtDepth,ExtDeviation,ExtBackstep);
ArraySetAsSeries(data0,true);
int a;
a=CopyBuffer(h,0,0,count,data0);
IndicatorRelease(h);
return(a);
}
//+------------------------------------------------------------------+
如果您发现本文对你有所帮助,如果您认为其他人也可能受益,请把它分享出去。
网友评论