Rss & SiteMap

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

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

标题:[原创]

1楼
苦麻菜真好吃 发表于:2016/6/15 14:35:43
麻烦老师帮我写个代码,当持有多仓时,1、设置初始止损20个点,
                                                 2、当盈利20个点时,加仓一手,同时把止损移动到第一次开仓位置。
                                                  3、加仓的基础上盈利20个点,再次加仓1手,同时把止损移动到第一次加仓位置;
                                                  4、以此类推,每盈利20个点加仓一次、同时移动止损。。最大加仓次数不超过5次。。。




空仓我就自己写了,麻烦老师示范一下

2楼
jinzhe 发表于:2016/6/15 14:45:14
开仓价位和加仓价位是指定的还是市价?
3楼
苦麻菜真好吃 发表于:2016/6/15 14:55:44
开仓是指定价、加仓是市价
4楼
jinzhe 发表于:2016/6/15 15:09:38

variable:N=0;
variable:zs=0;
if holding=0 and 开仓条件 then BEGIN 
    buy(1,1,limitr,指定的价格);
   
end
if holding>0 and c>enterprice+20 and n<5 then begin
    zs:=enterprice;
    buy(1,1,marketr);
    n:=n+1;
end

if holding>0 and n=0 and c<enterprice-20  then begin
     sell(1,0,marketr);
end
if holding>0 and n>0 and c<zs-20 then begin
     sell(1,0,marketr);
     n:=0;
end

5楼
jinzhe 发表于:2016/6/15 15:09:55

这里有“平仓后加仓次数重置为0”的设定

[此贴子已经被作者于2016-6-15 15:10:02编辑过]
6楼
苦麻菜真好吃 发表于:2016/6/15 15:17:02
谢谢老师!
共6 条记录, 每页显示 10 条, 页签: [1]


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