资源描述:
《文华财经程序化模型》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、均线与MACD条件单模型源码思路内容:条件:K线为5分钟线,指数高于MA5三个点位,同时DIFF线向上,并且DIFF高于0轴线,买入。应该如何编写,希望老师指导文华技术人员:MA5:MA(C,5);DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);//短周期与长周期的收盘价的指数平滑移动平均值做差。DEA:EMA(DIFF,9);//DIFF的M个周期指数平滑移动平均来源www.cxh99.comC>MA5+3*A&&DIFF>REF(DIFF,1)&&DIFF>0,BK;小波段智能策略模型源码A:=REF(HIG
2、H,1)-REF(LOW,1);B:=REF(HIGH,2)-REF(LOW,2);C1:=REF(HIGH,3)-REF(LOW,3);D:=A*0.2+B*0.3+C1*0.5;J:=N/100;K:=M/100;(CLOSE-OPEN)>D*J,bK;(OPEN-CLOSE)>D*K,sP;(OPEN-CLOSE)>D*K,sK;(CLOSE-OPEN)>D*J,bP;AUTOFILTER;文华股指1分钟MACD结合交易模型源码源码解析:A赋值:昨日最高价-昨日最低价B赋值:2日前的最高价-2日前的最低价C1赋值:3日前的最
3、高价-3日前的最低价D赋值:A*0.2+B*0.3+C1*0.5J赋值:N/100K赋值:M/100(收盘价-开盘价)>D*J,BK(开盘价-收盘价)>D*K,SP(开盘价-收盘价)>D*K,SK(收盘价-开盘价)>D*J,BP用在IF主力合约,K线周期为1分钟。DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);DEA:=EMA(DIFF,9);MACD:=2*(DIFF-DEA);//MACDF:=REF(AVPRICE,BARSBK);//调用买开那根K的线的均线价格G:=REF(AVPRICE,BARSSK
4、);BK1:=MACD>REF(MACD,1)ANDREF(MACD,1)>REF(MACD,2);BK2:=MACD<=-0.5ANDREF(MACD,2)<=LLV(MACD,10);BK1ANDBK2,BK;SP1:=L<=BKPRICE-5;//买开后,最低价低于买开价5个点以上止损SP2:=MACD>=0.5ANDREF(MACD,1)>=HHV(MACD,10)ANDMACD<=REF(MACD,1);SP1ORSP2,SP;SK1:=MACD5、;//cxh99.comSK2:=MACD>=0.5ANDREF(MACD,2)>=HHV(MACD,10);SK1ANDSK2,SK;BP1:=C>=G+5;BP2:=MACD<=-0.5ANDREF(MACD,1)<=LLV(MACD,10)ANDMACD>=REF(MACD,1);BP1ORBP2,BP;AUTOFILTER;源码解析:DIFF赋值:收盘价的12日指数移动平均-收盘价的26日指数移动平均DEA赋值:DIFF的9日指数移动平均MACD赋值:2*(DIFF-DEA)MACDF赋值:BARSBK日前的AVPRICE
6、线的均线价格G赋值:BARSSK日前的AVPRICEBK1赋值:MACD>昨日MACDcxh99.comAND昨日MACD>2日前的MACDBK2赋值:MACD<=-0.5AND2日前的MACD<=10日内MACD的最低值BK1ANDBK2,BKSP1赋值:最低价<=BKPRICE-5止损SP2赋值:MACD>=0.5AND昨日MACD>=10日内MACD的最高值ANDMACD<=昨日MACDSP1ORSP2,SPSK1赋值:MACD<昨日MACDAND昨日MACD<2日前的MACDSK2赋值:MACD>=0.5AND2日前的MA
7、CDCXH99.COM>=10日内MACD的最高值SK1ANDSK2,SKBP1赋值:收盘价>=G+5BP2赋值:MACD<=-0.5AND昨日MACD<=10日内MACD的最低值ANDMACD>=昨日MACDBP1ORBP2,BPAUTOFILTER股指期货IF专用MACD交易模型源码DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);DEA:=EMA(DIFF,9);MACD:=2*(DIFF-DEA);//MACDF:=REF(AVPRICE,BARSBK);//调用买开那根K的线的均线价格G:=REF(AV
8、PRICE,BARSSK);BK1:=MACD>REF(MACD,1)ANDREF(MACD,1)>REF(MACD,2);BK2:=MACD<=-0.5ANDREF(MACD,2)<=LLV(MACD,10);BK1ANDBK2,BK;SP1:=