以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://www.weistock.com/bbs/list.asp?boardid=4) ---- [求助]以当前K线最低或者最高值与均线距离作为进场条件,该怎么写 (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=63634) |
-- 作者:一叶知秋 -- 发布时间:2014/4/8 16:59:48 -- [求助]以当前K线最低或者最高值与均线距离作为进场条件,该怎么写 [求助]以当前K线最低或者最高值与均线距离作为进场条件或离场条件,该怎么写 比如在20均线上方 最低价大于均线,距离均线10个点,开仓做多,最低价跌破均线止损 在20均线下方 最高价小于均线,距离均线10个点,开仓做空,最高价上破均线止损 对代码不熟悉,最好能详细些 |
-- 作者:jinzhe -- 发布时间:2014/4/8 17:16:54 -- ma20:ma(c,20); duo:l>ma20 and l-ma20>=10*mindiff; kong:h<ma20 and ma20-h>=10*mindiff; if duo then buy(holding=0,1,market); if kong then buyshort(holding=0,1,market); if cross(ma20,l) and holding>0 then sell(1,0,market); if cross(h,ma20) and holding<0 then sellshort(1,0,market);
|