以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  如何在金字塔里编辑外软指标__QQE  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=6399)

--  作者:newstar20088
--  发布时间:2011/5/3 16:37:22
--  如何在金字塔里编辑外软指标__QQE
请问如何编辑下面的function QQE_TR,Ambroker 里的QQE指标源码以下: _SECTION_BEGIN("QQE"); // QQE (Quantative Qualitative Estimation) QQE_Periods = Param("Period", 14, 3, 30, 1 ); QQE_SF = Param("Smoothing factor", 5, 1, 30, 1 ); QQE_RSI_MA = EMA(RSI(QQE_Periods),QQE_SF); QQE_ATR_RSI = abs(Ref(QQE_RSI_MA,-1)-QQE_RSI_MA); QQE_MA_ATR_RSI = EMA(QQE_ATR_RSI, 2*QQE_Periods-1); QQE_DAR = EMA(QQE_MA_ATR_RSI, 2*QQE_Periods-1)*4.236; QQE_DAR_Fast = EMA(QQE_MA_ATR_RSI, 2*QQE_Periods-1)*2.618; function QQE_TR(RSIMA, DARFACTOR) { result[ 0 ] = 0; for( i = 1; i < BarCount; i++ ) { if (RSIMA[i] < result[i-1]) { result[i]=RSIMA[i]+DARFACTOR[i]; if ((RSIMA[i-1] < result[i-1]) AND (result[i] > result[i-1])) { result[i] = result[i-1]; } } else { if (RSIMA[i] > result[i-1]) { result[i]=RSIMA[i]-DARFACTOR[i]; if ((RSIMA[i-1] > result[i-1]) AND (result[i] < result[i-1])) { result[i] = result[i-1]; } } } } return result; } QQE_FastSignal = QQE_TR(QQE_RSI_MA,QQE_DAR_Fast); QQE_SlowSignal = QQE_TR(QQE_RSI_MA,QQE_DAR); Plot(QQE_RSI_MA,"QQE"+ _PARAM_VALUES(),ParamColor("QQE color", colorRed ), ParamStyle("QQE style",styleThick)); Plot(QQE_FastSignal, "FastSignal", ParamColor("FastSignal color", colorOrange ), ParamStyle("FastSignal style",styleDashed) ); Plot(QQE_SlowSignal, "SlowSignal", ParamColor("SlowSignal color", colorBlue ), ParamStyle("SlowSignal style",styleDashed) ); Buy = Cross(QQE_RSI_MA, QQE_SlowSignal); Sell = Cross(QQE_SlowSignal, QQE_RSI_MA); Short=Sell; Cover=Buy; shape = Buy * shapeUpArrow + Sell * shapeDownArrow; PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, QQE_RSI_MA ); _SECTION_END();
--  作者:阿火
--  发布时间:2011/5/3 20:34:32
--  

把指标的具体算法介绍一下,热心人士才能帮你


--  作者:newstar20088
--  发布时间:2011/5/4 0:51:19
--  如何在金字塔里编辑外软指标__QQE
使用通达信编译部分以下,由于通达信没有循环语句,所以寄望于金字塔,卡在如何在金字塔里编译自定义函数——function QQE_TR(RSIMA, DARFACTOR) 。 QQE_Periods:=14; QQE_SF:=5; LC:=REF(CLOSE,1); RSI(QQE_Periods):=SMA(MAX(CLOSE-LC,0),QQE_Periods,1)/SMA(ABS(CLOSE-LC),QQE_Periods,1)*100; RSIMA:= EMA(RSI(QQE_Periods),QQE_SF); ATRRSI:= abs(Ref(RSIMA,-1)-QQE_RSI_MA); MAATRRSI:= EMA(ATRRSI, 2*QQE_Periods-1); DAR:= EMA(MAATRRSI, 2*QQE_Periods-1)*4.236; DAR_Fast:= EMA(MAATRRSI, 2*QQE_Periods-1)*2.618; 下面就是自定义函数:数组result[ i ]与RSIMA[i]比较,然后分别获值:result[i]=RSIMA[i]+DARFACTOR[i],result[i]=RSIMA[i]-DARFACTOR[i],且在设定条件下result[i] = result[i-1]。。。 function QQE_TR(RSIMA, DARFACTOR) { result[ 0 ] = 0; for( i = 1; i < BarCount; i++ ) { if (RSIMA[i] < result[i-1]) { result[i]=RSIMA[i]+DARFACTOR[i]; if ((RSIMA[i-1] < result[i-1]) AND (result[i] > result[i-1])) { result[i] = result[i-1]; } } else { if (RSIMA[i] > result[i-1]) { result[i]=RSIMA[i]-DARFACTOR[i]; if ((RSIMA[i-1] > result[i-1]) AND (result[i] < result[i-1])) { result[i] = result[i-1]; } } } } return result; } 然后输出以下三条线就是 QQE指标了, FastSignal:= QQE_TR(RSIMA,QQE_DAR_Fast); SlowSignal:= QQE_TR(RSIMA,QQE_DAR); RSIMA;
--  作者:admin
--  发布时间:2011/5/4 9:03:09
--  
格式太乱没法看,请用IE浏览器发帖
--  作者:newstar20088
--  发布时间:2011/5/4 14:02:20
--  如何在金字塔里编辑外软指标__QQE
使用通达信编译部分以下,由于通达信没有循环语句,所以寄望于金字塔,卡在如何在金字塔里编译自定义函数——function QQE_TR(RSIMA, DARFACTOR) 。
 
QQE_Periods:=14;
QQE_SF:=5;
LC:=REF(CLOSE,1);
RSI(QQE_Periods):=SMA(MAX(CLOSE-LC,0),QQE_Periods,1)/SMA(ABS(CLOSE-LC),QQE_Periods,1)*100;
RSIMA:= EMA(RSI(QQE_Periods),QQE_SF);
ATRRSI:= abs(Ref(RSIMA,-1)-QQE_RSI_MA);
MAATRRSI:= EMA(ATRRSI, 2*QQE_Periods-1);
DAR:= EMA(MAATRRSI, 2*QQE_Periods-1)*4.236;
DAR_Fast:= EMA(MAATRRSI, 2*QQE_Periods-1)*2.618;
 
下面就是自定义函数,如何在金字塔里编译它:数组result[ i ]与RSIMA[i]比较,然后分别获值:result[i]=RSIMA[i]+DARFACTOR[i],result[i]=RSIMA[i]-DARFACTOR[i],且在设定条件下result[i] = result[i-1]。。。
function QQE_TR(RSIMA, DARFACTOR)
{
    result[ 0 ] = 0;
 
    for( i = 1; i < BarCount; i++ )
    {
 
       if (RSIMA[i] < result[i-1])
       {
       
           result[i]=RSIMA[i]+DARFACTOR[i];
 
           if ((RSIMA[i-1] < result[i-1]) AND (result[i] > result[i-1]))
              {
              result[i] = result[i-1];
              }
       }
       else
       {
 
           if (RSIMA[i] > result[i-1])
              {
 
              result[i]=RSIMA[i]-DARFACTOR[i];
 
              if ((RSIMA[i-1] > result[i-1]) AND (result[i] < result[i-1]))
                 {
                 result[i] = result[i-1];
                 }
 
              }
 
       }
 
    }
 
   return result;
}
 
然后输出以下三条线就是 QQE指标了:
FastSignal:= QQE_TR(RSIMA,QQE_DAR_Fast);
SlowSignal:= QQE_TR(RSIMA,QQE_DAR);
RSIMA;