以下是文华ATR多空交易源码 带止损止赢(无源码的请下载附件导入)
源码内容:参数[N 1 999 10 ] [M 1 999 10] [P 0 999 1]
TR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));
ATR:=EMA(TR,N);
EMA1:=EMA(CLOSE,M);
CLOSE>REF(C,P)&&CLOSE>EMA1+R*ATR&&TIME<1457,BPK;
CLOSE<REF(C,P)&&CLOSE<EMA1-R*ATR&&TIME<1457,SPK;
CLOSEMINUTE<=3||BKPRICE-C>=200,SP;
CLOSEMINUTE<=3||C-SKPRICE>=200,BP;
AUTOFILTER;
==================================
源码解析:
TR赋值:(最高价-最低价)和昨收-最高价的绝对值的较大值和昨收-最低价的绝对值的较大值
ATR赋值:真实波幅的N日指数移动平均
EMA1赋值:收盘价的M日指数移动平均
收盘价>P日前的收盘价并且收盘价>EMA1+R*ATR并且时间<1457,BPK
收盘价<P日前的收盘价并且收盘价<EMA1-R*ATR并且时间<1457,SPK
CLOSEMINUTE<=3或者BKPRICE-收盘价>=200,SP
CLOSEMINUTE<=3或者收盘价-SKPRICE>=200,BP
AUTOFILTER
|