-- 作者:火龙战车
-- 发布时间:2011/6/17 15:20:11
-- [求助]
请各位高手指点迷津:
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}
|