在后台交易中, 调用自定义函数, 但没有任何的反应, 是不是在后台交易中,无法使用自定义函数呢?
可是我同样的自定义函数,在图表程序化交易中,是正常的。 切换到后台交易,那段自定义函数就没有执行。
debugfile 我调试过,加在自定义函数后面,可以正常输出, 但自定义函数输出没有反应。
在VBA中,使用APPLICATION.MSGOUT,看看有没有输出,在VBA中做一下调试
阿火后台模板-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
======================================================
还请客服测试一下,望回复!