Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请老师编制一个移动止损的范例学习,谢谢!

1楼
tanganquan 发表于:2012/4/16 23:55:12
请老师编制一个移动止损的范例学习,谢谢!
要在图表程序化交易里面能实现的!
2楼
Leon 发表于:2012/4/17 8:33:32

//A有三种数值状态:1,0,最新价;
//当A=1时表示当前有持仓,A=0时表示移动止损执行完毕,A=最新价时用于比较价格是否回落

 

//将A赋值为1,表示当前有持仓
IF TBUYHOLDINGEX( '','' ,0 )>0 AND EXTGBDATA('a' )=0 THEN BEGIN
EXTGBDATASET( 'a',1 );
END

//使A始终表示监控开始后的最高价
IF DYNAINFO(  7)>EXTGBDATA('a' ) and EXTGBDATA('a' )>0 THEN BEGIN
EXTGBDATASET( 'a',DYNAINFO(  7));
END

//发现价格回落止损,并将A赋值为0表示移动止损动作完成
IF EXTGBDATA('a' )-DYNAINFO(  7)>5*MINDIFF and EXTGBDATA('a' )>0 THEN BEGIN
TSELL(1,1,MKT );
EXTGBDATASET( 'a',0);
END

3楼
董小球 发表于:2012/4/17 8:49:01
论坛里搜移动止损 也有很多例子
http://www.weistock.com/bbs/Query.asp


http://www.weistock.com/bbs/dispbbs.asp?BoardID=10&ID=6927&skin=0
[此贴子已经被作者于2012-4-17 8:55:29编辑过]
4楼
rushtaotao 发表于:2012/4/17 8:50:45

//2楼给出的是后台程序化交易,无法满足您的图标交易要求,给出个移动止盈的例子,道理是一样的,供参考


kkcon:=0;
//(1)触发条件,开空1手
if KKcon THEN buyshort(1,1,market);

//(2)开仓后不利>=3个指数点止损
if l > enterprice + 3 then sellshort(1,0,market);

//(3)止赢1:赢利>=8个指数点后回撤>=5个指数点,止赢
if holding<0 and c<=enterprice - 8 then
   begin
        maxpro:=c;
        if c >= maxpro -5 then sellshort(1,0,market);
   end

//(4)止赢2:赢利>=15个指数点后回撤>=3个指数点,止赢
if holding<0 and c<=enterprice - 15 then
   begin
        maxpro:=c;
        if c >= maxpro - 3 then sellshort(1,0,market);
   end

//(5)止赢3:赢利>=20个指数点后回撤>=2个指数点,止赢
if holding<0 and c<=enterprice - 20 then
   begin
        maxpro:=c;
        if c >= maxpro - 2 then sellshort(1,0,market);
   end

//(6)止赢3:赢利>=25个指数点,止赢
if holding<0 and c<=enterprice - 25 then sellshort(1,0,market);

//平所有仓
if time>=145900 then
begin
     sellshort(1,0,market);
     sell(1,0,market);
end

共4 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.06250 s, 3 queries.