以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  高级功能研发区  (http://222.73.7.161/bbs/list.asp?boardid=5)
----  [求助] 后台交易 为何 不能使用 自定义函数?  (http://222.73.7.161/bbs/dispbbs.asp?boardid=5&id=37617)

--  作者:chenwc
--  发布时间:2012/12/29 1:47:52
--  [求助] 后台交易 为何 不能使用 自定义函数?
在后台交易中, 调用自定义函数, 但没有任何的反应, 是不是在后台交易中,无法使用自定义函数呢?
--  作者:guotx2010
--  发布时间:2012/12/29 8:17:34
--  
可以使用过的,估计是你的函数写的有问题。
--  作者:chenwc
--  发布时间:2012/12/29 16:32:23
--  
可是我同样的自定义函数,在图表程序化交易中,是正常的。  切换到后台交易,那段自定义函数就没有执行。 
--  作者:admin
--  发布时间:2012/12/29 16:46:41
--  

http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=332

问题4,使用后台的调试方法调试一下


--  作者:chenwc
--  发布时间:2012/12/29 19:13:08
--  
debugfile  我调试过,加在自定义函数后面,可以正常输出, 但自定义函数输出没有反应。
--  作者:王锋
--  发布时间:2012/12/29 19:42:11
--  

在VBA中,使用APPLICATION.MSGOUT,看看有没有输出,在VBA中做一下调试


--  作者:chenwc
--  发布时间:2012/12/31 11:14:58
--  
测试了,  自定义函数没有执行哦。
--  作者:chenwc
--  发布时间:2012/12/31 14:24:01
--  
自己顶起来一下。
--  作者:王锋
--  发布时间:2012/12/31 14:55:31
--  

同样的公式在图表上是可以工作的吗?

是否方便将公式范例放论坛,我们客服测试一下问题


--  作者:chenwc
--  发布时间:2012/12/31 20:01:48
--  
阿火后台模板-K线走完模式
Globalvariable:hold=drawnull;
cc800988:=holding;//这句放在信号稳定的地方

//////以下部分改为你自己的模型(K线走完模型)////////////
/////////////////////////////////////////////////////////
buycond:=ref(count(c>o,2)=2,1);
sellcond:=ref(count(c<o,2)=2,1);
if holding>0 and sellcond then begin 
sell(1,1,thisclose);
TestSelfFunc(date);
debugfile(\'D:\\2222.txt\', numtostr(date,2) + \',sell,\' + \'%.2f\', thisclose);
end
if holding<0 and buycond then begin
sellshort(1,1,thisclose);
TestSelfFunc(date);
debugfile(\'D:\\2222.txt\', numtostr(date,2) + \',sellshort\' + \'%.2f\', thisclose);
end
if holding=0 and buycond then begin
buy(1,1,thisclose);
TestSelfFunc(date);
debugfile(\'D:\\2222.txt\', numtostr(date,2) + \',buy\' + \'%.2f\', thisclose); 
end
if holding=0 and sellcond then begin
buyshort(1,1,thisclose);
TestSelfFunc(date);
debugfile(\'D:\\2222.txt\', numtostr(date,2) + \',buyshort\' + \'%.2f\', thisclose);
end
==============================================================
自定义函数TestSelfFunc:

Function TestSelfFunc(Formula,date)
    \'系统会在逐K线模式解释公式时的每个周期都会调用此函数一遍,因此设计时应该注重程序的执行效率,不要重复的执行一些没必要的代码
    TestSelfFunc=0
APPLICATION.MSGOUT("test")
TestSelfFunc=1
End Function

======================================================
还请客服测试一下,望回复!