以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  条件共存  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=161794)

--  作者:NH
--  发布时间:2018/3/1 18:30:08
--  条件共存
ct:cross(ma10,ma5);

PD:=CROSS(MA20,MA10);

平多:SELL(PD,0,THISCLOSE);  

if PD then
begin
sell(1,if(ct=1 or ct=2 or ct=3,holding/3,holding/2),THISCLOSE);
end;


我要实现在  if PD 第一次平1/3仓,第二次平1/3仓,第三次全平。如何实现 平多 和 if PD
图片点击可在新窗口打开查看此主题相关图片如下:qq图片20180301182221.png
图片点击可在新窗口打开查看

--  作者:FexTel
--  发布时间:2018/3/2 9:13:13
--  
variable:ypcs=0; //ypcs表示pd的满足次数,开仓后您需要把ypcs重新置到0
ct:cross(ma10,ma5);

PD:=CROSS(MA20,MA10);

if ypcs<2 THEN
ss:=intpart(holding/3);
else ss:=holding;

if PD and holding>0 then
begin
sell(1,ss,THISCLOSE);
ypcs:=ypcs+1;
end;
[此贴子已经被作者于2018/3/2 9:14:22编辑过]