金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 1936|回复: 1

账户总值

[复制链接]

145

主题

322

帖子

322

积分

Rank: 4

等级: 专业版

注册:
2021-7-7
曾用名:
发表于 2023-11-21 11:36 | 显示全部楼层 |阅读模式
股票可转债如何在1分钟周期上记录当日账户总值(可用资金+持仓市值)的最高值?求代码,谢谢



补充内容 (2023-11-21 11:38):
记录账户资金最高值后,当资金账户由最高值回落1%后卖出全部持仓
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2023-11-21 14:23 | 显示全部楼层

1.需要监控到实际持仓的品种
2.如果中间暂停,那么中间暂停时候 数据是无法更新到的
3.可以在数据关联-全局变量中查看记录的数值

[PEL] 复制代码

as:extgbdata(taccount( 1));//记录资产的全局变量
dt:extgbdata(taccount( 1)+'_date');//记录数据更新日期的全局变量
isclear:extgbdata(taccount( 1)+'_isclear');//标记是否应该清仓的全局变量

if tholdcount('')=0 then //如果没有持仓了,清空掉之前的数据
begin
extgbdataset(taccount( 1),0);	 
extgbdataset(taccount( 1)+'_date',date);//记录数据更新的日期
extgbdataset(taccount( 1)+'_isclear',0); //隔日后清仓标记也重置掉
end 

//更新到最新日期的数据,用来处理隔日的问题
if date>dt  and  tholdcount('')>0  then 
begin
extgbdataset(taccount( 1),taccount( 6));
extgbdataset(taccount( 1)+'_date',date);//记录数据更新的日期	
extgbdataset(taccount( 1)+'_isclear',0); //隔日后清仓标记也重置掉
end 

//始终记录最大的动态权益
if tholdcount('')>0 and  taccount( 6)>as and isclear=0 then
begin 
extgbdataset(taccount( 1),taccount( 6));
extgbdataset(taccount( 1)+'_date',date);//记录数据更新的日期
end 

as:=extgbdata(taccount( 1));
if as/taccount( 6)>=1.01 and tholdcount('')>0 and isclear=0 then 
begin 
extgbdataset(taccount( 1)+'_isclear',1);
end 

isclear:=extgbdata(taccount( 1)+'_isclear');//标记是否应该清仓的全局变量

if  isclear and tbuyholdingex('','',1)>0  then tsell(1,0,mkt);//每次只能平当前品种,所以必须监控账户栏实际持仓才能全平
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 微信登录

本版积分规则

手机版|小黑屋|上海金之塔信息技术有限公司 ( 沪ICP备13035422号 )

GMT+8, 2025-8-2 06:02 , Processed in 0.138818 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表