如题:在软件中,若按当前帐户持仓的浮盈(浮亏)占下单前余额的百分比,来设置止盈(止损)位应该怎么写呢?
比如开单前帐户余额是100万,开单后持仓5手,设置浮亏达到:5万/100万=5%时,止损;
盈利达到:10万/100万=10%时,止损;
这个就需要后台专业版了
if taccount(4)<0 and abs(taccount(4))/taccount(3)>=0.05 then begin
tsell(1,0,mkt);
tsellshort(1,0,mkt);
end
if taccount(4)>0 and taccount(4)/taccount(3)>=0.1 then begin
tsell(1,0,mkt);
tsellshort(1,0,mkt);
end
如果图表不处理实际帐户,而按图表持仓与信号统计来写呢?
把taccount(4)改成 openprofit,把taccount(3)改成cash(0)
cash(0)是除持仓已用保证金之后剩余的资金吧?
CASH(0)加已占用保证金才是开仓前的资金余额了,已用保证金是哪个函数?
[此贴子已经被作者于2015/4/22 17:13:40编辑过]
那就是 ref(cash(0),enterbars)了