//请问当天盈亏是否可以这样写:
//定义当日盈亏变量
variable:profit=0;
//先找出昨天的户值:
refasset:=ref(asset,barslast(date<>ref(date,1))+1);
//平空后计算一次当日盈亏
if 平空条件 then
begin
平空:SELLSHORT(1,1,thisclose) ;
profit:=asset-refasset;
end
//平多后计算一次当日盈亏
if 平多条件 then
begin
平多:SELL(1,1,thisclose) ;
profit:=asset-refasset;
end
if time>=150000 then
profit :=0;// 收盘赋值为0
//另外请问:
// 1, asset是否可以用cash(0) 代替,因为已经平仓后没有持仓
// 2, asset 和cash(0) 是否都是以资金表示,如:1000000 元
//谢谢
1.可以,不过asset用处光,用cash(0)碰到信号闪烁之类的导致仓位没有平掉,这个就会和asset有差异
2.是的,单位是元,人民币