赢利系数:=5;
预损设定:=5;
待仓天数:=5;
DRAwrECTREL(0,0,1000,1000,RGB(0,151,50));{外屏色彩}
DRAWRECTREL(5,160,995,850,RGB(1,1,1));{里内屏色彩};
DRAWRECTREL(5,220,995,780,RGB(0,100,255));{内屏色彩};
{======macd========}
DIFA:=EMA(CLOSE,12)-EMA(CLOSE,150);
DEAA:=EMA(DIFA,9);
零轴:=50;
MacDZ:=(DIFA-DEAA),COLORSTICK;
系数:=CONST(HHV(Abs(MACDZ),150));
自由度:=MACDZ*零轴/系数*0.9;
STICKLINE((零轴+自由度)>零轴 AND (零轴+自由度)<=REF(零轴+自由度,1),零轴,零轴+自由度,2,1),COLORYELLOW;
STICKLINE((零轴+自由度)>零轴 AND (零轴+自由度)>REF(零轴+自由度,1),零轴,零轴+自由度,2,1),COLORRED;
STICKLINE((零轴+自由度)<=零轴 AND (零轴+自由度)<=REF(零轴+自由度,1),零轴,零轴+自由度,2,0),COLORCYAN;
STICKLINE((零轴+自由度)<=零轴 AND (零轴+自由度)>REF(零轴+自由度,1),零轴,零轴+自由度,2,1),COLORLICYAN;
STICKLINE(TIME=1500,30,70,5,0),COLORYELLOW;
{=====跑道费=====}
DRAWRECTREL(5,860,190,990,RGB(153,51,0));{左下屏色彩}
AA6:=STRCAT(STRCAT('【 双重跑道费≯',CON2STR(C*0.006,2)),'元 】');
DRAWTEXT_FIX(C>0,0.001,0.87,0,AA6),COLORWHITE;
{=========================================}
买入:=crOSS(MA(C,5),MA(C,10)),NODRAW;
买距:=BArslAST(买入) ,NODRAW;
尺:=买距>=1,NODRAW;
买价:IF(买入=1,买入*C,REF(C,买距)*尺),COLORGREEN,NODRAW;
盈利收获价:买价*(100+赢利系数)/100,NODRAW;
低限止损价:买价*(100-预损设定)/100,NODRAW;
预卖:=(H>盈利收获价 OR C<低限止损价 OR 买距=待仓天数)AND 买入=0 ;
预卖距:=BARSLAST(预卖),NODRAW;
盈利:=预卖=1 AND H>盈利收获价 AND REF(预卖距>买距,1),COLORRED;
亏损:=预卖=1 AND C<低限止损价 AND REF(预卖距>买距,1),COLORGREEN;
平仓:=预卖=1 AND 买距=待仓天数 AND REF(预卖距>买距,1) AND 盈利!=1 AND 亏损!=1,COLORGREEN;
盈平仓:=平仓=1 AND C>买价,NODRAW;
买统计:=CONST(COUNT(买入,BARSCOUNT(买入))),NODRAW;
盈统计:=CONST(COUNT(盈利,BARSCOUNT(盈利))),NODRAW;
盈平仓统计:=CONST(COUNT(盈平仓,BARSCOUNT(盈平仓))),NODRAW;
止损认输 :=CONST(买统计-盈统计-盈平仓统计),NODRAW;
胜率%:=(盈统计+盈平仓统计)/买统计*100,NODRAW,COLORGREEN;
{======}
预损:=买价*(100-预损设定{5%})/100,COLORWHITE,NODRAW;
利:=SUM(预损*0.01,买距),COLORGREEN,NODRAW;
税:=IF(C>REF(MAX(C,O),1)*1.025,(C-REF(MAX(C,O),1))*0.8,0),COLORGREEN,NODRAW;
计税:=SUM(税,买距),COLORGREEN,NODRAW;
利税:=利+计税,COLORGREEN,NODRAW;
回扣:=预损+利税*尺,COLORGREEN,NODRAW;
卖距:=BARSLAST(CROSS(回扣,C)) ,NODRAW;
卖了:=(卖距+1-买距)>0 OR CROSS(回扣,C);
回落告别价:回扣*卖了,NODRAW;
长线胜:=C<回落告别价 AND REF(C>回落告别价,1) AND C>买价;
长线亏:=C<回落告别价 AND REF(C>回落告别价,1) AND C<买价;
采摘:=CROSS(回落告别价,C)AND REF(卖距>买距,1),NODRAW;
这阵赢:DRAWICON(采摘 AND H>买价 AND CURRBARSCOUNT<97 ,102,17);{赢标记}
DRAWTEXT(这阵赢,112,'采摘');
这阵亏:DRAWICON(采摘 AND H<买价 ,108,15);{亏标记}
{=====动态提示=======}
AAA:=IF(买距>0,1,DRAWNULL),NODRAW;
WS:=REF(买价,买距)*AAA,NODRAW;
高点赢%:(H/WS*100)-100 ,COLORWHITE,NODRAW;
收盘赢%:(C/WS*100)-100,COLORWHITE,NODRAW;
{=======输赢比======}
DRAWICON(买入=1,3,1);{=买入标记=}
STICKLINE(盈利,0,20,1,0),COLORYELLOW;
DRAWICON(盈利,14,9);{=盈利标记=}
DRAWTEXT(REF(盈利,1),20,'收获'),COLORYELLOW;
STICKLINE(平仓,100,90,1,0),COLORYELLOW;
DRAWTEXT(REF(平仓,1),88,'平仓'),COLORYELLOW;
{=============}
AAS1:=STRCAT(STRCAT('【 买入 : ', CON2STR(买统计,0)) ,' 次 】');
DRAWTEXT_FIX(C>0,0.20,0.87,0,AAS1),COLORWHITE;
AAS2:=STRCAT(STRCAT('【 目标赢利 : ', CON2STR(盈统计,0)) ,' 次 】');
DRAWTEXT_FIX(C>0,0.34,0.87,0,AAS2),COLORWHITE;
AAS3:=STRCAT(STRCAT('【 止盈平仓 : ', CON2STR(盈平仓统计,0)) ,' 次 】');
DRAWTEXT_FIX(C>0,0.51,0.87,0,AAS3),COLORWHITE;
AAS4:=STRCAT(STRCAT('【 止损认输 : ', CON2STR(止损认输,0)) ,' 次 】');
DRAWTEXT_FIX(C>0,0.67,0.87,0,AAS4),COLORWHITE;
AAS5:=STRCAT(STRCAT('【 胜率: ', CON2STR(胜率%,0)) ,' % 】');
DRAWTEXT_FIX(C>0,0.84,0.87,0,AAS5),COLORWHITE;
{====年.月.日======}
DRAWRECTREL(5,12,190,150,RGB(153,51,0));{左上屏色彩}
D1:=YEAR AND MONTH AND DAY;
SAA1:=STRCAT(CON2STR(YEAR,0),'年');
SAA2:=STRCAT(CON2STR(MONTH,0),'月');
SAA3:=STRCAT(CON2STR(DAY,0),'日');
SAA4:=STRCAT('【',IF(WEEkdAY=1,'一',IF(WEEKDAY=2,'二',IF(WEEKDAY=3,'三',IF(WEEKDAY=4,'四',IF(WEEKDAY=5,'五',IF(WEEKDAY=6,'六','日')))))));
SAA5:=STRCAT(STRCAT( STRCAT(SAA1,SAA2), STRCAT(SAA3,SAA4)),'】' );
DRAWTEXT_FIX(D1,0.01,0.03,0,SAA5),COLORWHITE;
120,COLOR998800;
-20,COLOR996666;