以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [求助]想从开拓者哪里嫁接一个模型去金字塔用  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=50400)

--  作者:XO仔
--  发布时间:2013/3/29 10:11:55
--  [求助]想从开拓者哪里嫁接一个模型去金字塔用
下边的思路希望各位老师帮忙修改成简单的金字塔模型,好让我学习学习,谢谢!!


Params
Numeric offset(0);
Numeric funds(10000);
Numeric lotPercent(0.25);

Vars
NumericSeries HighLine_yesterday;
NumericSeries LowLine_yesterday;
Numeric lots;

Begin

lots = 0;//IntPart(lotPercent * (funds + NetProfit) / (Close[1] * ContractUnit * MarginRatio));
//PlotNumeric("lots",lots);
//PlotNumeric("ContractUnit",ContractUnit);

HighLine_yesterday = HighD(1);
LowLine_yesterday = LowD(1);

PlotNumeric("HighLine_yesterday",HighLine_yesterday);
PlotNumeric("LowLine_yesterday",LowLine_yesterday);

If(High > HighLine_yesterday And MarketPosition <= 0)
{Buy(lots , HighLine_yesterday + offset);
}
If(Low < LowLine_yesterday And MarketPosition >= 0 )
{SellShort(lots , LowLine_yesterday - offset);}

End


--  作者:jinzhe
--  发布时间:2013/3/29 10:21:35
--  

不解释一下这些话的意思,我们怎么处理。。。


--  作者:XO仔
--  发布时间:2013/3/29 10:27:00
--  
引用了昨天的 H 和 L  在一分钟周期里边 只有价格突破昨天的H 就做多 突破昨天的L就追空  都是平仓反手操作
--  作者:jinzhe
--  发布时间:2013/3/29 10:34:30
--  

h_zuori:=callstock(stklabel,vthigh,6,-1);

l_zuori:=callstock(stklabel,vtlow,6,-1);

 

if h>h_zuori then begin

sellshort(holding<0,0,thisclose);

buy(holding=0,1,thisclose);

end

 

if l<l_zuori then begin

sell(holding>0,0,thisclose);

buyshort(holding=0,1,thisclose);

end