EasyLanguage语法.pdf
《EasyLanguage语法.pdf》由会员分享,可在线阅读,更多相关《EasyLanguage语法.pdf(49页珍藏版)》请在冰豆网上搜索。
EasyLanguage语法语法MultiCharts&TradeStation编程语言金融工程二部DannieCopyright2011浙商期货有限公司AllRightReservedEasyLanguage1.基本关键字部分2.流程控制语句3.多图表数据调用4.全局变量5.趋势线画图6.部分实盘注意点分享基本关键字基本关键字Copyright2011浙商期货有限公司AllRightReserved买卖指令买卖指令Buy买入开仏Sell卖出平仏Sellshort卖出开仏Buytocover买入平仏Copyright2010浙商期货有限公司AllRightReservedOrder类型类型Copyright2010浙商期货有限公司AllRightReservedCopyright2011浙商期货有限公司AllRightReserved回溯调用回溯调用Nbarsago数据的写法:
XXXN例:
highof5barsago(REF(HIGH,5))high5或者h5流程控制语句流程控制语句1.IF语句2.Begin.end语句3.Once语句4.For循环5.While循环6.Switchcase语句Copyright2010浙商期货有限公司AllRightReservedIf语句语句IfconditionsthenELinstruction;IfconditionsthenbeginELinstructions;End;Copyright2010浙商期货有限公司AllRightReservedIfthen&Beginend;Copyright2010浙商期货有限公司AllRightReserved忽略字忽略字显示为红色字体的用于阅读,在程序里面丌起仸何语句功能AAnAtBasedByDoesFromIsOfOnPlaceThanTheWasCopyright2010浙商期货有限公司AllRightReservedIfelseIfconditionsthenELinstructionselseELinstructions;Copyright2010浙商期货有限公司AllRightReservedIfelse&beginend;ifconditionsthenbeginELinstructions;endElsebeginELinstructions;end;Copyright2010浙商期货有限公司AllRightReservedOnce语句语句EL的程序是每个K棒执行一次,Once语句能使指定陈述式只执行一次onceELinstruction;OncebeginELinstructions;End;Copyright2010浙商期货有限公司AllRightReservedOnce语句语句当第一次满足条件时,执行陈述式OnceconditionsbeginELinstructions;End;Copyright2010浙商期货有限公司AllRightReservedOnce语句语句Copyright2010浙商期货有限公司AllRightReservedFor循环循环Copyright2010浙商期货有限公司AllRightReservedFor循环循环For循环变量=起始值to终值beginELinstructions;End;For循环变量=起始值downto终值beginELinstructions;End;Copyright2010浙商期货有限公司AllRightReservedFor循环循环Copyright2010浙商期货有限公司AllRightReserved求5天价格之和:
for循环循环Copyright2010浙商期货有限公司AllRightReserved中间需要终止循环的:
While循环循环Copyright2010浙商期货有限公司AllRightReserved假真判断条件判断条件循环体循环体While循环循环WhileconditionsbeginELinstructions;end;Copyright2010浙商期货有限公司AllRightReservedWhile循环循环Copyright2010浙商期货有限公司AllRightReserved求5天价格之和:
While循环循环防止形成无限循环:
Copyright2010浙商期货有限公司AllRightReservedSwitchcase对同一个变量或者表达式进行多重判断时,可以利用Switchcase语句,简化于繁琐的ifelse多重嵌套结构语法结构:
Switch(变量或者表达式)begincase数值或者字串:
ELinstruction;(casecasecase)default:
ELinstruction;End;Copyright2010浙商期货有限公司AllRightReservedSwitchcase例:
图表是分钟线:
画5MA图表是日线:
画20MA图表是周线:
画50MACopyright2010浙商期货有限公司AllRightReservedSwitchcase用ifelse结构:
Copyright2010浙商期货有限公司AllRightReservedSwitchcase用Switchcase结构:
Copyright2010浙商期货有限公司AllRightReserved多图表数据调用多图表数据调用1.丌同商品之间数据2.同种商品丌同时间周期的数据3.需要用到图表外数据的其他情形语法:
数值变量ofdataN(N值最大到99)Copyright2010浙商期货有限公司AllRightReservedData1dataN分析豆油的同时,需要同时比较大豆走势:
Data1:
豆油Data2:
大豆(跨时间周期调用类似,order只能下在data1商品上)Copyright2010浙商期货有限公司AllRightReserveddataN的注意点的注意点1.函数仅有一个参数资料数列时,二种写法效果相同2.value1直接针对变量指定资料数列3.value2把变量对应的资料数列指定为新资料数列Copyright2010浙商期货有限公司AllRightReserveddataN注意点注意点若函数里面变量有指定资料数列,外加指定数列变换时,仍以变量自身设定数列为主Copyright2010浙商期货有限公司AllRightReserved全局变量全局变量跨图表数据之间联系:
在同一工作窗口中打开多个图表,用全局变量串联之间某些变量GVSetNamedDouble(“变量名”,设置值)GVGetNamedDouble(“变量名”,缺失值)GVSetNamedInt(“变量名”,设置值)GVGetNamedInt(“变量名”,缺失值)Copyright2010浙商期货有限公司AllRightReservedCopyright2010浙商期货有限公司AllRightReserved全局变量全局变量小麦和玉米,仸何其一有持仏,则丌再开仏Copyright2010浙商期货有限公司AllRightReserved趋势线画图趋势线画图支持的5种画线类型:
线条(line)柱状图(Histogram)点(Point)十字(Cross)K棒(BarHigh、Barlow、lefttick、righttick)Copyright2010浙商期货有限公司AllRightReservedRightickCopyright2010浙商期货有限公司AllRightReservedlineCopyright2010浙商期货有限公司AllRightReservedBarhigh&barlowCopyright2010浙商期货有限公司AllRightReservedcrossCopyright2010浙商期货有限公司AllRightReservedplot指标中,依特定数值绘制线条或者K棒、文字语法:
PlotN偏移值(指标数值,“指标名称”,色彩,储存格背景色,线宽)Plot13(close,”close3barslater”,blue,green,3)Copyright2010浙商期货有限公司AllRightReservedTl_new指标或者信号中,绘制一条指定起点和终点的趋势线;并传回画线编号的数值语法:
Tl_new(起始日期,起始时间,起始价格,终点日期,终点时间,终点价格)日期格式YYYMMDD时间格式HHMMCopyright2010浙商期货有限公司AllRightReservedTl_new绘制从昨天开盘9点00分时开盘价开始,到今天15点00时的close价格结束的趋势线Copyright2010浙商期货有限公司AllRightReservedText_new在图表上指定位置标示一个特定文字的显示语法:
Text_new(日期,时间,价格,“显示文字”)Copyright2010浙商期货有限公司AllRightReservedText_new例:
当连续三根K线的开盘价都持续升高,则在K线最高点的位置标示“Apex”Copyright2010浙商期货有限公司AllRightReserved实盘注意点实盘注意点Order写法的格式固定:
(buy)thisbaratclose;(buy)nextbaratXXXXstop(orlimit);Copyright2010浙商期货有限公司AllRightReserved条件满足就买条件满足就买1.开启bar内交易:
IntrabarOrderGeneration=true可以结合barstatus2.多图表,结合全局变量,大周期条件判断,小周期发orderCopyright2010浙商期货有限公司AllRightReserved快快10秒下单秒下单Copyright2010浙商期货有限公司AllRightReserved多时间框架多时间框架用data1、data2的时候,涉及到一些如求highest的函数,如果data1和data2的周期大小丌一样,那要注意时间截止的周期问题:
Data1:
5minsdata2:
20minsHighest(h,4)ofdata2Copyright2010浙商期货有限公司AllRightReserved浙商期货金融工程二部1.程序化交易平台(MultiCharts、TradeBlazer)应用技术支持2.为客户实现交易策略提供:
培训、策略编程咨询、技术答疑QQ:
314398153Tel:
0571-82820093Copyright2010浙商期货有限公司AllRightReserved