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


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

   

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


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

主题:求tb改金字塔

帅哥哟,离线,有人找我吗?
kongfzchina
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:59 积分:358 威望:0 精华:0 注册:2012/4/13 14:03:48
求tb改金字塔  发帖心情 Post By:2012/10/9 19:29:21    Post IP:175.160.199.36[只看该作者]

//------------------------------------------------------------------------
// 简称: JYXT_Aberration
// 名称: Aberration
// 类别: 公式应用
// 类型: 用户应用
// 输出:Rookies
//------------------------------------------------------------------------
Params
Numeric Length(35);
Numeric StdDevUp(2.0);
Numeric StdDevDn(-2.0);
Numeric Lots(1);


Vars
NumericSeries UpperBand;
NumericSeries LowerBand;
NumericSeries AveMa;
Numeric StdValue;


Begin

AveMa=Average(Close[1],Length);
StdValue = StandardDev(Close[1],Length);

UpperBand=Avema+StdDevUp*StdValue;
LowerBand=Avema-StdDevUp*StdValue;
PlotNumeric("UpperBand",UpperBand);
PlotNumeric("LowerBand",LowerBand);

PlotNumeric("AveMa",AveMa);
If(MarketPosition!=1 &&CrossOver(Close[1],UpperBand[1]))
{
Buy(Lots,Open);
}

If(MarketPosition!=-1 &&CrossUnder(Close[1],LowerBand[1]))
{
SellShort(Lots,Open);
}

If(MarketPosition==1 && Close[1]<AveMa[1])
{
Sell(Lots,Open);

}

If(MarketPosition==-1 && Close[1]>AveMa[1])
{

BuyToCover(Lots,Open);
}

End

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


加好友 发短信
等级:论坛游民 帖子:211 积分:703 威望:0 精华:0 注册:2012/10/9 9:06:01
  发帖心情 Post By:2012/10/10 9:07:53    Post IP:58.246.57.26[只看该作者]

对TB的有些函数不熟悉,速度慢不说,可能还会改的不达效果.

 

推荐楼主把想改的这段TB的代码,用自然语言的形式描述出来,让客服直接用金字塔的语言去实现


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


加好友 发短信
等级:新手上路 帖子:3 积分:20 威望:0 精华:0 注册:2012/10/11 9:42:49
  发帖心情 Post By:2012/10/12 11:23:51    Post IP:183.62.101.1[只看该作者]

供参考

input: length(25,10,60,1);
input: stdDevUp(2,0.1,4,0.2);
input: stdDevDn(2,0.1,4,0.2);

variable: stdValue=0;
variable: Lots=1;
VARIABLE: isThisBarTrade=0;

isThisBarTrade:=0;
AveMa:=ma(ref(close,1),length);
stdValue:=std(ref(close,1),length);
UpperBand:=Avema + stdDevUp * stdValue;
LowerBand:=AveMa - stdDevDn * stdValue;

buy_cond:=cross(ref(close,1),ref(UpperBand,1));
buyshort_cond:=cross(ref(lowerBand,1),ref(close,1));
sell_cond:=ref(close,1)<ref(AveMa,1);
sellshort_cond:=ref(close,1)>ref(AveMa,1);
Long_EntryPrice:=open+2*MINDIFF;
Short_EntryPrice:=open-2*MINDIFF;

if holding<>1 and buy_cond and not(isThisBarTrade) then begin
buy(1,lots,limitr,Long_EntryPrice);
isThisBarTrade:=1;
end;
else if holding<>-1 and buyshort_cond and not(isThisBarTrade) then begin
buyshort(1,lots,limitr,Short_EntryPrice);
isThisBarTrade:=1;
end;
else if holding=1 and sell_cond and not(isThisBarTrade) then begin
sell(1,lots,limitr,Short_EntryPrice);
end;
else if holding=-1 and sellshort_cond and not(isThisBarTrade) then begin
sellshort(1,lots,limitr,Long_EntryPrice);
end;

资产:ASSET,NOAXIS;
可用现金:CASH(0),LINETHICK0;
持仓:HOLDING,LINETHICK0;

版主评定:好评,获得2个金币奖励好评,获得2个金币奖励
(理由:非常棒)
 回到顶部