tradeblazer语言介绍_第1页
tradeblazer语言介绍_第2页
tradeblazer语言介绍_第3页
tradeblazer语言介绍_第4页
tradeblazer语言介绍_第5页
已阅读5页,还剩92页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、BarTradeBlazerBarBar1TradeBlazerTradeBlazerTradeBlazerTradeBlazerTradeBlazerTradeBlazerTradeBlazer-TradeBlazerTradeBlazerTradeBlazer1.2TradeBlazer通过TradeBlazerTradeBlazerBarTradeBlazerBarBarBarTradeBlazer2.1BarTradeBlazer在介绍BarBarBar(BarBarBarBarBarBarDateDBarTimeTBarOpenOBarHighHBarLowLBarCloseCBar

2、VolVBarOpenlntBarCurrentBarBar0BarStatusBar0Bar1Bar2Bar2.1.1TradeBlazerBar数据的BarBarBarBarBarBarBarBarNBarBarBarNBar公式文件巳编辑查看(辺帮助(t!)-测试各亍内逹函数的值IJu厂IericLenqth(11)Q-u123456IJumericLine1ValueBeginLinelValue=SAveragefClosejlO);Plotr-Jurneric(Linel_lLinelValue);BarValue1=Close-Open;CurrentBarDateTimeOpe

3、nHighLowCloseVolValue102005/04/0415:00297029792951297418412005/04/0515:00296029602946296014022005/04/0615:002951298029512963301232005/04/0715:003048304829682995120-5742005/04/0815:002985298729852987102CurrentBar=0BarTradeBlazer2. 2. BarClose110Vol10If(CloseClose1)Buy(1,Close);BarBarCurrentBar23Curre

4、ntBar=0BarClose1TradeBlazerInvalidNumericCloseClose1BoolFalseBarCurrentBar=99100Bar数据的总数共有100注意:在执行TradeBlazer公式时,可能TrueBarBuyBarBarClose1BoolBuyCurrentBar=0统函数HistoryDataExistTradeBlazercu05032. Bar2. #Barcu0504和cu0505cu0503为Data0,cu0504为Data1,cu05052. #Bar2. #Bar2. #Bar2. #BarData2TradeBlazerData1

5、.Close(),Data2.Vol()Bar2. #Bar2. #Bar2. #Bar2. #BarBarBarDataO.Open()BarOpen()DataO.Open()2. #Bar2. #Bar2. #Bar2. #Bar2.3行情数除了BarTradeBlazerBar2. #Bar2. #Bar2. #Bar2. #BarBarBarlf(BarStatus()=2)/调用行情数据函数Q_XXXXXQ_CloseQ_BidPrice需要判断当前行情数据是否有效,系统提供函数QuoteDataExist来对有效True,FalseTradeBlazer33.133.12.5Tr

6、adeBlazerBoolBoolRefBoolSeriesBoolNumericNumericRefNumericSeriesNumericStringStringRefStringSeriesString323.232CharlesSimonyi4.1.Thisisonestatement;2.Thisisanotherstatement;3.Thisisonestatement;Thisisanotherstatement;Thisisyetanother;Thisisonestatement;Thisisanother;赋值语句用于给公式变量指定一个具体的值的语句,赋值语句使用赋值操作

7、符(=)VarsBoolb;BeginB=true;EndVarsNumericValue1;BeginValue1=(Close+Open)/2;EndVarsStringstr;Beginstr=ItIsATest!;EndNumericSeriesNumericRefNumericBar3种基本类型,共95.1+-*/%A=AND/&0R/|NOT/(),5.2ParamsVars(),IfElseBeginEndForToDownToWhileBreakContinueTrueFalse5.3Data0-Data49505.4+II+IIFieldBoolFieldNumericFie

8、ldStringPlotBoolPlotNumericPlotStringPlotBarKUnPlotAlertBuySell6.TradeBlazer6.1)High+2*range/2;range(rangeHigh-Low)22()2*range/2(High)BarHigh+Low/2;(Low)True/FalseAND(&),OR(|)!/I!Bar(MidPoint)1/2Bar数为0的情况下,(MidPoint)周知,0不能作为除数,是否为0(High+Low)*0.5;A/BB0(High+Low)/2;TradeBlazer6.2+HThisisexpressionA+an

9、dthisisexpressionB.;HThisisexpressionAandthisisexpressionB.True/FalseAND(&),OR(|)6.3BarBarBarCloseHigh1;ASCIIASCIIabedzyxw;aASCIIzTrue6.4NOT(!)AND121AND2TrueTrueTrueTrueFalseFalseFalseTrueFalseFalseFalseFalseOR121OR2TrueTrueTrueTrueFalseTrueFalseTrueTrueFalseFalseFalseNOT1NOT1TrueFalseFalseTrueORTru

10、eTrueTrueCon1ORCon2ConiFalseCon2Con1ORCon2ConiFalseCon2BarLowHigh1;ANDTrueBarBarBarBarTrueHigh10ORVol5000;TrueTrueTruebar高价大于10,或于5000,那TrueFalseFalseFalseCon1ANDCon2Con1TrueCon2TrueCon1Con2TrueTrueCon1FalseCon2False5Open;CloseOpenAND54ORCloseOpen;CloseOpenOR54;7.Numeric,NumericRef,NumericSeriesBool

11、BoolRefBoolSeriesStringStringRefStringSeriesTradeBlazerClose154;Vol;(High+Low)/2;True/FalseTrueFalseTrueCloseOpen;5High1)Counter=Counter1+1;EndK线型态和特IfAlert在条件为TrueTradeBlazerIfBarlf(HighHigh1ANDLowHigh1ANDLowHigh1ANDLowClose1,Value1=Value1+VolValuel=Valuel-VolIf(ColseClose1)Value1=Value1+Vol;ElseVa

12、lue1=Value1-Vol;11.1.3If-Else-IfIf-Else-lfIf-ElseIf(Condition1)TOC o 1-5 h z HYPERLINK l bookmark0TradeBlazer1;ElseIf(Condition2) HYPERLINK l bookmark4TradeBlazer2;Else HYPERLINK l bookmark6TradeBlazer3;Condition1是一个逻辑表达式,当Condition1为True的TradeBlazer句1将会被执Condition1为False时,将会继续判断Condition2的值,当Condit

13、ion2为True时,TradeBlazerTradeBlazer1;TradeBlazer1;Condition1Condition2组合,条件表达式必须用()括起来。TradeBlazerTradeBlazer以省略If-Else-If的语句可Elself(Condition)2Condition2为FalseTradeBlazer3ElseIf(Condition1)TradeBlazer1;ElseIf(Condition2)TradeBlazer2;11.1.4If-Else的嵌套If-ElseIf-ElseIf(Condition1)If(Condition2)ElseTradeB

14、lazer2;ElseIf(Condition3)TradeBlazer3;ElseTradeBlazer4;Condition1Condition1Condition2TrueTradeBlazer式语句1将式语句2将会被执行。当Condition1为False的时TrueTradeBlazer3TrueCondition2Condition2FalseTradeBlazer,将会继续判断Condition3的值,当Condition3Condition3FalseTradeBlazer4()Condition1,Condition2,Condition3TradeBlazerTradeBl

15、azerIf(OpenHigh1)If(CloseOpen)Buy(1,Open);ElseBuy(1,Close);ElseIf(CloseOpen)Sell(1,Open);ElseSell(1,Close);11.2ForWhile11.2.1ForForFor循环变量=初始值To结束值TradeBlazer语句;步长为1递增,TradeBlazerForTradeBlazer必须使用。TradeBlazerTradeBlazerFalsePriceParamsNumericSeriesPrice(1);NumericLength(10);VarsLengthNumericSumValu

16、e(0);Numerici;Beginfori=0toLength-1SumValue=SumValue+Pricei;ReturnSumValue;EndForFor=DownToTradeBlazer;For-DownTo让循环变量从结束值每次递减1直到等于结束值,依次调用TradeBlazerFor语句是比较常用的一种循环控制语句,它应用于知道循环次数的地方,很多内建用ForSummationHighestLowestLinearReg11.2.2WhileWhile(True)(False)While(Condition)TOC o 1-5 h zTradeBlazer;Conditi

17、onConditionTrueTradeBlazerConditionCondition()TradeBlazerTradeBlazer100000BarVarsNumericSumVolume(0);NumericCounter(0);BeginWhile(SumVolume100000)SumVolume=SumVolume+VolCounterCounter=Counter+1;EndSumVolumeCounter0SumVolumeHigh,Tmp,High);oLower=IIf(TmpHigh1+Average(Close,10)*0.5)Buy(100,High1+Averag

18、e(Close,10)*0.5);Value1=High1+Average(Close,10)*0.5;If(CloseValue1)Buy(100,Value1);13.1变量类型BarTradeBlazer公式支持九种数据类型,但对于变量定义,引用类型是无效的Bar13.2TradeBlazerVarsVars1(初值);2(初值);3(初值);VarsNumericSeriesMyVal1(0);/MyVallNumericMyVal2(0);/MyVal2BoolMyVal3(False);/MyVal3StringMyVal4(Test);MyVal4Vars13.3变量的默认值在声

19、明变量时,通常会赋给变量一个默认值。例如上例中的0,值为0为0;False;Test。FalseTest数值型变量的默认值为0FalseBar13.4变量赋Name=Expression;NameClose10Value1Close10Value1Valuel=Average(Close,10);KeyReversalVarsBoolKeyReversal(False);BeginKeyReversal=LowHigh1;End13.5EntryPrcVarsNumericEntryPrc(0);BeginEntryPrc=Highest(High,10);If(MarkerPosition1

20、)Buy(1,EntryPrc);EndHigh10BarBarIfVarsBoolCon1(False);BeginCon1=HighHighest(High,10)1;If(Con1)Alert(New10-barhigh);End其实我们并不一定都要应用条件为True的情况,有时候我们需要判断条件为FalseVarsBoolCon1(False);BeginCon1=HighLowest(Low,10)1;If(Con1=False)Alert(Newhighorlow);End13.6序列变量Bar简单变量一样,只是定义的数据类型不同,您必须选择以下的3NumericSeries/Bo

21、olSeries/StringSeriesVarsNumericSeriesMyNumSVal(0);BoolSeriesMyBoolVal(False);StringSeriesMyStrVal();nOffsetTradeBlazer14.TradeBlazer14.1TradeBlazerBarBarnOffset,nOffsetBarBarnOffset=0BarVarsNumericSeriesMyVal;BeginMyVal=Average(Close,10);PlotNumeric(MyVal,MyVal3);EndMyVal,MyVal10MyVal3BarMyVal9Bar1

22、0BarMyValMyVal33Bar12Bar1211BarnOffsetCurrentBarnOffsetMyVal)MyVal=Pricei;MyBar=i;HighestBar=MyBar;ReturnMyVal;End15.6Numeric或者NumericRefNumericNumericSeriesNumericNumericNumericNumericRefNumericSeriesNumericRefNumericNumericRefNumericSeriesNumericSeriesNumericSeriesBoolBoolBoolRefBoolSeriesBoolRefB

23、oolBoolRefBoolSeriesBoolSeriesBoolSeriesStringStringStringRefStringSeriesStringRefStringStringRefStringSeriesStringSeriesStringSeriesNumeric返回值赋值给NumericSeries或NumericRefAverageVarsNumericValue1;BeginValue1=Average(Close,10);EndVarsNumericSeriesValue1;BeginValue1=Average(CloseTmp,10);EndA用户A15.7Fun1

24、ParamsNumericSeriesPrice(1);VarsNumericCumValue(0);BeginIf(CurrentBar=0)CumValue=Price;elseCumValue=Fun11+Price;ReturnCumValue;EndIndiFun1Value1=Fun1(Close);FuniFun1(Close)BarFun1(1)IndiFuniCloseIndiFuniFun2Fun2ParamsNumericSeriesPrice(1);VarsNumericCumValue(0);BeginIf(CurrentBar=0)CumValue=Price;el

25、seCumValue=Fun1(Close)1+Price;ReturnCumValue;End15.8用户字段BarBarData0-Data49BarFieldNumeric、FieldBool、FieldStringAlertHighestFieldl5BarParamsNumericLength(5);VarsNumericHighValue(0);BeginHighValue=Highest(Close,Length);FieldNumeric(HighestBar,HighValue);EndFieldNumeric/FieldBool/FieldStringFieldNumeri

26、c(Test1,Close);FieldNumeric(Test2,Open);FieldBool(Test1,True);FieldNumeric(Test1,10);FieldBool(Test1,True);FieldString(Test1,TestString);15.9技术指标Bar18012月2月3月bPoweredByTradeBlazer324877454-P742200018000昭工0AST324877MACDCl2,26,9)MACD180MACDkvg4541000TT-r-rq120052LILI620350gilllllll丄J_LJ-J-11LLLJJ11_一口

27、t|TT|ruOBLiT(.EtOBUTL日童戋2006/3/13C=2Li350105Li.52SLi=2i:i4SUH=2058i:i.irvData0-Data49BarPlotStringPlotNumericPlotBoolPlotString多组数据,通过PlotNumeric、PlotBoolAlertRSIParamsNumericLength(14);NumericOverSold(20);NumericOverBought(80);VarsNumericRSIValue(0);NumericRSIColor(-1);BeginRSIValue=RSI(Close,Lengt

28、h);If(RSIValueOverBought)RSIColor=RED;ElseIf(RSIValueOverSold)RSIColor=CYAN;PlotNumeric(RSI1,RSIValue,RSIColor);PlotNumeric(,Oversold);PlotNumeric(,OverBought);IfCrossOver(RsIValue,Oversold)Alert(Indicatorexitingoversoldzone);IfCrossUnder(RsIValue,OverBought)Alert(Indicatorexitingoverboughtzone);End

29、RsIRsIPlotNumeric(Test,10);PlotNumeric(Test,20);Test201015.10KKBarData0-Data49BarKKKKPlotBarAlertKKK线型态在执行时,必须要指定相应的数据源和周期,需KVarsBoolCondition(False);BeginCondition=(Abs(Close-Open)*10(High-Low)And(HighClose)And(LowClose);If(Condition)PlotBar(SZX,High,Low)EndKPlotBar15.11特征走势BarData0-Data49BarPlotNumeric、PlotBool、PlotStringAlertParamsNumericLength(5);VarsBoolCondition(False);BeginCondition=(High=Highest(High,Length);If(Condition)PlotNumeric(CLSXG,High)EndPlotNumeric、PlotBool、PlotString15.11交易指TradeBlazerIf(Condition)Buy(1,Close);BarTr

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论