{昨买今卖及预测股价公式}
{参数}
input:N(27,1,250);
{显示买卖价}
BUYPRICE:="SHOWINV@BUYPRICE"(1);
SALEPRICE:="SHOWINV@SALEPRICE"(1);
IF BUYPRICE> 0 THEN BP:=BUYPRICE;
{显示昨低买今卖操作数据}
ppp:=0.015;{输入卖出纯利}
成本:=BP*1.006;
卖价:成本*(1+ppp),linethick0;
{四价运用}
开盘价:open,linethick0;
开盘价1:=REF(open,1);{昨天最低价}
最高价:high,linethick0;
最高价1:=REF(high,1);
最低价:low,linethick0;
最低价1:=REF(low,1);
最低价2:=REF(low,2);
收盘价:CLOSE,linethick0;
收盘价1:=REF(CLOSE,1);
{预测系数B2计算公式1}
A1:=REF(开盘价,1);
A2:=Abs((REF(收盘价,1)-A1)/A1);
A3:=ABS((REF(最高价,1)-A1)/A1);
A4:=ABS((REF(最低价,1)-A1)/A1);
B1:=ABS((A2+A3+A4)/3);
B2:开盘价*B1,linethick0;
涨跌比:B2/开盘价*100,linethick0;
{预测公式一 有用到今天开盘价}
AA:=最高价1;
BB:=最低价1;
CC:=开盘价1;
DD:=收盘价1;
EE:=(AA+BB+CC+2*DD)/5;
AAA:=EE+(AA-BB);
BBB:=2*EE-BB;
CCC:=2*EE-AA;
DDD:=EE-(AA-BB);
上升突破价:=AAA;
上升阻力价:=BBB;
下跌支撑价:=CCC;
下跌反转价:=DDD;
EEE:=(EE+上升突破价+上升阻力价+下跌支撑价+下跌反转价)/5;{心理价}
FFF:=(EEE+开盘价)/2;
{显示今买最低预测价}
预测低一:=开盘价-B2;{今天预测低价一}
预测低一1:=REF(预测低一,1);{昨天预测价}
预测低一2:=REF(预测低一,2);{前天预测价}
预测低二:=(预测低一+FFF)/2;{今天预测低价二}
预测低二1:=REF(预测低二,1);{昨天预测价}
预测低二2:=REF(预测低二,2);{前天预测价}
差额一:=预测低一-low;
差额二:=预测低二-low;
差比一:=(差额一/low)*100;
差比二:=(差额二/low)*100;
{显示今日最高预测价公式}
预测高一:=开盘价+B2;{今天预测高价一}
{第二今日最高预测价公式}
预测高二:=MA(REF(HIGH,1)/REF(CLOSE,2),N)*REF(CLOSE,1);{今天预测高价二}
预测高二1:=ref(预测高二,1);{昨天预测价}
预测高二2:=ref(预测高二,2);{前天预测价}
{设定弱势预测最高价,YPP可自行调整}
YPP一:=0.985;{预测高一弱势价}
YPP二:=0.989;{预测高二弱势价}
熊价一:=预测高一*YPP一;
熊价一1:=REF(熊价一,1);
熊价二:=预测高二*YPP二;
熊价二1:=REF(熊价二,1);
平均价一:=(预测高一+预测高二)/2;
平均价二:=(熊价一+熊价二)/2;
{测试昨最低及昨预测低卖出成功率}
check1:(high-预测低二1)/预测低二1*100,linethick0;
low1:=ref(low,1);
check2:(high-low1)/low1*100,linethick0;
DRAWTEXTREL(10,60,’ 【今日低买操作数据】 【昨低买今卖操作数据】 纯利设定:’+NUMTOSTRN(ref(ppp*100,0),2)+’% 【依据预测价 计算卖出价】’ ),coloryellow,linethick1;
DRAWTEXTREL(10,200,’ 【今日低买】 预测价 目前差价 目前差比’),Color8000FF,linethick1;
DRAWTEXTREL(10,350,’ 预测低一: ‘+NUMTOSTRN(ref(预测低一,0),2)+’元 ‘+ NUMTOSTRN(ref(差额一,0),2)+’元 ‘+ NUMTOSTRN(ref(差比一,0),2)+’%’),colorffffff,linethick1;
DRAWTEXTREL(10,600,’ 预测低二: ‘+NUMTOSTRN(ref(预测低二,0),2)+’元 ‘+ NUMTOSTRN(ref(差额二,0),2)+’元 ‘+ NUMTOSTRN(ref(差比二,0),2)+’%’),colorffffff,linethick1;
DRAWTEXTREL(320,500,’ 今 最低价:’+NUMTOSTRN(ref(最低价,0),2)+’元 最高价:’+NUMTOSTRN(ref(最高价,0),2)+’元’),coloryellow,linethick1;
DRAWTEXTREL(320,745,’ 昨 最低价:’+NUMTOSTRN(ref(最低价1,0),2)+’元 最高价:’+NUMTOSTRN(ref(最高价1,0),2)+’元’),COLORD3A9FF,linethick1;
DRAWTEXTREL(320,615,’ 开盘价:’+NUMTOSTRN(ref(开盘价,0),2)+’元 收盘价:’+NUMTOSTRN(ref(收盘价,0),2)+’元’),coloryellow,linethick1;
DRAWTEXTREL(320,860,’ 开盘价:’+NUMTOSTRN(ref(开盘价1,0),2)+’元 收盘价:’+NUMTOSTRN(ref(收盘价1,0),2)+’元’),COLORD3A9FF,linethick1;
{显示昨低买今卖操作数据}
DRAWTEXTREL(320,200,’ 【买入价】 税后成本 卖出价 到位’),Colorffff80,linethick1;
DRAWTEXTREL(320,350,’ ‘+NUMTOSTR(BP)+’元 ‘+NUMTOSTR(成本)+’元 ‘+NUMTOSTR(卖价)+’元’),COLORffffff,linethick1;
{显示依据预测价计算卖出价}
DRAWTEXTREL(660,200,’ 【预测数据】 强 势 到位 弱 势 到位’),Color8000FF,linethick1;
DRAWTEXTREL(660,350,’ 预测高一: ‘+NUMTOSTRN(ref(预测高一,0),2)+’元 ‘+ NUMTOSTRN(ref(熊价一,0),2)+’元’),colorffffff,linethick1;
DRAWTEXTREL(660,500,’ 预测高二: ‘+NUMTOSTRN(ref(预测高二,0),2)+’元 ‘+ NUMTOSTRN(ref(熊价二,0),2)+’元’),colorffffff,linethick1;
DRAWTEXTREL(660,650,’ 平均价 : ‘+NUMTOSTRN(ref(平均价一,0),2)+’元 ‘+ NUMTOSTRN(ref(平均价二,0),2)+’元’),colorffffff,linethick1;
{显示卖出与否}
BBP1:=high>BP or high=BP;
BBP2:=high<BP;
IF BARSTATUS=2 AND BBP1 THEN BEGIN
DRAWTEXTREL(320,350,’ ★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND BBP2 THEN BEGIN
DRAWTEXTREL(320,350,’ ●’),COLORgreen,linethick1;
END
{显示今日低买操作}
ssssu1:=预测低一>low or 预测低一=low;
ssssu2:=预测低一<low;
IF BARSTATUS=2 AND ssssu1 THEN BEGIN
DRAWTEXTREL(10,480,’ 到 位: ★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND ssssu2 THEN BEGIN
DRAWTEXTREL(10,480,’ 到 位: ●’),COLORgreen,linethick1;
END
ssssu3:=预测低二>low or 预测低二=low;
ssssu4:=预测低二<low;
IF BARSTATUS=2 AND ssssu3 THEN BEGIN
DRAWTEXTREL(10,730,’ 到 位: ★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND ssssu4 THEN BEGIN
DRAWTEXTREL(10,730,’ 到 位: ●’),COLORgreen,linethick1;
END
{昨日低买操作结果}
LSSssu1:=预测低一1>最低价1 or 预测低一1=最低价1;
lssssu2:=预测低一1<最低价1;
IF BARSTATUS=2 AND lssssu1 THEN BEGIN
DRAWTEXTREL(10,480,’ 昨 ★ ‘+NUMTOSTRN(ref(预测低一1,0),2)+’元’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND lssssu2 THEN BEGIN
DRAWTEXTREL(10,480,’ 昨 ● ‘+NUMTOSTRN(ref(预测低一1,0),2)+’元’),COLORgreen,linethick1;
END
lssssu3:=预测低二1>最低价1 or 预测低二=最低价1;
lssssu4:=预测低二1<最低价1;
IF BARSTATUS=2 AND lssssu3 THEN BEGIN
DRAWTEXTREL(10,730,’ 昨 ★ ‘+NUMTOSTRN(ref(预测低二1,0),2)+’元’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND lssssu4 THEN BEGIN
DRAWTEXTREL(10,730,’ 昨 ● ‘+NUMTOSTRN(ref(预测低二1,0),2)+’元’),COLORgreen,linethick1;
END
{昨今日四价涨跌比}
su1:=最低价>最低价1;
su2:=最低价=最低价1;
su3:=最低价<最低价1;
IF BARSTATUS=2 AND su1 THEN BEGIN
DRAWTEXTREL(470,500,’★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND su2 THEN BEGIN
DRAWTEXTREL(470,500,’★’),COLORffffff,linethick1;
END
ELSE
IF BARSTATUS=2 AND su3 THEN BEGIN
DRAWTEXTREL(470,500,’●’),COLORgreen,linethick1;
END
su4:=最高价>最高价1;
su5:=最高价=最高价1;
su6:=最高价<最高价1;
IF BARSTATUS=2 AND su4 THEN BEGIN
DRAWTEXTREL(620,500,’★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND su5 THEN BEGIN
DRAWTEXTREL(620,500,’★’),COLORffffff,linethick1;
END
ELSE
IF BARSTATUS=2 AND su6 THEN BEGIN
DRAWTEXTREL(620,500,’●’),COLORgreen,linethick1;
END
su7:=开盘价>开盘价1;
su8:=开盘价=开盘价1;
su9:=开盘价<开盘价1;
IF BARSTATUS=2 AND su7 THEN BEGIN
DRAWTEXTREL(470,615,’★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND su8 THEN BEGIN
DRAWTEXTREL(470,615,’★’),COLORffffff,linethick1;
END
ELSE
IF BARSTATUS=2 AND su9 THEN BEGIN
DRAWTEXTREL(470,615,’●’),COLORgreen,linethick1;
END
suu1:=收盘价>收盘价1;
suu2:=收盘价=收盘价1;
suu3:=收盘价<收盘价1;
IF BARSTATUS=2 AND suu1 THEN BEGIN
DRAWTEXTREL(620,615,’★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND suu2 THEN BEGIN
DRAWTEXTREL(620,615,’★’),COLORffffff,linethick1;
END
ELSE
IF BARSTATUS=2 AND suu3 THEN BEGIN
DRAWTEXTREL(620,615,’●’),COLORgreen,linethick1;
END
{显示预测高价}
ssuu1:=预测高一<high or 预测高一=high;
ssuu2:=预测高一>high;
IF BARSTATUS=2 AND ssuu1 THEN BEGIN
DRAWTEXTREL(660,350,’ ★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND ssuu2 THEN BEGIN
DRAWTEXTREL(660,350,’ ●’),COLORgreen,linethick1;
END
ssuu3:=预测高二<high or 预测高二=high;
ssuu4:=预测高二>high;
IF BARSTATUS=2 AND ssuu3 THEN BEGIN
DRAWTEXTREL(660,500,’ ★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND ssuu4 THEN BEGIN
DRAWTEXTREL(660,500,’ ●’),COLORgreen,linethick1;
END
ssuu5:=平均价一<high or 平均价一=high;
ssuu6:=平均价一>high;
IF BARSTATUS=2 AND ssuu5 THEN BEGIN
DRAWTEXTREL(660,650,’ ★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND ssuu6 THEN BEGIN
DRAWTEXTREL(660,650,’ ●’),COLORgreen,linethick1;
END
ssu1:=熊价一<high or 熊价一=high;
ssu2:=熊价一>high;
IF BARSTATUS=2 AND ssu1 THEN BEGIN
DRAWTEXTREL(660,350,’ ★ ‘),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND ssu2 THEN BEGIN
DRAWTEXTREL(660,350,’ ●’),COLORgreen,linethick1;
END
ssu3:=熊价二<high or 熊价二=high;
ssu4:=熊价二>high;
IF BARSTATUS=2 AND ssu3 THEN BEGIN
DRAWTEXTREL(660,500,’ ★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND ssu4 THEN BEGIN
DRAWTEXTREL(660,500,’ ●’),COLORgreen,linethick1;
END
ssu5:=平均价二<high or 平均价二=high;
ssu6:=平均价二>high;
IF BARSTATUS=2 AND ssu5 THEN BEGIN
DRAWTEXTREL(660,650,’ ★’),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND ssu6 THEN BEGIN
DRAWTEXTREL(660,650,’ ●’),COLORgreen,linethick1;
END
chec1:=预测低二1*1.006*(1+ppp)<high or 预测低二1*1.006*(1+ppp)=high;
chec2:=预测低二1*1.006*(1+ppp)>high;
IF BARSTATUS=2 AND chec1 THEN BEGIN
DRAWTEXTREL(660,780,’ 测 试: 昨预测低二 ★ ‘),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND chec2 THEN BEGIN
DRAWTEXTREL(660,780,’ 测 试: 昨预测低二 ●’),COLORgreen,linethick1;
END
chec3:=high>最低价1*1.006*(1+ppp) or high=最低价1*1.006*(1+ppp);
chec4:=high<最低价1*1.006*(1+ppp);
IF BARSTATUS=2 AND chec3 THEN BEGIN
DRAWTEXTREL(660,780,’ 昨最低价 ★ ‘),COLORRED,linethick1;
END
ELSE
IF BARSTATUS=2 AND chec4 THEN BEGIN
DRAWTEXTREL(660,780,’ 昨最低价 ●’),COLORgreen,linethick1;
END
卖一:=预测低二1*1.006*(1+ppp);
卖二:=最低价1*1.006*(1+ppp);
DRAWTEXTREL(660,880,’ 卖出价: ‘+NUMTOSTRN(ref(卖一,0),2)+’元 ‘+ NUMTOSTRN(ref(卖二,0),2)+’元’),colorffffff,linethick1;
评论(0)