金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 1772|回复: 2

后台改图表

[复制链接]

26

主题

260

帖子

260

积分

等级: 免费版

注册:
2022-11-9
曾用名:
发表于 2024-1-10 15:52 来自手机 | 显示全部楼层 |阅读模式
GLOBALVARIABLE:maxprofit1:=-1,maxprofit2:=-1;


多持仓均价:tAVGENTERPRICEex2('',STKLABEL,0);
空持仓均价:tAVGENTERPRICEex2('',STKLABEL,1);
//浮动盈亏百分比(基于持仓均价的盈亏幅度)
fdyk1:100*(c-多持仓均价)/多持仓均价;//多头
fdyk2:100*(空持仓均价-c)/空持仓均价;//空头

//无持仓了,直接重置记录的最大浮盈百分比的记录
if 多持仓均价=0 then maxprofit1:=-1;
if 空持仓均价=0 then maxprofit2:=-1;

//第一次有持仓时候 给最大盈亏百分比变量 赋值
if 多持仓均价<>0 and maxprofit1=-1 then maxprofit1:=fdyk1;
if 空持仓均价<>0 and maxprofit2=-1 then maxprofit2:=fdyk2;

//更新浮动盈亏百分比最大值
if fdyk1>maxprofit1 and maxprofit1<>-1 then maxprofit1:=fdyk1;
if fdyk2>maxprofit2 and maxprofit2<>-1 then maxprofit2:=fdyk2;


//盈利幅度回撤
if BETWEEN(多持仓均价,0,1) and fdyk1<0.25*maxprofit1 then tsell(1,0,mkt);
if BETWEEN(多持仓均价,1,2) and fdyk1<0.33*maxprofit1 then tsell(1,0,mkt);
if 多持仓均价>2 and fdyk1<0.75*maxprofit1 then tsell(1,0,mkt);


if BETWEEN(空持仓均价,0,1) and fdyk2<0.25*maxprofit2 then tsellshort(1,0,mkt);
if BETWEEN(空持仓均价,1,2) and fdyk2<0.33*maxprofit2 then tsellshort(1,0,mkt);
if 空持仓均价>2 and fdyk2<0.75*maxprofit2 then tsellshort(1,0,mkt);
回复

使用道具 举报

26

主题

260

帖子

260

积分

等级: 免费版

注册:
2022-11-9
曾用名:
 楼主| 发表于 2024-1-10 15:53 来自手机 | 显示全部楼层
技术您好,请您帮我把这个后台的代码改成图表的,谢谢。
回复

使用道具 举报

21

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
FireScript
发表于 2024-1-10 16:22 | 显示全部楼层
[PEL] 复制代码
variable:maxprofit1:=-1,maxprofit2:=-1;


//浮动盈亏百分比(基于持仓均价的盈亏幅度)
fdyk1:100*(c-avgenterprice)/avgenterprice;//多头
fdyk2:100*(avgenterprice-c)/avgenterprice;//空头

//无持仓了,直接重置记录的最大浮盈百分比的记录
if avgenterprice=0 then
begin
maxprofit1:=-1;
maxprofit2:=-1;
end 

//第一次有持仓时候 给最大盈亏百分比变量 赋值
if HOLDING>0 and maxprofit1=-1 then maxprofit1:=fdyk1;
if HOLDING<0 and maxprofit2=-1 then maxprofit2:=fdyk2;

//更新浮动盈亏百分比最大值
if fdyk1>maxprofit1 and maxprofit1<>-1 then maxprofit1:=fdyk1;
if fdyk2>maxprofit2 and maxprofit2<>-1 then maxprofit2:=fdyk2;


//盈利幅度回撤
if between(avgenterprice,0,1) and fdyk1<0.25*maxprofit1 then sell(1,0,market);
if between(avgenterprice,1,2) and fdyk1<0.33*maxprofit1 then sell(1,0,market);
if avgenterprice>2 and fdyk1<0.75*maxprofit1 then sell(1,0,market);


if between(avgenterprice,0,1) and fdyk2<0.25*maxprofit2 then sellshort(1,0,market);
if between(avgenterprice,1,2) and fdyk2<0.33*maxprofit2 then sellshort(1,0,market);
if avgenterprice>2 and fdyk2<0.75*maxprofit2 then sellshort(1,0,market);
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-8-3 22:43 , Processed in 0.141198 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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