关键词不能为空

当前您在: 主页 > 英语 >

Easylanguage的下单指令

作者:高考题库网
来源:https://www.bjmy2z.cn/gaokao
2021-02-12 01:50
tags:

-

2021年2月12日发(作者:系带鞋)


Easylanguage


的下单指令



1


.基本指令



Mc


新版本中,开仓指令是


Buy



SellShort


,平仓指令是


Se ll



BuyToCover




下面是


mc



ts


两个版本的下单指令对比:



指令版本



建多仓



建空仓



平多仓



平空仓



TradeStation


TradeStation


Multicharts


Multicharts


实例



2000i



8


Buy(“war1”) next bar at market;



Buy



Buy



Buy



Sell



ExitLong



ExitShort



SellShort



Sell



BuytoCover



SellShort



SellShort(“war2”)


next bar



at market;



Sell(“war3”)


next


bar


at


market;



Sell



BuytoCover



BuyToCover(“war4”) next bar



at market;



2.


指令详细分析



Buy(“Buy”) 2 contracts next bar at Market;


//

< p>
在下个


bar


刚开始以市价买入

< br>2





Buy



下单动作,代表开多仓。这一类关键字还有:



SellShort


开空仓


;Sell


平掉多仓


;BuyToCover


平掉空仓



“BUY”



动作标识(


EntryLabel


,通常注明为什么入场


/


出场)。该标识紧跟在下单动作后面,并置于小括弧中


,


是用


来区分多个入场


/


出场情景的,不能重复。



2 Contracts


头寸大小(


TradeSize


)。当前代表交 易


2


手,


2 contracts=2 contract=2 shares=2 share



< /p>


该字段可以省略,省略代表使用默认头寸大小


(

< br>默认头寸大小,请参见信号属性


)



Next Bar


下单时间。只有两个选择:


this bar




next bar


,每句下单指令必有这二者之一。



At market


下单价位。



如果下单时间是


this bar



则下单价位只能是


on close



this bar on close=this bar close=this bar



代表当前

< p>
bar


结束时进行市价交易;


如果下单时间是


next bar


则很灵活,


可以分为市价 和限价,


市价例如:



at open ,at market


等,限价例如:


at 4330 stop, at 4550 limit , at 4660, at High+5



;


3


.仓位管理



假设当前已开多仓


(marketPostion=1)


,则 :



>>


可执行


Buy


指令来加仓



Buy(“buy1”)


2


contracts


next


bar


at


market;


执行该指令相当于在原来的仓位基础上增加


2


手(和


第一次开仓指令没啥区别,


但是需要注意:


信号属性中必须选中复选框


“同一时刻,


允许最大< /p>


N


个同向进场”





>>


可执行

Sell


指令来平仓



Sell(“sell2”) next bar at market;


执行该指令相当于平掉所有的多仓。



Sell(“sell3”) 4 contracts


next bar at market;


执行该指令相当于平掉每个

< br>Buy


进场的


4


手多

< p>


(


若某个进场


Entr y


不满


4


手,则有几手平几手


)




Sell(“sell4”) 4 contracts total next bar at market;


执行该指令相当于平掉前


4


手多仓。



Sell(“sell5”) From Entry(“war1”) next bar at market;


执 行该指令相当于平掉进场


War1



所 有仓位。



Sell(“sell5”) From Entry(“war2”) 4 contracts


next bar at m arket;


执行该指令相当于平


掉进场


War2



4


手仓位(若不满


4


手,则有几手平几手


)



>>


可执行

< br>SellShort


指令来反转仓位,变多仓为空仓。



SellShort(“sellShort6”)


5


contracts


next


bar


at


market;


执行该指令相当于先平掉所有多仓,


再建


5< /p>


手空仓。注意:这里信号必须保留有过去的仓位记录,如果中途因某种原因丢失了仓位记录 ,那系统


只会直接建


5


手空仓。



4


.市价与限价



Buy(“Buy1”) this bar on close;




Buy(“Buy1”) this bar close;




Buy(“Buy1”) this bar;



Buy(“Buy2”) next bar at open;



=Buy(“Buy2”) next bar at market;



这些是市价交易,而限价交易都有价格限定


:


Buy(“Buy3”) next bar at 4300;



=Buy(“Buy3”) next bar at 4300 limit;


(表示在


4300


的范围内可交易)



=Buy(“Buy3”) next bar at 4300 or lower


;



Buy(“Buy4”) next bar at 4300 stop;

< p>


stop


单,表示超出


4300


的范围则可交易)



=Buy(“Buy4”) next bar at 4300 or higher;



注意:上海交易所本身不支持市价交易,达钱 进行了变相处理,比如市价买入,相当于使用涨停价去限价买


进,市价卖出,相当于使用 跌停价去限价卖出。



5


< p>
Stop



Limit


Limit


标准限价单的标识,可省略。



Stop


限价单的反向扩展,常称为


stop


单。



按照我的个人理解,限价单的作用无非就是限制滑价,



Stop


单的用途完全不同,


stop


单主要用于突破系统,


如下图多方与空方在阻挡线

3600


处争夺,你现在还不知道战争的结局,但这时候你可以确定自己的战略:只


要向上突破


3600


超过


2


点,就认为后期是趋势上升的


,

< br>立刻买进!那么现在就可以下


stop



:


If(marketpostion<>1)then


buy(“breakoutLong”) next bar at 3600+2 stop;//


只要下个


bar


达到< /p>


3600+2


点就系统自动买进




可以从另一个角度再去理解


limi t



stop




Buy(“Buy3”) next


bar at 4300;



=Buy(“Buy3”) next bar at 4300 limit;


(表示在


4300


的范围内可交易)



=Buy(“Buy3”) next bar at 4300 or lower;



Buy(“Buy4”) next bar at 4300 stop;

< p>


stop


单,表示超出


4300


的范围则可交易)



=Buy(“Buy4”) next bar at 4300 or higher;



SellShort(“Short3”) next bar at 4300;



=SellShort(“Short3”) next bar at 4300 l imit;


(表示在


4300


的范围内 可交易)



=SellShort(“Short3”) next bar at 4300 or higher;



SellShort(“Short4”) next bar at 4300 st op;



stop


单,表示超出


4300


的范围则可交易)



=SellShort(“Short4”) next bar at 4300 or lower;



6


.细微区别



This bar on close



next bar at open



next bar at market


首先,


next bar at open =next bar at market


,其次


this bar on close


是在当前


bar


的结束时间 进行市价交易,


next bar at open(market)

< br>是在下一个


bar


的开始时间进行市价交易。

< p>


对于连续


k


线来说(假 设无跳空)当前


bar


的收价和下个


b ar


的开价是一样的,所以交易价格上保持一致。


不过,毕竟< /p>


this bar


就是


this bar



next bar


就是


next bar


,交易的 时间是计算在了不同的


bar


上,在同一条

件下执行这两条指令,二者在同时刻的


barssinceentry


是不同的。



对于有跳空的


k


线来说,


this bar on close


真的能在当前


bar


交易成功吗?还是和

< p>
next bar at open


一样到了下



bar


才实际交易成功?我也不知道!这需要清楚其指令的内部 原理才会明白。。。



7.


内置止损



1>.


止损



SetStopLoss(Amount)


当亏损达到


XX


元时,平仓



2>.


止盈



SetProfitTarget(Amount)


当利润达 到


XX


元时,平仓



3>.


保本止损



SetBreakEven(Profit)


当利润达到


XX


元时,启用“保本”



4>.


吊灯止损



SetDollarTrailing(Amount)


当与 最大收益相比,一旦回落


XX


元,平仓



SetPercentTrailing(Profit,Percentage) < /p>


当利润达到


XX


元后,一旦利润回撤


YY%


,平仓



这 些内置止损中,止损和止赢默认都是针对每手合约的,如果是整体资金止损,需要设置在前面加入指令:



SetStopPosition;


然后使 用


setstoploss



setp rofitTarget


就代表总损失(总盈利)达到


Amou nt


后立即平仓



原文地址:


EasyLanguage/PowerLanguage


策略语言研 究


作者:


fractal



1


止损的函数用什么?



请教前辈,止损应该怎么写?


2


种情况



1.


到价格触及到


-5%


时。



2.


到 收盘价触及到


-5%


时。



以多单的止损为例



1



sell next bar at entryprice*0.95 stop;


2



if close



2


向高手老手请教, 在


ts


中如何实现资金管理?



建议你设置止损,按能接受的止损来设置头寸,就是


ANP

< p>
方式



AccountBalance = InitialBalance + netprofit;


DollarRisk = AccountBalance * rate;


LTT=IntPortion (DollarRisk/stoploss);



3


[


函式介绍


]


如何用< /p>


EL


表示期货涨停,跌停价



最近有同学问到这个问题,现整理出来供大家一起参考学习


~


由于中国商品期货的涨跌停系数会随着假日时间的变动而变动(中国商品这个感觉很麻烦 ,需要随时关注交


易所公告来进行调整),以下是具体的一个例子的写法:



1.



Inputs:b egintime(1100608),endtime(1100912),abnormalratio(0 .2),normalratio(0.1);



2.



vars:upprice(0 ),downprice(0);



3.




4.



if time>=begintime and time<=endtime



5.



then begin



6.


< br>upprice=Closed(1)*(1+abnormalratio);



7.



downprice=Clos ed(1)*(1-abnormalratio);



8.



end



9.



else begin



10.



upprice=Close d(1)*(1+normalratio);



11.



downprice=Clo sed(1)*(1-normalratio);



12.



end;



复制代码



4


软件使用讨论


]


如何将


Tb

< p>
代码转为


MC


代码



下面是我在转换


TB


代码到


easylanguage


的时候做的日志记录,有些是那个策略特有的,肯定 还有很多漏掉


的,我没空整理了,大家可以参考下




1 {


变为


then begin


考虑< /p>


then


换行后


begin


如果在


if else


中注意


else


后没有


then

while



begin


前不需要


then


2 }


变为


end;


如果在


if else


中注意


else


钱的


end


没 有分号



3 Params


变为


Inputs:


注意别忘记分号



4 Vars


变为


variables:


注意别忘记分号



5


声明类型去掉



Numeric ra ngeMove(2);


中的


Numeric

< br>全部去掉



6


声明后的分号改为


,


注意参数和变量的最后一个保持分号



7


声明类型缺少默认值的补上



8


逻辑运算中,等号


==

< p>
变为


=,


不等号


!=


变为


<>


9


注释全部去掉



10


下单指令



Bool Buy(Numeric Share=0,Numeric Price=0,Bool Delay=False)


Share


买入数量,为整型值,默认为使用系统设置参数;



Price


买入价格,为浮点数,默认


=0


时为使用现价


(


非最后


Bar



Close)




Delay


买入动作是否延迟, 默认为当前


Bar


发送委托,当


Del ay=True


,在下一个


Bar


执行 。



Buy xxx contracts next bar at xxx stop;


11 Ceiling Tb


中两个参数



Ceiling(timemin/BarInterval, 1)


改为


Ceiling(timemin/BarInterval)


12 &&


变为


and ||


变为


or


13 Contrac tUnit()


变为


currentContracts X


14


变量名


range->myrange


15 GetGlobalVar-->GVGetNamedDouble


16 IntPart-->IntPortion


17 InvalidNumeric-->-1


18 GVGetNamedDouble (40


变为


GVGetNamedDouble(


set


同理



19 if< /p>


后面的括号,


mc


可以有可以无,但是< /p>


tb


必须有



20 mc



maxlist


函数



对应


tb



max



minlist


--


min


21 mc



print


对应


Comm entary


22 mc


中的变量默认是序列变量


Tb


中 的变量主意区分普通变量和序列变量,如果同样是序列变量:



需要重设变量值



isBreak=isBreak[1];


k1=k1[1];


J1=J1[1];

< br>5


[


程序代码分享


]

< p>
深入


Numeric


资料形态



MC


中,

资料形态有三类



Numeric, TrueFalse




String


其中


Numeric


可以再细分 成


Int



Float



Double



如果只宣告 变数为


Numeric



MC


有自动帮你选择适当的数值形态,有些情况下,


MC

无法准确的判断时,有


可能会出现使用


Double


储存


Int


形态的资料,如此一来,系统效能 将会大大降低。如果你可以确定宣告变数


myVars


的资料< /p>


形态为整数时,下次建议可以考虑用



1.



vars: int myVars(0);



复制代码



取代



1.



vars: myVars(0);



复制代码



6


[


程序代码分享


]


提供一个移动止损的 方法



移动止损的方法有很多,可以控制亏损百分比,或者控制 亏损金额,我先抛个砖,大家继续:



stop1=0.02; //2


个百分点止损



myStop= 2990;//


根据商品的价格不同而定义



if marketposition >0 then begin


if c*(1-stop1) > myStop then myStop = c*(1-stop1);


end;


if marketposition <0 then begin


if c*(1+stop1) < myStop then myStop = c*(1+stop1);


end;


if marketposition >0 and c < myStop then sell next bar at market;


if marketposition <0 and c > myStop then buytocover next bar at market;


再提供一种方法:



2%


止损


:


if marketposition>0 and entryprice>close and (entryprice- close)/entryprice>=2% then


sell next bar at market;


if marketposition<0 and entryprice=2% then


buytocover next bar at market;



7


当日输

< p>
N


次不交易



做当冲的时 候,最怕盘整盘。遇到盘整盘时,顺势系统很容易被修理。



为 了避免当日亏损太多次,可以使用


DailyLosers


这个 函数



以下是当日输


N


次不交易的写法



if DailyLosers(date)<=N then begin


1.



{code of your entry signal}


2.



end;


复制代码



8


程序代码分享


]



直接在


POWER EDITOR


看系统讥效



常常要不断 的改程序,让系统变好。不过当每次做点细小的修改,就要跑一次回侧报告,有点不方便。



尤其有时候只是要让


DRAWDOWN

变小。




为了让开发过程更容易 ,我在程式码后段加入下面程式码,这样一来,只要在编译后马上可以看到这次修改


是否 有让系统变好,不需要再到回侧报告去找。虽然不是很详细,不过有时后对我来说已经足够了,感觉很

< p>
方便。



1.



once(LastBarOnChart_s) begin


2.



messagelog(


3.



messagelog(


4.



messagelog(


5.



messagelog(


6.



messagelog(


7.



messagelog(


8.



messagelog(


9.



messagelog(


10.



messagelog(


11.



messagelog(


12.



messagelog(


13.



end;


复制代码



本主题由


futuregirl



2010-7-15 15:55


设置高亮



收藏分享




Easylanguage


识别出某种信号后,可以有五种方式向你传递消息,请选择自 己喜欢的:



一、控制台


output



二、


图表


chart



三、文件


file



四、提示音


wav


五、信息视窗


alertwindow




我们将逐一介绍?



Easylang uage


的五种输出方式


.rar




10


[


程序 代码分享


]



减仓别忘了加


total


这个保留字




MC


中,第一次建仓或是要加仓时,可以用下面的语法



1.



buy (


2.



sellshort (


复制代码



当要减仓时则要用



1.



sell (


2.



buytocover (


复制代码



如果没有加


total


< p>
MC


会把你所有仓位都平仓掉。



本主题由


futuregirl



2010-7-15 15:24


设置高亮



11


编程求助


]



如何根据条件分段


plot




MC


里用


plot


画的都是连续的线条,我 要画一段一段分开的线条,如何画,我加了


if


然后

< p>
plot


也不行。比如


我之要

time>=0910 and time<=1450


这一段的

< br>ma


,怎么画?



Code:


if time >=1000 and time <=1100 then


plot1( AverageFC( c, 9 ) ,


setting:


设置指标


->


样式,



更改画线


Type



Point or Cross


12


如何按资金的百分比开仓



自己找到答案,自己回一个:



Inputs:


initCapital(100000);


Variables:


RiskPercent(0.3),


TotalEquity(0.0),


SetShareSize(0);


TotalEquity =initCapital+NetProfit+OpenPositionProfit;


SetShareSize= TotalEquity * RiskPercent/Close;


Buy(


sell(


13


[


程序代码分享

< br>]



计算当日做多的次数



在日内交易中,我们常常需要知道今天作多几次,以下是我的编程方式,与大家分享



1.



vars:


2.



mp(0),


3.



mpd(0),


4.



myLongNumber(0);


5.




6.



mp = i_CurrentContracts;


7.



mpd = i_MarketPosition;


8.




9.



if date<>date[1] then myLongNumber = 0 else begin


10.



if mpd=1 and mpd[1]=-1 then begin


11.



myLongNumber=myLongNumber[1]+1;


12.



end else begin


13.



if mp>mp[1] and i_MarketPosition>0 then


14.



myLongNumber=myLongNumber[1]+1


15.



else


16.



myLongNumber=myLongNumber[1];


17.



end;


18.



end;


19.




20.



DailyLongNumber = myLongNumber;


复制代码



14


[


编程求助


]



不等


next bar


就买卖?



MC


里关于买卖的操作,都是在


buy/sellshort


next


bar


上实现的,最早的入市也是


buy/sellshrot


this


bar


on

< p>
close


来实现的。设想:把


data1


的时间周期设置成


1


分钟甚至


tick


图,然后


data2


来做正常的系统条件


判断,这样是不是就能实现类似于条件满足就马上买入卖出的操作呢 ?




Max


老师详细的说明下这个用法,最好能配合着例子,我想有很多人想要了解这点的


...


Dannie


发表于


2010-8-27 08:45



首先要把

< br>IntraBarOrderGeneration


打开(在

Format Signal


里的


Intra-bar Order Generation


),接著程


式码必须要判断 目前的


tick


是属于当根


bar


的哪个位置(可以在


barStatus


这 个保留字得知)。这样程式码


就会每根


tick


就会执行一次。



15


在盤中 常常發現某些整點時間或特定時間週期會突然有許多系統單同時出來


< br>特別是長週期的突破系統,通常會在突破後的下一個整點時間全數出唬



因此出現滑價或買不到好價位



針對這 個問題,可以用語法來解決,讓你比別人快幾秒進場,甚至可以吃點別人的豆腐



一般程序化交易系統都往往會在這根


bar


結 束


(buy this bar at close)


或是下根


bar


開始


(buy next bar at


open)


時送出委託單,如果你可以在這根< /p>


bar


結束前就進場,自然比別人更佔便宜!


這裡把送出委託單的時間在往前移


10

< br>秒,必須啟動


IntrabarOrderGeneration


才能正常咦鳌




Multi charts


裡設置


Format(


格式


)->Signal(


信號


)-> Fomat(


設置


)->IntrabarOrderGene ration(Bar


內產


生委託


)


語法如下,請回覆本帖即可觀看。



本帖隐藏的内容



1.



vars:


2.



intrabarpersist waitingForBuy(false),


3.



intrabarpersist mySec(0),


4.



intrabarpersist myEntrySec(0);


5.




6.



if barstatus=0 then begin


7.



mySec = currenttime_s;


8.



myEntrySec = currenttime_s+barinterval*60-10;


9.



end else begin


10.



mySec = mySec[1];


11.



myEntrySec = myEntrySec[1];


12.



end;


13.




14.



if {your entry condition} then begin


15.



waitingForBuy = true;


16.



end;


17.




18.



if waitingForBuy and currenttime_s>=myEntrySec then begin


19.



buy next bar at open;


20.



waitingForBuy =false;


21.



end;


16


[


编程求助


]

< p>


出场信号为买入价格获利


3%

< br>怎么写



也可以試試



1.



if marketposition<>0 then setprofittarget(entryprice*0.03*bigpointvalue);


本帖最后由


samwjwj



2010-9-1 12:49


编辑



if marketposition=1 then sell next bar at entryprice*1.03% limit;


别叫老师,俺才刚上路呢



17


函式介绍


]


entryName



exitName


的使用



当系统越来越大,

< p>
进出场信号也会越来越多,


如何知道目前进场是哪个信号所触发呢


?


可以使用


entryName




exitName


这两个保留字,这样就能依照不同的进场信号来做不同的处理。



18


[


函式介绍


]


BarStatus


想请问各位高手,


若是在多单的情况下,


当日盘中价格比昨日收盘价低


2 %


以上,


则盘中在


(


昨日收盘价


*0.98


)


这个价位自行停损,该怎么写


?


多谢


! P.s


假設使用日线的狀況



常常我 们都用


5


分线或


15

< br>分线,但实际在交易时,市场的资料是不断地近来,为了抓住下单的先机,可以启



Intra-ber


order


generation


,并且在程序中调用不断进来的


TIC K


资料。


BarStatus


这个程序 是让我们知


道目前这个


TICK


是当下


Chart


中这跟


Bar



TICK


形态,回传值的意义如下:



?



2 = the closing tick of a bar


?



1 = a tick within a bar


?



0


=


the


opening


tick


of


a


bar


(relevant


only


for


strategies


using


Open


Next


Bar


order


actions)


?



-1 = an error occurred


19


[


函式介绍


]


eq uity


有關的保留字哂门


c


分析



有朋友问到在


easy languag e


可不可以用


equity


来做分析运 用,答案是肯定的。介绍几个保留字的运用:



capital


:权益数


< p>
openpositionprofit


:未平仓损益


i-closedequity :


平仓后累计损益



如果要计算


30



bar


的权益 数标准差语法如下:



vars: stv(0);


stv=StdDev(capital,30);


如果要计 算


30



bar


的平均权益数语法如下:



vars:average_capital(0);


average_capital =average(capital,30); < /p>


上边的


capital



i-closedequity


这两个保留字,


是不是 只在


ts8


以上版本有效?好像别的地方都没有相关

< p>
的信息。


...


domodo


发表于


2010-8-26 11:20



自定一个函数



capital = InitialCapital + i_OpenEquity;


找不到


closedequity


可以试试


i_ClosedEquity


20


使用不同時間尺度的


data < /p>


(以同時使用


5Min


線與


60


分線為例)



想像有一 個系統是這樣的,當


60


分線的


rsi


處於鈍化狀態(三根


bar


大於


70)



5Min


線 的


rsi


在超賣區


(

< br>小



30)


則進場作多


...



MultiChart


要怎麼實現呢?這裡需要用到兩個


data 5


分線與


60


分線。首先把兩個


data


都加到圖表中,一個是五分線,一個是


30


分 線



1.



value1 = rsi (c,20);



2.



value2 = rsi(c of data2, 20) of data2;



3.



if countif(value2>70,3) of data2 =3 and value1<30 then



4.



buy next bar at market;



复制代码



21


程序代码分享


]


ELCollection for Multicharts


array


不够用吗?可以试试前人 开发的外部函数,让


Multicharts


也能使用


List



Map


两种 资料型态。




22


[


程序代码分享


]

< p>
EA


能帮我实现下面的想法吗?



如果现在是


13:29


分,我手中的策略是如果下午 的行情开盘高于上午收盘时以上午收盘的价格


+1


点买入,但< /p>


是如果出现高开的情况,我想撤单,然后现价买入,可否实现?



回复


2#


Lee



的帖子



将你的文自转成


Easy Language


,我的写法如下



1.



if time=1130 then value1=c;


2.



if time=1330 and o>value1 then buy next bar at c[1]+1 limit;


复制代码


< /p>


对于高开的情况,可能需要更精确的定义,比方说什磨情况下叫高开?或是说这跟


bar


没做到,下跟


bar


价买进?



23


[


程序代码分享


]


Better Volume Indicator


Inputs: LowVol(True), ClimaxUp(True), ClimaxDown(True), Churn(True);



Variables: BarColor(Cyan),UseUpTicks(false);


If BarType > 1 and UseUpTicks=false then begin


If C > O and Range <> 0 then Value1 = (Range/


(2*Range+O-C))*UpTicks;


If C < O and Range <> 0 then Value1 = ((Range+C-O)/


(2*Range+C-O))*UpTicks;


If C = O then Value1 = 0.5*UpTicks;


Value2 = UpTicks-Value1;


End;


If BarType <= 1 and UseUpTicks then begin


Value1 = UpTicks;


Value2 = DownTicks;


End;


Value3 = AbsValue(Value1+Value2);


Value4 = Value1*Range;


Value5 = (Value1-Value2)*Range;


Value6 = Value2*Range;


Value7 = (Value2-Value1)*Range;


If Range <> 0 then begin


Value8 = Value1/Range;


Value9 = (Value1-Value2)/Range;


Value10 = Value2/Range;


Value11 = (Value2-Value1)/Range;


Value12 = Value3/Range;


End;



24


[


软 件使用讨论


]



盘中止损的程序语言


?


想请问各位高 手,


若是在多单的情况下,


当日盘中价格比昨日收盘价低


2%


以上,


则盘中在


(


昨日收盘价


*0.98


)


这个价位自行停损,该怎么写


?


多谢


! P.s


假設使用日线的狀況



我来试试看



1.



if market position =1 and close[0]


2.



then sell next bar at market;


复制代码



要在软件中设定设置


inter- bar


交易



25easylangu age


使用动态链接库


(DLL)


听 说


EL


可以通过动态链接库(


DLL< /p>


)调用


C#


,请问具体操作方法是什么, 能举个例子吗?



回复



1#


Steven



的帖子



可以参考附件


C#


并不适合开发


UNMANAGED DLL




建议还是直接使用


C



C++


会比较容易一些



easylanguage_extension_


回复


1#


Steven



的帖子



举例



external:



外部档案存放的位置



int DLL


传出值(整数


)



输出名(自定义)



string DLL


收到的值


(


字串)



if value1 = checkname(


............................< /p>



25


程序代码分享


]



判断图形的时间尺度,并在程式码中加入防呆机制



本帖最后由


Max



2010-6-17 11:58


编辑



当我们用


EL


开发时,有些观念只适用在


5



K


线,有些观念只适用于日线,为了避免使用错误,我们可以在


程式编码里面加入一些防呆机制,如下



1.



once begin


2.



if bartype<>0 then


3.



raiserunt imeerror(


4.



end;


复制代码



这里用到两关键字,


bartype



raiseruntime error


bartype


回传直代表的意义如下



0 = TickBar


1 = Intraday


2 = Daily


3 = Weekly


4 = Monthly


5 = Point & Figure


至于


raiseruntimeerror< /p>


这个程序会让


MULTICHARTS


在 右下方跳出错误信習,



并将该分析的状态切换到





26

[


函式介绍


]


程式码中调用交易成 本



每次交易的成本包含手续费与滑价,我们可以在程式码中使 用


commission


以及


slippage


来调用这两个设定,



比方说希望损益平衡就出场观望,可以这样写



once costPoint = (slippage+commission)/bigpointvalue;



1.




2.



if marketposition>0 and c<=(i_AvgEntryPrice+costPoint) then begin



3.




4.



sell (



5.




6.



end;



7.




8.



if marketposition<0 and c>=(i_AvgEntryPrice+costPoint) then begin



9.




10.



buytocover (



11.




12.



end;



复制代码



27



本帖最后由


Max



2010-6-22 12:30


编辑



回复



1#


futuregirl



的帖子




easylanguage


中,


ATR


的调用函数为


AvgTrueRange


,以多单止损为例, 我的语法如下,提供给大家参考



1.



if marketposition>0 and c cross under (entryprice- AvgTrueRange(20)) then



2.



sell next bar at market;



复制代码



28


出场后观望


N

< br>根


BAR


在作下一笔交易



常常我们会希望出场后先观望一阵子,在作进场的判断,以下是我的写法,这方法只适用于日 内交易,跟大家分享



1.



vars:



2.



waitingBar(0), NBars(20);



3.



if ExitsToday(date)>0 and marketposition=0 then



4.



waitingBar = barssinceexit(1)



5.



else



6.



waitingBar = 99999;



7.




8.



if waitingBar>Nbars then begin



9.



{your entry code}



10.



end;



复制代码



29


[


程序代码分享


]



当日亏损


N


点后,出场并当日不交易

< br>


有时候会遇到当日的盘形不适用于系统的交易逻辑,当下最好就是先出场观望。



当日亏损


N


点 后,出场并当日不交易


管的最后一道防线,以下是我的写法,与大家分享



1.



vars:



2.



dailyInitCapital(0),



3.



lossPoint(50),



4.



myCapital(0),



5.



stopTradeDaily(false);



6.




7.



if date<>date[1] then stoptradeDaily=false;



8.




9.



mycapital = InitialCapital + i_OpenEquity;



10.



if date<>date[1] then



11.



dailyInitCapital = mycapital



12.



else



13.



dailyInitCapital = dailyInitCapital[1];



14.




15.



if mycapital- dailyInitCapital<-lossPoint*bigpointvalue then begin



16.



if marketposition>0 then sell (



17.



if marketposition<0 then buytocover (



18.



stoptradeDaily = true;



19.



end;



20.




21.



if stopTradeDaily=false then begin



22.



{your entry code}



23.



end;



复制代码



30


一天只交易一次的语法



很多人问过我这个问题


,


就在这个园地提出我的 写法



如果其他的人有不同的语法


,< /p>


多多指教




vars:go (true);



if marketposition <> 0 then //

当有部位后


,


交易停止



go =False;


If date<>date[1] then //


当换日后


,


交易开始



go =true;


IF condition and go then //


如果买进条件成立而且可以交易就买进



buy(


回复


1#


franl in



的帖子



另一种方式也可以



if conditions and


EntriesToday(date)


=0 then begin


end;


EntriesToday


需要有输入日其当作参数



然后回传该日其的进场次数



input:TN(1)




var:tradeNum(0);


if date<>date[1] then


tradeNum=0;


if conditions and tradeNum


tradeNum=tradeNum[1]+1



buy??;



end




这样也行。如此,还能测试不同进场次数的效果



31


请问如何在图上显示字?



如果我想在走势图上写字,比如,在买进信号旁边写上“买进做多”,在平仓信号旁边写上“多 仓平仓”,但是好像


在图上写字的函数,应该如何办呢?



谢谢



if marketposition =0 and condition1 then buy(


买进作多



if marketposition =1 and condition2 then sell(


多单平仓




32setstoploss


實單計算



環境


6.0 beta2


,實單,下 單版


2.0.0.1



limit+s top


不預掛



結果

< br>setstoploss(


金額


)


金額含手續費及滑價設定值



計算進場價為


order and position tracker/strategy orders:Filled


,或者是進場根


open


價其中之一(我不確定哪


好一樣)



因為我看回測清單是的進場價


<>F illed=


進場根


open




也就是假設


filled

< br>上(或進場根


open


價)都是寫


8000


點,而手續費及滑價設定共


1000


,金額填


4000


多單停損價格

=8000-(4000-1000*2)/200=7990


經費有限只測試一次,若有朋友不同結果還請指點,謝謝



且實單測試時,若


setstoploss


價格與一般



進場



停損單指令相同或比進場停損單價格更佳時



setstop loss


不會執行,會只有做進場停損單


例如


8000


為空單進場價



setstoploss


最外層丟在


801 8


價格要執行停損



if marketposition=-1 then buy next bar at 8000+20 stop;


進場停損單(應該只有新多單,但結果不是)



實際結果是下根


k


棒價格上升到

< p>
8020


setstoploss


< p>
8018


不會執行,空單會在價格來到


8020< /p>


時停損在


8020


,然後再反向多單(也 就是停損後反多單一筆


我的


chart


圖上在


8018


也沒有出現


stopl oss


訊號,是出現


buy


訊號



這時候我們可以來測試


setstoplo ss


在模擬回測時單怎麼變化



8000


為空單進場價



setstoploss


最外層丟在


8018


價格要執行停損



if marketposition=-1 then buy next bar at 8000+20 stop;


進場停損單(新多單,結果正確)



在下根


k


棒價格上升到


802 0


,在回測的清單中可以發現



平倉


stop loss


會出現


!!stoploss8018


buy


也會出現,多單進在


8020


也就是說


chart


圖會出現


stoploss


訊號及


buy


訊號



所以在實單使用


sto ploss


要注意萬一


setstoploss


的價格有到,而


buy


的點位當天沒到




setstoploss


卻沒執行



那麼單子在當沖策略的不留 倉的平倉點判斷時,會不會正常把部位平倉呢?



我不知道,應該是會,因為


if marketpositio n=-1


底下判斷


buy


< p>


所以不留倉通常是時間到


if time=1340 then buytocover......


既然

< p>
chart


也不會出現


stoploss


訊號,那應該


mc


會當做有空單還在倉



雖然說可能


1340


時的虧損已遠大於


18


點的好幾十倍


. ......


註:可是我不曉得當


stoploss


出場價跟


buy


的進場價在同一個價位時



實單會不會,也會像我今天這樣


buy


還會進場



因為我用非實單模擬下去,


stoploss


出場價跟


buy


進場價一樣的話,圖表上是只會出現< /p>


buy


的進場訊號



我有把今日的


order and position tracker


的圖傳給客服



剛剛我覺得好像是發現問題了就是



圖上的


stop loss



stop


價位是錯的,


mc

顯示是錯的因為它圖上是以空單


filled


價去計算的話



才會等於我設定的


setstopl oss


出場價格,但是


!


< p>
回測報告空單進場價



不等於



空單


filled




也就是說假設


setstoploss


出場價格為


20




那麼



空單


f illed





8000




回測報告空單進場價




8002




order and position tracker



stoploss


會顯示


8020


(但不以這計算)



而實際上以


8002+20=8022


來設定


stoploss


出場價(雖以此計算但


ord er and position tracker


顯示的是


filled



那麼實單的一切謎團就解開了

< br>....


不妨用


Algo


模擬 交易所


試試看,就不用擔心測試停損單會賠錢了


...


33


程序代码分享


]


KD


指標牛市背離買進



kd


牛市背離買進的寫法如下



1.



vars:myK(0),myD(0);


2.



myK = fastk(20);


3.



myD = FastD(20);


4.



if countif(myK>80,5)=5 and countif(myD>80,5)=5 then


5.



buy next bar at market;


复制代码



34


]



请教各位大大,如何编写


MC


换月自动平仓的语法



本帖最后由


eric



2010-7-14 10:38


编辑



今天发现达钱中的螺纹换月了, 这样会产生有很大的跳空现象,欲解决这个问题,故请问如何根据达钱的逻辑(交易


月) 在


MC


中编写程式实现换月自动平仓的动作呢?



求指点


~


感激



不好意思我刚没说清楚,我是指每个月份合约的资料接到


qm< /p>


中,比方说螺纹


201007


、螺纹


201008


、螺纹


201009


、螺



201011


、 螺纹


201012


、螺纹


201101 ...


等资料接到


qm


然后每天在收盘 前(比方说


14



30


后)检查一下目前哪个月


大并决定是否需要转仓。




以目前


mc


的架构,做自动转仓会比较麻烦,因为必须要不断监控多个月份的合约资料


< p>
我会建议用


mc


写一个转仓的

alert


,转仓的动作还是要手动



Alert


发出时,可以人为判断一下是否需要转仓



毕竟有时候可能出现今天螺纹


20101 1


量最大,明天螺纹


201012


,后 天又


201011


量最大,



这样程式自动转仓会导致许多转仓的问题。


< br>35


[


软件使用讨论


]



如何处理隔夜仓



我们先看图片:



现在


MC


好像不能智能判断持仓



SA


模式下,关掉电脑,再登陆点击


SA


自动交易



这时候所有的信号都清空了,没法判断已有仓位



如何解决我图中的问题



36


日内交易收盘前出场的写法



以沪深


300


为例,每日

< br>14:50


分平仓的写法如下



if time>=1450 then begin


if marketposition>0 then sell next bar at market;


if marketposition<0 then buytocover next bar at market;


end;



较完善的日内交易系统框架(可处理信号反复)



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


//


简称


: s007


//


名称


:


//


类别


:


交易指令



//


类型


:


其他



//


输出


:


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


Params


Numeric maxLots(1);//


单次开仓手数



Numeric maxTrad(3);//


最大交易次数



Numeric splitRate(3); //


交易滑点和佣金




Numeric ma1(5);


Numeric ma2(18);



Numeric tradBegin(909); //


开仓时间



Numeric tradEnd(1440); //


开仓时间



Numeric closeTime(1456); //bar


的时间超过此值后平仓




Numeric stopLoss(40); //


亏损大于 于此值时止损,为


0


不判断



Numeric stopProfis(200); //


盈 利高于此值时止赢,为


0


不判断




Numeric tracProfis(0); //


盈利高于此值后执行追踪止赢,为


0


不判断



Numeric tracLoss(0); //


追踪止盈的回撤值,为


0


不判断,




Numeric returnProfis(70); //


盈利高于此值后执行回撤止赢,为


0


不判断




Numeric minProfis(10); //


持仓< /p>


bar


数超过


maxHoles


后盈利小于此值平仓,为


0


不判断



Numeric maxHolds(7);//



0


不判断



Vars


String fileName;



String fileName2;


String toDay;


Numeric splitDot; //


交易滑点




Bool b1(False);//


开多条件



Bool b2(False);//


开多条件




Bool s1(False);//


开空条件



Bool s2(False);//


开空条件




Bool bc(False);//


开多条件



Bool sc(False);//


开多条件




Numeric tradePrice(0);//


发单的价格




StringSeries tradMem(


交易描述



Numeric tradProve(0);//


可否开仓:


0/


禁止,


1/


允许



Numeric tradNum(0);//


交易次数



Numeric tradState(0);//


持仓状态:


0/


无,


1/


多,


-1/




Numeric tradCost(0);//


持仓成本



Numeric tradIdx(0);//


持仓

< p>
Bar



index


Numeric tradCyc(0);//


持仓周期



String pKey;//


String pKeyTradProve(


String pKeyTradState(


String pKeyTradCost(


String pKeyTradNum(


String pKeyTradIdx(



Numeric curProfit(0);//


持仓当前浮动盈亏



NumericSeries maxProfit(0);//


持仓最大浮盈



NumericSeries maxLoss(0);//


持仓最大浮亏




String dopos(


持仓处理代码



NumericSeries m1(0);


NumericSeries m2(0);



Begin


splitDot=splitRate*MinMove();



pKey=FormulaName()+SymbolNa me()+Text(BarType())+Text(BarInterval());

< br>pKeyTradProve=


pKeyTradState=

< br>pKeyTradCost=


pKeyTradNum=


pKeyTradIdx=



//


初始化



If(BarStatus==0)


{



SetTBProfileString(pKey,pKe yTradProve,Text(1));


SetTBProfileString (pKey,pKeyTradState,Text(0));


SetTBProf ileString(pKey,pKeyTradCost,Text(0));


S etTBProfileString(pKey,pKeyTradNum,Text(0));

< p>
SetTBProfileString(pKey,pKeyTradIdx,Text(0)) ;



tradMem=


maxProfit=0;


maxLoss=0;



Return;


}



if(Day !=Day[1])


{

SetTBProfileString(pKey,pKeyTradProve,Text(1));


SetTBProfileString(pKey,pKeyTradState,T ext(0));


SetTBProfileString(pKey,pKeyTr adCost,Text(0));


SetTBProfileString(pKe y,pKeyTradNum,Text(0));


SetTBProfileStr ing(pKey,pKeyTradIdx,Text(0));



tradMem=



maxProfit=0;


maxLoss=0;



}



Else


{


//


获取交易状态


< br>tradProve=Value(GetTBProfileString(pKey,pKeyTra dProve));


tradState=Value(GetTBProfileS tring(pKey,pKeyTradState));


tradCost=Va lue(GetTBProfileString(pKey,pKeyTradCost));


tradNum=Value(GetTBProfileString(pKey,pKeyTra dNum));


tradIdx=Value(GetTBProfileStrin g(pKey,pKeyTradIdx));



tradMem=



maxProfit=maxProfit[1];


maxLoss=maxLoss[1];



m1=iTodayEMA(Open,ma1);//


指标

< br>


m2=iTodayEMA(Open,ma2);//


指标




//


开仓条件



//


跌停板附近不开多仓,涨停附近不开空仓



if(BarStatus==2)


{


b1=Close>(Q_LowerLimit()+15*MinMove());


s1=Close<(Q_UpperLimit()-15*MinMove()) ;


}


Else


{



b1=Not(High==Low And High==Close Or High[1]==Low[1] );


s1=Not(High==Low And High==Close Or High[1]==Low[1] );


}




If(tradNum<=maxTrad And Time>=0.0001*tradBegin And Time<=0.0001*tradEnd)


{


//


开仓条件



bc=CrossOver(m1,m2) And b1 //


sc=CrossUnder(m1,m2) And b1 //



}




//


当前无仓


---------- -------------------------------------------------- -----Begin


if(tradState==0 )


{



//


当前无仓,开始建立多头



if(bc)


{


if(BarStatus==2) tradePrice= Q_AskPrice +splitDot; Else tradePrice=Open+splitDot;



If(Buy(maxLots,tradePrice))


{


SetTBProfileString(pKey,pK eyTradProve,Text(0));


SetTBProfileStrin g(pKey,pKeyTradState,Text(1));


SetTBPro fileString(pKey,pKeyTradCost,Text(tradePrice));


SetTBProfileString(pKey,pKeyTradNum,Text( 1+tradNum));


SetTBProfileString(pKey,pK eyTradIdx,Text(CurrentBar()));



tradMem=


开多


-


Co mmentary(tradMem);



}


}


Else


//


当前无仓,开始建立空头



If(sc)


{


if(BarStatus==2)tradePrice= Q_BidPrice -splitDot; Else tradePrice=Open-splitDot;



If(SellShort(maxLots,tradePrice))


{


SetTBProfileString(pKey,pK eyTradProve,Text(0));


SetTBProfileStrin g(pKey,pKeyTradState,Text(-1));


SetTBPr ofileString(pKey,pKeyTradCost,Text(tradePrice)); < /p>


SetTBProfileString(pKey,pKeyTradNum,Text (1+tradNum));


SetTBProfileString(pKey,p KeyTradIdx,Text(CurrentBar()));



tradMem=


开空


-


C ommentary(tradMem);



}


}


}


//


当前无仓


---------------------------------- -------------------------------end


// < /p>


当前有仓


------------------------- ----------------------------------------begin


Else


{


//


计算当前盈亏和最大浮动盈亏



curProfit=tradState*(Close-tradCost);



If(BarStatus==2)


{



If(curProfit>maxProfit) maxProfit=curProfit;


If(curProfit


}


Else


{


If(tradState==1)


{


If((High- tradCost)>maxProfit) maxProfit=(High-tradCost);


If((Low-tradCost)


}


If(tradState==-1)


{


If((tradCost-Low)>maxProfit) maxProfit=tradCost-Low;


If((tradCost- High)



}


}




//


平多反空



If(tradState==1 And sc And tradNum=0.0001*tradBegin And Time<=0.0001*tradEnd)


{


if(BarStatus==2)tradePrice= Q_BidPrice -splitDot; Else tradePrice=Open-splitDot;



If(SellShort(maxLots,tradePrice))


{


tradMem=


平多反空


-


SetTBProfileString(pKey,pKeyTr adProve,Text(1));


SetTBProfileString(pK ey,pKeyTradState,Text(-1));


SetTBProfil eString(pKey,pKeyTradCost,Text(tradePrice));

< p>
SetTBProfileString(pKey,pKeyTradNum,Text(1+t radNum));


SetTBProfileString(pKey,pKeyT radIdx,Text(CurrentBar()));


maxProfit=0;


maxLoss=0;



curProfit=0;


}


}


//


平空反多



If(tradState==-1 And bc And tradNum=0.0001*tradBegin And Time<=0.0001*tradEnd)


{


if(BarStatus==2) tradePrice= Q_AskPrice +splitDot; Else tradePrice=Open+splitDot;



If(Buy(maxLots,tradePrice))


{


tradMem=


平空反多


-


SetTBProfileString(pKey,pKeyTr adProve,Text(1));


SetTBProfileString(pK ey,pKeyTradState,Text(1));


SetTBProfile String(pKey,pKeyTradCost,Text(tradePrice));


SetTBProfileString(pKey,pKeyTradNum,Text(1+tr adNum));


SetTBProfileString(pKey,pKeyTr adIdx,Text(CurrentBar()));


maxProfit=0;


maxLoss=0;


curProfit=0;



}


}




tradCyc=(CurrentBar()-tradIdx);


tradMem=


浮盈


:


最大 浮盈


:


仓期:



dopos=


//


开仓


BAR


的处理



if(tradCyc==0)


{



}



//


持仓


BAR


的处理



Else


if(tradCyc>0)


{


/ /


开仓后第一根


BAR


的处理


-


应对


bar


走完后的 信号消失问题


********************************* *************



if(tradCyc==1)


{






。< /p>



}



Else



dopos=DoPos ition(tradState,tradCyc,curProfit,maxProfit,stopLo ss,stopProfis,tracProfis,tracLoss,returnProfis,min Profis,max


}



dopo s=DoPosition(tradState,tradCyc,curProfit,maxProfit ,stopLoss,stopProfis,tracProfis,tracLoss,returnPro fis,minProfis,max


//


统一的平仓处理


----------------------------------------- --------------------------------------------------


if(Len(dopos)>2)


{

//


处理交易价格,叫卖叫买价加上滑点,便于成交



if(BarStatus==2)


{


If(tradState==1) tradePrice= Q_BidPrice -splitDot;


If(tradState==-1) tradePrice= Q_AskPrice +splitDot;


}Else tradePrice=Close-tradState*splitDot;



//


平多



If(tradState==1)


{


If(Sell(maxLots,tradePrice))


{


tradMem=dopos+


平 多


-


SetTBProfileString(pKey,pK eyTradProve,Text(1));


SetTBProfileStrin g(pKey,pKeyTradState,Text(0));



maxProfit=0;


maxLoss=0;


}


}


//


平空



If(tradState==-1)


{


If(BuyToCover(maxLots,tradePrice))


{


tradMem=dopos+


平 空


-


SetTBProfileString(pKey,pK eyTradProve,Text(1));


SetTBProfileStrin g(pKey,pKeyTradState,Text(0));



maxProfit=0;


maxLoss=0;



}


}



Commentary(tradMem);



}



}



}


End



据说有


90%


胜率的交易系统



A system giving over 90% profitable trades.


[


博主注:


easy languge


语言编写,适用于


TS8



MC


等软件,使用时去掉中间中文字


]


{*********************************** *****************


The Simplest System #3 with Money Management.


Copyright (c) 2002 DT


******************************* *********************}


Input: Price((H L)*.5), {


中间价


}


PtUp(4.), PtDn(4.), {Max correction to change trend}


MM_Model(2), {1 = % Risk Model; 2 = % Volatility Model;


3 = Drawdown Model; 4 = Kelly Model; 5 = Williams' Model;


6 = Fixed Ratio Model; 7= Market Money Model}


MM(1), {% Risk parameter}


MM_add(0), {% Risk for playing market money; 0 to disactivate}


MaxVolat(100), {% Risk for playing market money; 100 to disactivate}


MaxDD(20), {% Drawdown


资金回撤率


}


InitCapital(100000); {Initial capital to trade


开始资金


}


Vars:LL(99999), HH(0), Trend(0), Volat(TrueRange);MP(0), Risk(Range), Num(1),


add_num(0), red_num(0), FRDelta(0),DD(0),Equity(InitCapital), TotalEquity(InitCapital),


EqTop(InitCapital),AssuredProfit(0), HPositionProfit(0), Kelly(0);


MP = MarketPosition;


Volat = .5 * TrueRange .5*Volat[1];


if MP <= 0 then


begin


if Price < LL then LL = Price;


if Price cross above LL*(1 PtUp*.01) then


begin


Trend = 1;


HH = Price;


end;


end;


if MP >= 0 then begin


if Price > HH then HH = Price;


if Price cross below HH*(1 - PtDn*.01) then


begin


Trend = -1;


LL = Price;


end;


end;


If trend = 1 then Risk = PtDn * .01 * close { Slippage};


If trend = -1 then Risk = PtUp * .01 * close { Slippage};


HPositionProfit = maxlist( OpenPositionProfit, HPositionProfit);


AssuredProfit = HPositionProfit - Risk;


Equity = InitCapital NetProfit;


TotalEquity = Equity OpenPositionProfit;


EqTop = MaxList(EqTop, TotalEquity);


if MM_Model = 1 then { % Risk Model }


Num = floor(MM * Equity *.01/Risk);


if MM_Model = 2 then { % Volatility Model }


Num = floor(MM * Equity *.01/ Volat / BigPointValue );


if MM_Model = 3 then begin { Drawdown Model }


Num = floor(MM * (Equity - (1 - MaxDD*.01) * EqTop) * .01 / Volat /


BigPointValue);


end;


if MM_Model = 4 then


begin { Kelly Model }


If TotalTrades > 20 and GrossProfit > 0 then


Kelly = NumWinTrades/TotalTrades * (1 - GrossLoss/GrossProfit)


else


Kelly = 0.1;


if Kelly > .9 then Kelly = .9;


Num = floor(MM * Kelly * Equity * .01 / Risk);{Print(Kelly);}


end;



if MM_Model = 5 then


begin { Larry Williams' Model }


value11 = MaxList(-LargestLosTrade / MaxList(CurrentContracts, 1) , Risk);


Num = floor(MM * Equity *.01 / value11);


end;


if MM_Model = 6 then


begin { Fixed Ratio Model }


{ DD = MaxList(DD, (EqTop - TotalEquity)/MaxList(CurrentContracts, 1)) {Max


Drawdown}


if TotalTrades > 20 and DD > 0 then FRDelta = MM * DD *.01


else }


FRDelta = MM * volat * BigPointValue * .01; {Delta}


value12 = MaxList(Equity - .5*close*(close FRDelta)/FRDelta, 0.25);


Num = floor(SquareRoot(2*value12/FRDelta .25) .5);


end;


if MM_Model = 7 then { Playing the market money }


num = floor((MM * (InitCapital MinList(NetProfit, 0)) MM_add *


MaxList(NetProfit, 0)) * .01 / Volat / BigPointValue);


{ Entries}


if trend = 1 and trend[1] <> 1 then buy(


if trend = -1 and trend[1] <> -1 then sell(


add_num = floor( MM_add * AssuredProfit * .01/ Volat / BigPointValue);


{ Assured Profit Pyramiding }


if add_num > 0 and OpenPositionProfit > Volat * BigPointValue then


begin


if Trend = 1 and MP = 1 then buy(


if Trend = -1 and MP = -1 then sell(


end;


red_num = floor((CurrentContracts * Volat * BigPointValue - MaxVolat *


TotalEquity * .01)/ close);


if red_num > 0 then


begin


if Trend = 1 and MP = 1 then exitlong(


if Trend = -1 and MP = -1 then exitshort(


end;


if Num < 1 then Num = 1;


这个系统很简单的,大概说明以下:



1



“MP = MarketPosition; ”


开始才是指令,前面为参数说明,变量定义



2 MarketPosition


表示多头空头,这是一个双 向交易系统,多头、空头规则不同



3


然后是一段趋势跟踪:



if MP <= 0 then begin


if Price < LL then LL = Price;


if Price cross above LL*(1 PtUp*.01) then begin


Trend = 1;


HH = Price;


end;

-


-


-


-


-


-


-


-



本文更新与2021-02-12 01:50,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/640324.html

Easylanguage的下单指令的相关文章