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


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

   

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


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

主题:[求助]

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


加好友 发短信
等级:新手上路 帖子:5 积分:13 威望:0 精华:0 注册:2011/5/7 15:23:16
[求助]  发帖心情 Post By:2011/6/17 15:20:11    Post IP:180.168.151.50[只看该作者]

请各位高手指点迷津:

AlliPTMD为主公式 调用Alligator指标和PTMD指标(副图)

 

没法正常开平仓 只能收盘根据30分钟大势平仓,该怎么修改能够正常开平仓?

 

Alligator

 

input:主体颚1(8,3,21,5),主体齿1(5,2,13,4),主体唇1(3,1,8,3),主体颚2(13,3,21,5),主体齿2(8,2,13,4),主体唇2(5,1,8,3);
BENCHMARKPRICE:= 0.236*O+0.191*H+0.191*L+0.382*C;
subjectMANDIBLE:SMA(BENCHMARKPRICE,主体颚1,1),linethick0;
subjectTOOTH:SMA(BENCHMARKPRICE,主体齿1,1),linethick0;
subjectUPPERlip:SMA(BENCHMARKPRICE,主体唇1,1),linethick0;

subMANDIBLE:SMA(BENCHMARKPRICE,主体颚2,1),linethick0;
subTOOTH:SMA(BENCHMARKPRICE,主体齿2,1),linethick0;
subUPPERlip:SMA(BENCHMARKPRICE,主体唇2,1),linethick0;

 

 

PTMD

input:short(21,5,50,5),long(34,8,80,8),Median(13,3,30,3);
dif:ema(close,short)-ema(close,long),linethick0;
dea:ema(dif,Median),linethick0;

 

AlliPTMD

input:jaw(8,3,21,3),ivary(5,2,13,2),labium(3,1,8,1),openPos(80,0,100,1);

runmode:0;
//variable:myholding=0;
Positions:=(asset*0.01*openPos)/(c*multiplier*0.16);
contractsNUM:=INTPART(Positions);
tradingHours:=time>090000 and time<150000;
closingPosTM:=time>145000 and time<=145500;

BMPRICE:=0.236*Open+0.191*High+0.191*Low+0.382*Close;
defaultMANDIBLE:=SMA(BMPRICE,jaw,1),colorblue;
defaultTOOTH:=SMA(BMPRICE,ivary,1),colorred;
defaultUPPERLIP:=SMA(BMPRICE,labium,1),colorgreen;
TdLn:SMA(BMPRICE,13,1),linethick0;{trendLine}
RtLn:SMA(BMPRICE,78,1),linethick0;{routeLine}

objectlongcond:=defaultTOOTH>=defaultMANDIBLE and defaultUPPERLIP>=defaultTOOTH;
objectshortcond:=defaultTOOTH>=defaultUPPERLIP and defaultMANDIBLE>=defaultTOOTH;

recDIF:=STKINDI('srx01','PTMD.dif(21,34,13)',0,11,0);{"PTMD.dif#min15"(21,34,13);}
recDEA:=STKINDI('srx01','PTMD.dea(21,34,13)',0,11,0);{"PTMD.dea#min15"(21,34,13);}
subjectbullishsig:=recDIF>=recDEA;
subjectbearishsig:=recDIF<=recDEA;

inlongpos:=ALL(objectlongcond and subjectbullishsig,1);
outlongpos:=ALL(objectshortcond and subjectbearishsig,1);
inshortpos:=All(objectshortcond and subjectbearishsig,1);
outshortpos:=ALL(objectlongcond and subjectbullishsig,1);

longMaintained:=objectlongcond and subjectbullishsig;
shortMaintained:=objectshortcond and subjectbearishsig;

drawicon(longMaintained,TdLn,10);
drawicon(shortMaintained,TdLn,11);

appointMANDIBLE := "Alligator.submandible#min30"(8,5,3);
appointTOOTH := "Alligator.subTOOTH#min30"(8,5,3);
appointUPPERLIP := "Alligator.subupperlip#min30"(8,5,3);
interdayLonglogo:=appointTOOTH>=appointMANDIBLE and appointUPPERLIP>=appointTOOTH;
interdayShortlogo:=appointTOOTH>=appointUPPERLIP and appointMANDIBLE>=appointTOOTH;
drawicon(interdayLonglogo,RtLn,6);
drawicon(interdayShortlogo,RtLn,7);
            
if inlongpos and tradingHours then
  begin
        sellshort(holding<0,0,market);
        //myholding:=0;
        buy(holding=0 and inlongpos,contractsNUM,market);
        //myholding:= contractsNUM;
  end


if inshortpos and tradingHours then
  begin
        sell(holding>0,0,market);
        //myholding:=0;
        buyshort(holding=0 and inshortpos,contractsNUM,market);
        //myholding:= -contractsNUM;
  end

if closingPosTM then
  begin
     sell(holding>0 and interdayShortlogo,0,market);
     //myholding:=0;
     sellshort(holding<0 and interdayLonglogo,0,market);
     //myholding:=0;
  end

 

{debugout("inlongpos=%.of",inlongpos);
debugout("outlongpos=%.of",outlongpos);
debugout("inshortpos=%.of",inshortpos);
debugout("outshortpos=%.of",outshortpos);}
debugout("当前资产为:%.2f",asset);
debugout("当前持仓为:%.f",holding);
我的资产:ASSET,NOAXIS,precision0,LINETHICK0;
多头余额:CASH(0),LINETHICK0;
空头余额:CASH(1),LINETHICK0;
持仓:holding,LINETHICK0;
总交易次数:totaltrade,LINETHICK0;
盈利次数:numwintrade,LINETHICK0;
亏损次数:numlosstrade,LINETHICK0;
最大连赢:maxseqwin,LINETHICK0;
最大连亏:maxseqloss,LINETHICK0;
浮动盈亏:openprofit,LINETHICK0;
iiii := ROUNDS(PERCENTWIN,4)*100 ;
DRAWTEXTEX(1,0,450,10,'胜率为:') ;
DRAWTEXTEX(1,0,450,30,NUMTOSTR(iiii,2)&'%');

{跨周期自反应Since cross-reaction cycle;基准价Benchmark price;
下颚mandible;牙齿tooth;上颚maxillary;上唇upperlip}



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


加好友 发短信
等级:黑侠 帖子:676 积分:2548 威望:0 精华:3 注册:2011/4/13 16:18:50
  发帖心情 Post By:2011/6/17 16:54:05    Post IP:58.246.57.26[只看该作者]

程序太复杂了,看不懂。不过我在机器上运行,很正常。出现了开平仓信号。


 回到顶部