比如图表的程序代码是:
dk:h>ref(hhv(h,20),1) and holding<=0;
if dk then
sellshort(holding<0,1,market);
buy(holding=0,1,market);
end;
转成后时变为:
dk:h>ref(hhv(h,20),1) and holding<=0;
if dk then
tsellshort(holding<0,1,mkt);
tbuy(holding=0,1,mkt);
end;
即后台可以读到图表持仓holding 的值,可以顺利的运行程序代码的值。
可以读取
用在后台上时,buy,buyshort等下单函数产生的holding还是存在的
不能直接改,holding是由buy等图标函数产生的,公式中必须要有图标下单函数
举例
buy(holding=0,1,marekt);
sell(c-enterprice>10*mindiff,0,market);
tsell(holding>0 and c-enterprice>10*mindiff,0,mkt);
这样的后台函数是可以读取holding的
tsell(holding>0 and c-enterprice>10*mindiff,0,mkt);
但是如果只有这样的一段话,那么holding是不会被读取的