以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请问当天盈亏是否可以这么写 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=56972) |
-- 作者:zjt617 -- 发布时间:2013/9/25 9:00:12 -- 请问当天盈亏是否可以这么写 //请问当天盈亏是否可以这样写: //定义当日盈亏变量 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 元 //谢谢
|
-- 作者:jinzhe -- 发布时间:2013/9/25 9:18:44 -- 1.可以,不过asset用处光,用cash(0)碰到信号闪烁之类的导致仓位没有平掉,这个就会和asset有差异 2.是的,单位是元,人民币 |