以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://www.weistock.com/bbs/list.asp?boardid=4)
----  请问下面的功能应当怎样写  (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=93255)

--  作者:izhangmh
--  发布时间:2016/2/29 11:23:52
--  请问下面的功能应当怎样写
希望将最后的动作写入文件,通过action_note全局变量保证只写入一次,但实际上每TICK都会重写一次。

请问正确的方法是什么呢?
debugfile2提示在本模式下不能正确工作,我先忽略了。

运行模式:逐K(仅刷新最后一根)

variable : action_note = 0;

if islastbar() and action_note = 0 then begin
 action_note := 1;
 debugfile2(\'e:\\latest_action.txt\', latest_action, 0, 1);
end

--  作者:jinzhe
--  发布时间:2016/2/29 11:28:19
--  
globalvariable : action_note = 0,bj=0;

if islastbar() and action_note = 0 and bj=0 then begin
 debugfile(\'e:\\latest_action.txt\', \'latest_atciont = %.2f\',latest_action);
 ac tion_note := 1;
 bj:=1;
end
试试看这个
用在后台比较好