金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 3307|回复: 2

反向交易问题

[复制链接]

46

主题

125

帖子

125

积分

等级: 免费版

注册:
2021-12-19
曾用名:
发表于 2022-6-28 12:11 | 显示全部楼层 |阅读模式
各位论坛里的老师,我发现软件自带的双向海龟交易系统在做策略测试时成功率较低,尤其是开多或开空加仓的第4次(手)时。可不可以修改一下,将原来的开多改为开空、开空改为开多,并设置恰当的止损空间,在较短周期高频交易中测试一下,应该成功率较高。另外,软件原来的海龟交易系统公式太复杂,我们初学者难弄懂,论坛里有位老师发了一个改动的,但开仓量太大,能否专门设一个可调节变量。谢谢!


TRR:=MAX(MAX((HIGH-LOW),ABS(REF(CLOSE,1)-HIGH)),ABS(REF(CLOSE,1)-LOW));//真实波幅
ATR:=ref(MA(TRR,20),1); //波幅的20日均线
unit:(asset*0.01)/(MULTIPLIER*atr);

INPUT:X(20,1,100,5);
X周期高点:=REF(HHV(H,X),1);//X是参数,自行调整
X周期低点:=REF(LLV(L,X),1);

//记录建仓的atr
variable:entry=0;
//记录交易次数
variable:num=0;
//入场条件:
开多条件:=High>=X周期高点 and barpos>20;
开空条件:=Low<=X周期低点 and barpos>20;

//建立头寸
if 开多条件 and holding=0 then
begin
buy(1,unit,marketr);
entry:=atr;
num:=1;
end

if 开空条件 and holding=0 then
begin
buyshort(1,unit,marketr);
entry:=atr;
num:=1;
end


//每盈利0.5个atr加仓,最多加4次
if holding>0 and high>enterprice+0.5*entry and num<4 then
begin
buy(1,unit,marketr);
num:=num+1;
end

if holding<0 and low<enterprice-0.5*entry and num<4 then
begin
buyshort(1,unit,marketr);
num:=num+1;
end

//统计出场和止损的次数
variable:n1=0,n2=0;

//止损2个atr
if holding>0 and low<enterprice-2*entry and holding>0 then
begin
sell(1,holding,marketr);
n1:=n1+1;
end
if holding<0 and high>enterprice+2*entry and holding<0 then
begin
sellshort(1,holding,marketr);
n1:=n1+1;
end

//破短期高低位,平仓出场
INPUT:Y(10,1,100,5);
Y周期高点:=REF(HHV(H,10),1);
Y周期低点:=REF(LLV(L,10),1);
if low<Y周期低点 and holding>0 then
begin
sell(1,holding,marketr);
n2:=n2+1;
end
if high>Y周期高点 and holding<0 then
begin
sellshort(1,holding,marketr);
n2:=n2+1;
end


回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2022-6-28 13:32 | 显示全部楼层
简单的下单语句替换,这种是最基本的编写了吧?buy 和buyshort ,sell 和sellshort  互换下就行了。holding>0 的判断改成holding>0 的判断。你可以自行尝试修改下。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

46

主题

125

帖子

125

积分

等级: 免费版

注册:
2021-12-19
曾用名:
 楼主| 发表于 2022-6-28 14:13 | 显示全部楼层
这个我是知道的,主要是上面的程序中有一些语句搞不懂,比如 buy(1,unit,marketr) ,括号里面的1是指什么?开仓量能否控制在5手以内
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 微信登录

本版积分规则

手机版|小黑屋|上海金之塔信息技术有限公司 ( 沪ICP备13035422号 )

GMT+8, 2025-7-16 17:34 , Processed in 0.161613 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表