『最佳拍檔』智能決策系統

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 2891|回复: 0

[交易指標例子]DualMA 双均线交易系统

[复制链接]
发表于 2017-6-18 12:49:58 | 显示全部楼层 |阅读模式

//------------------------------------------------------------------------

// 简称: DualMA

// 名称:双均线交易系统

// 类别: 交易指令

// 类型: 用户应用

//------------------------------------------------------------------------

Params

Numeric FastLength(3);  //短周期

Numeric SlowLength(10);  //长周期

Numeric StopPoint(30);  //止损点

Numeric WinPoint(100);   //止赢点

Numeric FlostStopStartPoint(50);   //浮动止损启动条件

Numeric FlostStopPoint(20);   //浮动止损点

Numeric TradeUint(5); //每次交易手数

Vars

NumericSeries AvgValue1; 

NumericSeries AvgValue2;

BoolSeries bCrossOver(false);

BoolSeries bCrossDn(False);

Begin

AvgValue1 = AverageFC(CLOSE,FastLength);

AvgValue2 = AverageFC(CLOSE,SlowLength);

PlotNumeric("MA1",AvgValue1);

PlotNumeric("MA2",AvgValue2);

bCrossOver = CrossOver(AvgValue1,AvgValue2);

bCrossDn   = CrossUnder(AvgValue1,AvgValue2);

//均线交叉时开仓

if(bCrossOver[1])

{

if(MarketPosition != 1)

Buy(TradeUint,Open);

}

Else if(bCrossDn[1])

{

if(MarketPosition != -1)

SellShort(TradeUint,Open);

}

//止盈止损

SetWinPoint(WinPoint);

//止损点

SetStopPoint(StopPoint);

//浮动止损

SetFloatStopPoint(FlostStopStartPoint,FlostStopPoint);

PlotNumeric("Assets",Available+PositionProfit+Margin);

SetOwnAxis("Assets");

End



DualMA双均线交易系统例子.jpg

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|『最佳拍檔』智能決策系統

GMT+8, 2024-3-29 22:06 , Processed in 0.049651 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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