以文本方式查看主题

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

--  作者:雪球
--  发布时间:2016/6/10 18:53:57
--  金叉多头如何改写金字塔公式
下面金叉多头是买入块板中涨幅前5的股票的代码,如何将金叉多头改写成金字塔的代码?

公式名:今日涨幅
zf:100*(close-ref(c,1))/ref(c,1);

公式名:金叉多头_执行
公式代码:

#Run_By_Serie
#Run_Every_Tick


VARIABLEs:kcbar[200](0),hcbar[200](0);


盘中:=between(currenttime,SESSIONSTARTTIME(1),SESSIONENDTIME(1)) or between(currenttime,SESSIONSTARTTIME(2),SESSIONENDTIME(2));

if IsLastBar then
begin
vark:STKCOUNT(StrLeft(FormulaName,StrLen(FormulaName)-3)),LineThick0;
for $i=1 to min(200,vark) Do
begin
varlh:=RefIndi(STKFROMBLK(StrLeft(FormulaName,StrLen(FormulaName)-3),$i),\'今日涨幅.zf\',p_day,0);
kcbar[$i]:=varlh[0];
hkcbar[$i]:=varlh[0];
end;

varsort:=sort(hkcbar,1,1,vark);
varpos:=Sortpos(kcbar,1,1,vark);

strtk:=\'\';
for ik=1 to min(200,vark) Do
begin
hdai:=STKFROMBLK(StrLeft(FormulaName,StrLen(FormulaName)-3),kcbar[ik]);
ingzf:=hkcbar[ ik];

//////// ///////////// 推送信号

if ik<=5{推送涨幅排序前五} and 盘中 and ingzf<5{涨幅不超过5%才推送} and getglobalvar(StrLeft(FormulaName,StrLen(FormulaName)-3)+STKNAMEEX (hdai)+\'t\')=0 Then
begin
if WeekDayOfDate ( currentdate)<>6 and WeekDayOfDate ( currentdate)<>0 then
begin
存时:=SetGlobalVar(StrLeft(FormulaName,StrLen(FormulaName)-3)+STKNAMEEX (hdai)+\'t\', if(DataPeriod>=P_Day,Date,date*10000+Hour*100+Minute));
end;
buyy:=SENDYJ(\'192.168.0.1\',\'717\',\'主的宽恕\',\'■\'+\'交易信号:\'+StrLeft(FormulaName,StrLen(FormulaName)-3),hdai,STKNAMEEX (hdai),\'.1\'{这个到了中间软件那边就识别为按照即时的卖1价买入},NUMTOSTR (CURRENTTIME (),0)+\':1\'+\'倍\'{中间软件识别为按照设置的默认买卖金额(或者账户可用数的百分比)再乘以这个倍数进行委托}); //函数SENDYJ推送指令给中间软件执行买卖的
FILEAPPEND(\'C:\\\\Documents and Settings\\\\Administrator\\\\桌面\\\\\'+StrLeft(FormulaName,StrLen(FormulaName)-3)+\'_推送记录.doc\', strright(NUMTOSTR (Month+100,0),2)+\'-\'+NUMTOSTR (Day,0)+\' \'+strright(NUMTOSTR (InTPart(currenttime/10000)+100,0),2)+\':\'+strright(NUMTOSTR (InTPart(currenttime/100),0),2)+\':\'+strright(NUMTOSTR (currenttime,0),2)+\' \'+hdai+\'【\'+STKNAMEEX (hdai)+\'】\'+\'.1\'+\'元 1\'+\'倍\');
end;

/////////////////////////////////////////

strtk:=strtk+\'\\n\'+StrRight(\' \'+NumToStr(ik,0),3)+\') \'+StrRight(hdai,6)+\' \'+strleft(STKNAMEEX (hdai)+\' \',if(StrLen(STKNAMEEX (hdai))=4,4,8-StrLen(STKNAMEEX (hdai))+1))+\' \'+NumToStr(hkcbar[kcbar[ik]],2)+\'%\';
end;
end;
DrawTextEx(islastbar,1,10,10,strtk),Color1;


--  作者:jinzhe
--  发布时间:2016/6/12 9:56:06
--  

http://www.weistock.com:8080/vip/forum.php?mod=viewthread&tid=470&extra=page%3D1%26filter%3Ddigest%26digest%3D1%26digest%3D1

参考这个做排序选股,

 


--  作者:雪球
--  发布时间:2016/6/16 16:27:10
--  

1楼这个来从金字塔下面连接。请老师改写下


http://www.weistock.com/bbs/dispbbs.asp?boardid=10&id=75696


--  作者:雪球
--  发布时间:2016/6/22 22:01:40
--  
这么多天了,还没没写呀
--  作者:yukizzc
--  发布时间:2016/6/23 10:47:35
--  

EXTGBDATA( )       getglobalvar
EXTGBDATASET( , )       SetGlobalVar

 

这个是tb和金字塔全局变量的替换

其他一些金字塔不一样的函数还请用户编译发现不同后能标注下说明,工作人员精力有限无法对所有其他软件的所有函数都一一去做搜寻还请理解