金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 295|回复: 1

求改策略

[复制链接]

144

主题

320

帖子

320

积分

Rank: 4

等级: 专业版

注册:
2021-7-7
曾用名:
发表于 2025-6-11 10:00 | 显示全部楼层 |阅读模式
Vars:V1(Range),MinProfit(1500),StopValue(1),Limits(30),Pct(0.25),ExitDays(30),ChanDays(70),LongEntry(0),LongExit(0),ShortEntry(0),ShortExit(0),AvgR(0),Multiplier(1);
If (CurrentBar=1) then begin   MinProfit    = 1500;    StopValue    = (1500/BigPointValue);    Pct          = 0.25;   Limits       = 35;   ExitDays     = 30;   Multiplier   =0.4;   end;
V1 = Pct * Average(TrueRange,10);AvgR = Average(TrueRange,5)[1];
{***CALCULATE ORDERS***}LongEntry = 99999.0;ShortEntry = 0.0;
If TrueRange > Multiplier*AvgR then beginLongEntry = Highest(TrueHigh,70) + V1;ShortEntry = Lowest(TrueLow,70) - V1;LongEntry = MinList(Close+V1,LongEntry);  ShortEntry = MaxList(Close-V1,ShortEntry);end;
LongExit = EntryPrice - StopValue;ShortExit = EntryPrice + StopValue;
If MaxPositionProfit > MinProfit then begin LongExit = MaxList(Lowest(TrueLow,ExitDays),LongExit); ShortExit = MinList(Highest(TrueHigh,ExitDays),ShortExit);end;
{ BUY ORDERS}If MarketPosition =-1 and ShortExit < LongEntry then BuytoCover("Short Exit") next bar at ShortExit Stop; {SHORT EXIT}If  LongEntry <> 99999.0 and (MarketPosition=-1 and LongEntry  <= ShortExit) or (MarketPosition=0)then Buy("Long Entry") next bar at LongEntry Stop; {LONG ENTRY}
{ SELL ORDERS}If MarketPosition=1 and LongExit > ShortEntry then Sell("Long Exit") next bar at LongExit Stop; {LONG EXIT}If  ShortEntry <> 0.0 and (MarketPosition=1 and ShortEntry >= LongExit) or (MarketPosition=0) then Sell Short("Short Entry") next bar at ShortEntry Stop; {SHORT ENTRY}
回复

使用道具 举报

44

主题

1万

帖子

1万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
发表于 2025-6-11 10:19 | 显示全部楼层
这个最好能提供相应策略需求说明,光看这个代码很难直接翻的
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-6 04:46 , Processed in 0.089993 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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