欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 加仓模型

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有9722人关注过本帖树形打印复制链接

主题:加仓模型

美女呀,离线,留言给我吧!
pyd
  51楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2014/10/17 13:38:18    Post IP:58.246.57.26[只看该作者]

代码里a<6,b<6就是限制6次,加上第一次开仓一共是7次,手数依次是:开1手,加仓分别是2,4,8,16,32,64.

新建一个公式,复制下边的代码,不要做任何修改。

VARIABLE:a=0,b=0,s1=2,s2=2;
m:=26;
k:=2;
MID:  MA(CLOSE,M);//布林中轨
UPPER: MID + K*STD(CLOSE,M);//布林上轨
LOWER: MID - K*STD(CLOSE,M);//布林下轨


kk:cross(h,upper);
kd:cross(l,lower);
tt:=upper-lower>=30;

if kd and tt and holding=0 then begin
buy(1,1,market);
a:=0;
s1:=2;
end
if enterprice-l=13 and holding>0 and a<6 then begin
buy(1,s1,market);
a:=a+1;
s1:=2*s1;
end
if h-enterprice>=16 then sell(holding>0,holding,market);//多头止盈
if enterprice-l>=100 then sell(holding>0,holding,market);//多头止损

if kk and tt and holding=0 then begin
 buyshort(1,1,market);
 b:=0;
 s2:=2;
 end
if enterprice-l=13 and holding<0 and b<6 then begin
buyshort(1,s2,market);
b:=b+1;
s2:=2*s2;
end
if enterprice-l>=16 then sellshort(holding<0,holding,market);//空头止盈
if h-ENTERPRICE>=100 then sellshort(holding<0,holding,market);//空头止损


 


 回到顶部
帅哥哟,离线,有人找我吗?
qwe8899
  52楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:26 积分:0 威望:0 精华:0 注册:2014/10/16 10:25:49
  发帖心情 Post By:2014/10/17 13:54:01    Post IP:59.36.148.249[只看该作者]

51楼代码用在股票上怎么无信号出呢

 回到顶部
美女呀,离线,留言给我吧!
pyd
  53楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2014/10/17 14:19:21    Post IP:58.246.57.26[只看该作者]

不是一个公式适用于所有品种,请用户自己先学习下基本的代码知识

http://www.weistock.com:8080/down/html/?16.html

http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=1246

 


 回到顶部
帅哥哟,离线,有人找我吗?
qwe8899
  54楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:26 积分:0 威望:0 精华:0 注册:2014/10/16 10:25:49
  发帖心情 Post By:2014/10/17 14:23:36    Post IP:59.36.148.249[只看该作者]

帮我改在股票上用好吗.麻烦了谢谢!
[此贴子已经被作者于2014/10/17 14:24:22编辑过]

 回到顶部
美女呀,离线,留言给我吧!
pyd
  55楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2014/10/17 14:35:08    Post IP:58.246.57.26[只看该作者]

股票那么多品种,代码上下轨和品种价格有关,只是凑信号毫无意义,

请客户自己学习基本代码知识便于理解和编写。


 回到顶部
帅哥哟,离线,有人找我吗?
qwe8899
  56楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:26 积分:0 威望:0 精华:0 注册:2014/10/16 10:25:49
  发帖心情 Post By:2014/10/17 14:46:53    Post IP:59.36.148.249[只看该作者]

如下代码请改为日内交易.要求2点55分前强平所有仓位.谢谢!


VARIABLE:a=0,b=0,s1=2,s2=2;
m:=26;
k:=2;
MID:  MA(CLOSE,M);//布林中轨
UPPER: MID + K*STD(CLOSE,M);//布林上轨
LOWER: MID - K*STD(CLOSE,M);//布林下轨


kk:cross(h,upper);
kd:cross(l,lower);
tt:=upper-lower>=30;

if kd and tt and holding=0 then begin 
buy(1,1,market);
a:=0;
s1:=2;
end
if enterprice-l=13 and holding>0 and a<6 then begin
buy(1,s1,market);
a:=a+1;
s1:=2*s1;
end
if h-enterprice>=16 then sell(holding>0,holding,market);//多头止盈
if enterprice-l>=100 then sell(holding>0,holding,market);//多头止损

if kk and tt and holding=0 then begin
 buyshort(1,1,market);
 b:=0;
 s2:=2;
 end
if enterprice-l=13 and holding<0 and b<6 then begin
buyshort(1,s2,market);
b:=b+1;
s2:=2*s2;
end
if enterprice-l>=16 then sellshort(holding<0,holding,market);//空头止盈
if h-ENTERPRICE>=100 then sellshort(holding<0,holding,market);//空头止损


 回到顶部
美女呀,离线,留言给我吧!
pyd
  57楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2014/10/17 15:06:52    Post IP:58.246.57.26[只看该作者]

15分钟周期?最后几点平仓和周期是有关系的

 回到顶部
美女呀,离线,留言给我吧!
pyd
  58楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2014/10/17 15:51:42    Post IP:58.246.57.26[只看该作者]

下面是rb00,15分钟周期,收盘前最后一根k平仓。

不要随意换品种和周期测试。

VARIABLE:a=0,b=0,s1=2,s2=2;
m:=26;
k:=2;
MID:  MA(CLOSE,M);//布林中轨
UPPER: MID + K*STD(CLOSE,M);//布林上轨
LOWER: MID - K*STD(CLOSE,M);//布林下轨


kk:cross(h,upper);
kd:cross(l,lower);
tt:=upper-lower>=30;
t:=time>090000 and time<=144500;

if kd and tt and t and holding=0 then begin
buy(1,1,market);
a:=0;
s1:=2;
end
if enterprice-l=13 and t and  holding>0 and a<6 then begin
buy(1,s1,market);
a:=a+1;
s1:=2*s1;
end
if h-enterprice>=16 then sell(holding>0,holding,market);//多头止盈
if enterprice-l>=100 then sell(holding>0,holding,market);//多头止损

if kk and tt and t and holding=0 then begin
 buyshort(1,1,market);
 b:=0;
 s2:=2;
 end
if enterprice-l=13 and t and holding<0 and b<6 then begin
buyshort(1,s2,market);
b:=b+1;
s2:=2*s2;
end
if enterprice-l>=16 then sellshort(holding<0,holding,market);//空头止盈
if h-ENTERPRICE>=100 then sellshort(holding<0,holding,market);//空头止损

if time>=144500 then sell(holding>0,holding,market);
if time>=144500 then sellshort(holding<0,holding,market);


 回到顶部
帅哥哟,离线,有人找我吗?
qwe8899
  59楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:26 积分:0 威望:0 精华:0 注册:2014/10/16 10:25:49
  发帖心情 Post By:2014/10/20 8:38:18    Post IP:59.37.243.168[只看该作者]

老师早上好!

如下代码请改成股票模型.谢谢!!



VARIABLE:a=0,b=0,s1=2,s2=2;
m:=26;
k:=2;
MID:  MA(CLOSE,M);//布林中轨
UPPER: MID + K*STD(CLOSE,M);//布林上轨
LOWER: MID - K*STD(CLOSE,M);//布林下轨


kk:cross(h,upper);
kd:cross(l,lower);
tt:=upper-lower>=30;

if kd and tt and holding=0 then begin 
buy(1,1,market);
a:=0;
s1:=2;
end
if enterprice-l=13 and holding>0 and a<6 then begin
buy(1,s1,market);
a:=a+1;
s1:=2*s1;
end
if h-enterprice>=16 then sell(holding>0,holding,market);//多头止盈
if enterprice-l>=100 then sell(holding>0,holding,market);//多头止损

if kk and tt and holding=0 then begin
 buyshort(1,1,market);
 b:=0;
 s2:=2;
 end
if enterprice-l=13 and holding<0 and b<6 then begin
buyshort(1,s2,market);
b:=b+1;
s2:=2*s2;
end
if enterprice-l>=16 then sellshort(holding<0,holding,market);//空头止盈
if h-ENTERPRICE>=100 then sellshort(holding<0,holding,market);//空头止损



 回到顶部
美女呀,离线,留言给我吧!
pyd
  60楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:8439 积分:0 威望:0 精华:0 注册:2014/7/14 13:43:36
  发帖心情 Post By:2014/10/20 9:25:32    Post IP:58.246.57.26[只看该作者]

股票那么多品种,具体是哪个品种?

例如浦发银行上轨下跪差距零点一多,源代码是(上轨-下轨)>=30肯定是不会有信号,把30改成一个合适的数字才会有信号。


 回到顶部
总数 62 上一页 1 2 3 4 5 6 7 下一页