Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:请问当天盈亏是否可以这么写

1楼
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 元
//谢谢
2楼
jinzhe 发表于:2013/9/25 9:18:44

1.可以,不过asset用处光,用cash(0)碰到信号闪烁之类的导致仓位没有平掉,这个就会和asset有差异

2.是的,单位是元,人民币

共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.01563 s, 3 queries.