金字塔决策交易系统

 找回密码
 

微信登录

微信扫一扫,快速登录

搜索
查看: 2987|回复: 1

修改一下

[复制链接]

4

主题

6

帖子

6

积分

Rank: 1

等级: 新手上路

注册:
2021-10-30
曾用名:
发表于 2021-10-30 13:43 | 显示全部楼层 |阅读模式
Params
Numeric ATime(918);
Numeric CTime(1510);
Numeric Lot(1);
Numeric MoneyLoss(0.6);
Numeric BarCross(1);
Numeric Length(5);

Vars
Numeric bTime(0);
Numeric MyClose(0);
Numeric MyDiff(0);
NumericSeries estP(0);
NumericSeries ExitP(0);
NumericSeries Position(0);
NumericSeries est(0);
NumericSeries est1(0);
NumericSeries est2(0);
NumericSeries est3(0);

Bool bTimeCon;
Bool BarUpCon;
Bool BarDownCon;
Bool BarExitCon;
Bool LongOpenCon;
Bool ShortOpenCon;
Bool LongExitCon;
Bool ShortExitCon;

Begin

If (Date != Date[1])
{
est = Open;
est1 = Open;
est2 = Open;
est3 = Open;
estP = 0;
ExitP = 0;
Position = 0;
MyClose = Open;
}
Else
{
est = est[1];
est1 = est1[1];
est2 = est2[1];
est3 = est3[1];
estP = estP[1];
ExitP = ExitP[1];
Position = Position[1];
If(Length != 0) MyClose = Average(Close[1],Length);
Else MyClose = Close[1];
}

MyDiff = MyClose * BarCross / 1000;

bTime = IntPart(Time*10000);
bTimeCon = (bTime > ATime) And (bTime < CTime);

If((MyClose < est And MyClose < est1) Or (MyClose > est And MyClose > est1)) est = MyClose;
If(((MyClose - est) > MyDiff And est < est1) Or ((est - MyClose) > MyDiff And est > est1))
{
est3 = est2;
est2 = est1;
est1 = est;
est = MyClose;
}

If(Position > 0 And High > estP) estP = High;
If(Position < 0 And Low < estP) estP = Low;
If(Position > 0) ExitP = estP * (100 - MoneyLoss) / 100;
If(Position < 0) ExitP = estP * (100 + MoneyLoss) / 100;

If(bTime >= CTime)
{
If (Position > 0)
Sell(lot,Open);
Else
BuyToCover(lot,Open);
}

If(bTimeCon)
{
If (Position == 0)
{
If(est3 < est1 And (est2 / 2000 + est2) <= est And est3 < est2)
{
Buy(lot,Open);
Position = lot;
estP = Open;
ExitP = estP * (100 - MoneyLoss) / 100;
Commentary("LongOpen");

}

Else If(est3 > est1 And (est2 - est2 / 2000) >= est And est3 > est2)
{
SellShort(lot,Open);
Position = lot * -1;
estP = Open;
ExitP = estP * (100 + MoneyLoss) / 100;
Commentary("ShortOpen");
}
}

Else

{
If(Position > 0 And est3 > est1)
{
Sell(lot,Open);
Position = 0;
Commentary("LongExit1");
}

Else If(Position < 0 And est3 < est1)
{
BuyToCover(lot,Open);
Position = 0;
Commentary("ShortExit1");
}

Else If(Position > 0 And Open < ExitP)
{
Sell(lot,Open);
Position = 0;
Commentary("LongExit2");
}

Else If(Position < 0 And Open > ExitP)
{
BuyToCover(lot,Open);
Position = 0;
Commentary("ShortExit2");
}
}
}

Commentary("Position = "+Text(Position));
Commentary("ExitP = "+Text(ExitP));
End
回复

使用道具 举报

34

主题

9006

帖子

5万

积分

Rank: 8Rank: 8

等级: 超级版主

注册:
2021-5-18
曾用名:
wenarm
发表于 2021-10-31 08:03 | 显示全部楼层
抱歉,能力有限修改不了,这种语法结构我们不熟。建议你考虑提供逻辑思路,我们尝试提供代码范例。
金字塔提供一对一VIP专业技术指导服务,技术团队实时响应您的日常使用问题与策略编写。联系电话:021-20339086
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-17 08:29 , Processed in 0.235677 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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