国外五大股票交易系统,及其源码(8)

2019-02-15 12:56

hh:=ref(hitoday,1); cc:=ref(close,1); ll:=ref(ltoday,1);

if date>ref(date,1) then begin startnow:=startnow+1;

ssetup:=hh+f1*(cc-ll);

senter:=((1+f2)/2)*(hh+cc)-f2*ll; benter:=((1+f2)/2)*(ll+cc)-f2*hh; bsetup:=ll-f1*(hh-cc);

bbreak:=ssetup+f3*(ssetup-bsetup); sbreak:=bsetup-f3*(ssetup-bsetup);

hitoday:=high; ltoday:=low;

rfilter:=hh-cc>=rangemin; end

if high>hitoday then hitoday:=high; if low

if time>=notbef and time=2 and rfilter then begin if hitoday>=ssetup and holding>=0 then begin if low<=senter+(hitoday-ssetup)/div then begin sell(1,holding,limitr,senter+(hitoday-ssetup)/div); sellshort(1,1,limitr,senter+(hitoday-ssetup)/div); end end

if ltoday<=bsetup and holding<=0 then begin if high>=benter-(bsetup-ltoday)/div then begin

sellshort(1,holding,limitr,benter-(bsetup-ltoday)/div); buy(1,1,limitr,benter-(bsetup-ltoday)/div); end end

if holding<0 then begin

if high-enterprice>=i_reverse then sellshort(1,enterprice+i_reverse); end

if holding>0 then begin

if enterprice-low>=i_reverse then sell(1,enterprice-i_reverse); end

//来源 www.88gs.com if holding=0 then begin if high>=bbreak then buy(1,bbreak); end

if holding=0 then begin if low<=sbreak then sellshort(1,sbreak); end end

if time>=notaft then begin if holding<0 then

sellshort(1,holding,limitr,open);

if holding>0 then

sell(1,holding,limitr,open); end

盈亏:asset-500000,noaxis,coloryellow,linethick2;

复制上述代码粘贴到公式管理器即可

TB顺势指标交易策略源码

简称: CCIapply // 名称: 顺势指标 // 类别: 公式应用 // 类型: 用户应用

// 来源: WW.CXH99.COM

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

Params

Numeric Para1(10); Numeric Para2(5);

Numeric Length(14); Numeric AvgLength(9); Vars

Bool Condition1;

Bool Condition2; Bool PreBreakoutFailure; NumericSeries TmpValue; Numeric Mean( 0 ); Numeric AvgDev( 0 ); Numeric Counter( 0 ) ;

NumericSeries CCIValue(0); NumericSeries CCIAvg;

Numeric ExitLowestPrice;

Numeric myEntryPrice; // 开仓价格 Numeric myExitPrice; // 平仓价格

NumericSeries preEntryPrice(0); // 前一次开仓的价格

Begin

TmpValue = High + Low + Close;

Mean = AverageFC( TmpValue, Length ) ;

AvgDev = 0 ;

for Counter = 0 to Length - 1 {

AvgDev = AvgDev + Abs( TmpValue[Counter] - Mean ) ; }

AvgDev = AvgDev / Length ;

if( AvgDev == 0)

CCIValue = 0; Else

CCIValue = ( TmpValue - Mean ) / ( 0.015 * AvgDev ) ; //求CCI值 CCIAvg = AverageFC(CCIValue, AvgLength );

If(BarStatus == 0) {

preEntryPrice = InvalidNumeric; PreBreakoutFailure = false; }

Condition1 =CCIValue>=CCIAvg&&CCIValue[1]CCIAvg[1];

If(Condition1) {

if (MarketPosition==-1) {

myExitPrice=c;

Commentary(\ BuyToCover(1,c); }

if (MarketPosition==0) {

myEntryPrice=Data0.close;

Commentary(\ Buy(1,close); } }

If(Condition1) {

If(MarketPosition==1) {

myExitPrice=c;

Commentary(\ Sell(1,c); }

If (MarketPosition==0) {

myEntryPrice=Data0.close;

Commentary(\ SellShort(1,close); } } End

//------------------------------------------------------------------------ // 编译版本 GS2010.12.08 CXH99.COM // 来源: www.88gs.com

// 版权所有 guitar1234

// 更改声明 TradeBlazer Software保留对TradeBlazer平台

// 每一版本的TrabeBlazer公式修改和重写的权利

多空价差平仓源码

咨询内容:

Params

Numeric M(1);

Numeric BarRef(30);//回溯bar的根数 Numeric MARef(30);//均线回溯天数 Vars

NumericSeries Spread(0); Bool CondInB(False); Bool CondInS(False); Bool CondExB(False); Bool CondExS(False);

Begin

If(Data0.Close!=InvalidNumeric&&Data1.Close!=InvalidNumeric) {

Spread=Data0.Close-Data1.Close; // 定义价差 //参数定义

//////////////////////////////////////

CondInB= Spread>Highest(Spread[1],BarRef); //做多价差 CondInS= Spread

CondExB= CrossUnder(Spread ,Average(Spread[1],MARef)); //做多价差平仓

CondExS= CrossOver(Spread ,Average(Spread[1],MARef) ); //做空价差平仓

/////////////////////////////////////////////////////画图

1分钟k线显示当日结算价的线(即是分时图里的黄线)

咨询内容: Vars

NumericSeries AmountCum; // 当日以来成交总额的合计值

NumericSeries VolCum; // 当日以来成交量的合计值 Begin

if(day!=Day[1]) {

Amountcum=close*Vol; volcum=vol; }else {

AmountCum = amountcum[1]+close*vol; VolCum = volcum[1]+vol;

PlotNumeric(\ }


国外五大股票交易系统,及其源码(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:广东省江门市2015届高三3月高考模拟试考试文综试题 - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: