论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1848回复:12
chj0525
注册时间2003-06-26
6大币种1990年至2004年的测试图(改正版)
楼主发表于:2004-05-11 00:57只看该作者倒序浏览
1楼 电梯直达
电梯直达
a.每次操作量为1手(1:100) b.根据选汇条件及进场价位setorder(). c.止损100 point、止赢150 point,不采取跟踪止损。 d.当日获利小于150 point或亏损小于100 point时,次日开盘价必须closeorder()! http://chenhj.sosoo.net/eurusd1990-2004.htm http://chenhj.sosoo.net/gbpusd1990-2004.htm http://chenhj.sosoo.net/audusd1990-2004.htm http://chenhj.sosoo.net/usdchf1990-2004.htm http://chenhj.sosoo.net/usdjpy1990-2004.htm http://chenhj.sosoo.net/usdcad1990-2004.htm [ 此消息由 chj0525 在 2004-05-11.09:31:31 编辑过 ]
TK29帖子1楼右侧xm竖版广告90-240
个性签名

概率游戏的法则就是见好就收,别玩什么理论。

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
zcz1955
注册时间2004-03-25
发表于:2004-05-11 09:29只看该作者
9楼
靠我越来越佩服你了,我编了一个只能做usd/jpy时略有赢利做其他币种时都亏损【动作】zcz1955无奈地耸了耸肩。
个性签名

韬客外汇论坛TALKFOREX.COM

广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
chj0525
注册时间2003-06-26
楼主发表于:2004-05-11 11:55只看该作者
3楼
事实证明外汇市场要比我国股市规范多了,一种有效的方法应该有效于全部外汇市场,我测试的其它交叉盘同样也有效. 你不是开玩笑吧,usd/jpy略有赢利做其他币种时都亏损,唯一的可能是你摸透了usd/jpy的脾性!jpy是最难凌驾的货币,有点类似我国股市,哎.....,东亞人都差不多!
zcz1955
注册时间2004-03-25
发表于:2004-05-12 10:06只看该作者
10楼
我公布给大家看吧反正我也不会真抄汇 Name := zcz1955 Author := Copyright ?2002, MetaQuotes Software Corp Link :=http://www.metaquotes.ru Notes := Lots := 1 Stop Loss := 0 Take Profit := 80 Trailing Stop := 30 ]]*/ defines: Slippage(2),MAFastPeriod(16),MASlowPeriod(60); var: cnt(0),mode(0); var: FastMa(0),FastMa2(0),FastMa5(0); var: SlowMa(0),SlowMa2(0),SlowMa5(0); If Bars<;200 or TakeProfit<;10 or TrailingStop<;10 then Exit; // setup values FastMa=iMA(MAFastPeriod,MODE_EMA,0); FastMa2=iMA(MAFastPeriod,MODE_EMA,2); FastMa5=iMA(MAFastPeriod,MODE_EMA,5); SlowMa=iMA(MASlowPeriod,MODE_EMA,0); SlowMa2=iMA(MASlowPeriod,MODE_EMA,2); SlowMa5=iMA(MASlowPeriod,MODE_EMA,5); // if there are no open positions and orders If TotalTrades<;1 then { If FreeMargin<;1000 then Exit;// not enough money // there are no open positions - check the BUY option // the opening condition: // if EMA(16) crosses EMA(60) upwards // and the current bar is bullish (Close>;Open), we place // waiting order BUY LIMIT 15 pips below the execution // price for more optimal entering into the market // If FastMa>;SlowMa and FastMa2<;SlowMa2 and FastMa5<;SlowMa5 and Close>;Open then If (FastMa-SlowMa)>;=Point and (SlowMa2-FastMa2)>;=Point and (SlowMa5-FastMa5)>;=Point and Close>;Open then { // try to place a waiting order at the (Ask-15) points price // with maximum slippage 2 points, // while not settingStop Loss and setting Take Profit // 40 points above the opening price. // at the chart an upward green arrow appears SetOrder(OP_BUYLIMIT,Lots,Ask-15*Point,Slippage,0,Ask+(TakeProfit-10)*Point,RED); Exit; // now we exit as we are not allowed to operate the account in the nearest 10 sec }; // the opening SELL condition: // if EMA(16) crosses EMA(60) downwards // and the current bar is bearish (Close<;Open), than we place // a waiting order SELL LIMIT 15 points above // the execution price for more optimal entering the market If (SlowMa-FastMa)>;=Point and (FastMa2-SlowMa2)>;=Point and (FastMa5-SlowMa5)>;=Point and Close<;Open then { // try to place 1 lot order at Bid+15 points price // with 2 points maximum slippage, // when not settingStop Loss and settingTake Profit // 40 points below opening price. // on the chart the downward red arrow will appear SetOrder(OP_SELLLIMIT,Lots,Bid+15*Point,Slippage,0,Bid-(TakeProfit-10)*Point,RED); Exit; }; // all we need to check in the empty terminal // we have checked already, now we exit Exit; }; // here is the code of checking of the positions opened earlier // (the placed orders will be checked // in the other block, now we check the already opened positions) for cnt=1 to TotalTrades { mode=Ordervalue(cnt,VAL_TYPE); If mode=OP_BUY then // if the already opened position were BUY { // lets check if EMA(16) has crossed EMA(60) downwards? If iMA(MAFastPeriod,MODE_EMA,0) <; iMA(MASlowPeriod,MODE_EMA,0) and iMA(MAFastPeriod,MODE_EMA,2) >; iMA(MASlowPeriod,MODE_EMA,2) and iMA(MAFastPeriod,MODE_EMA,5) >; iMA(MASlowPeriod,MODE_EMA,5) then { // try to close the position at current Bid price CloseOrder(Ordervalue(cnt,VAL_TICKET),Ordervalue(cnt,VAL_LOTS),Bid,Slippage,RED); Exit; }; // Here we check the trailing stop at open position. // Trailing stop ( Stop Loss) of the BUY position is being // kept at level 20 points below the market. // If the profit (current Bid-OpenPrice) more than TrailingStop (20) pips If (Bid-Ordervalue(cnt,VAL_OPENPRICE))>;(TrailingStop*Point) then { // we have won already not less than 'TrailingStop' pips! If Ordervalue(cnt,VAL_STOPLOSS)<;(Bid-TrailingStop*Point) then { // move the trailing stop (Stop Loss) to the level 'TrailingStop' from the market ModifyOrder(Ordervalue(cnt,VAL_TICKET),Ordervalue(cnt,VAL_OPENPRICE), Bid-Point*TrailingStop,Ordervalue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; If mode=OP_SELL then // if the already opened position were SELL { // check if EMA(16) has crossed already EMA(60) upwards? If iMA(MAFastPeriod,MODE_EMA,0) >; iMA(MASlowPeriod,MODE_EMA,0) and iMA(MAFastPeriod,MODE_EMA,2) <; iMA(MASlowPeriod,MODE_EMA,2) and iMA(MAFastPeriod,MODE_EMA,5) <; iMA(MASlowPeriod,MODE_EMA,5) then { // try to close the position at current Ask price CloseOrder(Ordervalue(cnt,VAL_TICKET),Ordervalue(cnt,VAL_LOTS),Ask,Slippage,RED); Exit; }; // Here we check the trailing stop at open position. // Trailing stop ( Stop Loss) of the BUY position is being // kept at level 20 points below the market. // If the profit (current Bid-OpenPrice) more than TrailingStop (20) pips If (Ordervalue(cnt,VAL_OPENPRICE)-Ask)>;(TrailingStop*Point) then { // we have won already not less than 'TrailingStop' pips! If Ordervalue(cnt,VAL_STOPLOSS)>;(Ask+TrailingStop*Point) or Ordervalue(cnt,VAL_STOPLOSS)=0 then { // move the trailing stop (Stop Loss) to the level 'TrailingStop' from the market ModifyOrder(Ordervalue(cnt,VAL_TICKET),Ordervalue(cnt,VAL_OPENPRICE), Ask+Point*TrailingStop,Ordervalue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; // there is one very important point - the control // over the waiting orders.An order cannot be valid more than 0.5 hour. // After which It should be canceled // For that purpose we compare current time // and time the order is placed If mode>;OP_SELL then// this is a waiting order! { // check how long it exists in the trading terminal // time is counted in seconds: // 10 minutes = 600 seconds, 30 minutes = 1800, 1 hour = 3600, 1 day = 86400 If (CurTime-Ordervalue(cnt,VAL_OPENTIME))>;1800 then { DeleteOrder(Ordervalue(cnt,VAL_TICKET),RED); Exit; }; }; }; // the end
zcz1955
注册时间2004-03-25
发表于:2004-05-12 10:12只看该作者
4楼
另外我想问问象在setorder中设立了止损后又在程序开头stoploss中设置止损,以哪个为准呢
chj0525
注册时间2003-06-26
楼主发表于:2004-05-12 11:34只看该作者
12楼
以setorder()为准!一般setorder()中的止损、止赢参数单位都是以具体价位price(比如1.1683等)值为准,而程序开头stop loss,Take Profit则是以points点作为单位,需要换算,你的程序不是已在换算了吗? 根据你提的问题,可能你还没彻底摸透你自己上面的代码,再仔细看一下!我有空也帮你瞧一瞧,这几天忙于公司系统打补丁,“震荡波”太厉害了,今天又出现了F变种! [ 此消息由 chj0525 在 2004-05-12.19:37:13 编辑过 ]
个性签名

概率游戏的法则就是见好就收,别玩什么理论。

alan_txy
注册时间2004-03-22
发表于:2004-05-13 03:57只看该作者
8楼
有个问题,就是max drawdown,必须注意的是它所标注的亏损比例是按照你从最高点(即开始最大亏损的地方)开始计算,所以以你的欧元为例,最大亏损2020,亏损比例为3.8%,但是如果你从3000圆的本金刚好从那个位置开始交易,那么实际的亏损就是2020/3000,大约65%,这一点很重要,因为你不能保证你开始交易的地方就是资金曲线的最低点。
rex
注册时间2001-08-07
发表于:2004-05-13 04:03只看该作者
5楼
我把zcz1955兄的代码拷到我的机器上测试,怎么没有结果呀。一次成交也没有,报告栏也是空的。
个性签名

天下熙熙,皆为利来;天下攘攘,皆为利往。

alan_txy
注册时间2004-03-22
发表于:2004-05-13 04:09只看该作者
6楼
你的交易系统全面性较好,我的只有欧元盈利很好,其余的都一般(chf 150%, JPY 90%gbp 60%),我的环境是,小时图,每次只作1 lot,不平仓就不作新单,时间是从2003年2月到今年5月初.我修改后的测试,欧元最大亏损在1500美金。
zcz1955
注册时间2004-03-25
发表于:2004-05-13 10:07只看该作者
7楼
原文由 SAXO 发表: 我把zcz1955兄的代码拷到我的机器上测试,怎么没有结果呀。一次成交也没有,报告栏也是空的。
有啊你再试试 /*[[  ; ; ; Name := zcz1955  ; ; ; Author := Copyright ?2004, MetaQuotes Software Corp.  ; ; ; Link := http://www.metaquotes.net/  ; ; ; Lots := 1.00  ; ; ; Stop Loss := 0  ; ; ; Take Profit := 80  ; ; ; Trailing Stop := 30 ]]*/ defines: Slippage(2),MAFastPeriod(16),MASlowPeriod(60); var: cnt(0),mode(0); var: FastMa(0),FastMa2(0),FastMa5(0); var: SlowMa(0),SlowMa2(0),SlowMa5(0); If Bars<;200 or TakeProfit<;10 or TrailingStop<;10 then Exit; // setup values FastMa=iMA(MAFastPeriod,MODE_EMA,0); FastMa2=iMA(MAFastPeriod,MODE_EMA,2); FastMa5=iMA(MAFastPeriod,MODE_EMA,5); SlowMa=iMA(MASlowPeriod,MODE_EMA,0); SlowMa2=iMA(MASlowPeriod,MODE_EMA,2); SlowMa5=iMA(MASlowPeriod,MODE_EMA,5); // if there are no open positions and orders If TotalTrades<;1 then { If FreeMargin<;1000 then Exit;// not enough money // there are no open positions - check the BUY option // the opening condition: // if EMA(16) crosses EMA(60) upwards // and the current bar is bullish (Close>;Open), we place // waiting order BUY LIMIT 15 pips below the execution // price for more optimal entering into the market // If FastMa>;SlowMa and FastMa2<;SlowMa2 and FastMa5<;SlowMa5 and Close>;Open then If (FastMa-SlowMa)>;=Point and (SlowMa2-FastMa2)>;=Point and (SlowMa5-FastMa5)>;=Point and Close>;Open then { // try to place a waiting order at the (Ask-15) points price // with maximum slippage 2 points, // while not settingStop Loss and setting Take Profit // 40 points above the opening price. // at the chart an upward green arrow appears SetOrder(OP_BUYLIMIT,Lots,Ask-15*Point,Slippage,0,Ask+(TakeProfit-10)*Point,RED); Exit; // now we exit as we are not allowed to operate the account in the nearest 10 sec }; // the opening SELL condition: // if EMA(16) crosses EMA(60) downwards // and the current bar is bearish (Close<;Open), than we place // a waiting order SELL LIMIT 15 points above // the execution price for more optimal entering the market If (SlowMa-FastMa)>;=Point and (FastMa2-SlowMa2)>;=Point and (FastMa5-SlowMa5)>;=Point and Close<;Open then { // try to place 1 lot order at Bid+15 points price // with 2 points maximum slippage, // when not settingStop Loss and settingTake Profit // 40 points below opening price. // on the chart the downward red arrow will appear SetOrder(OP_SELLLIMIT,Lots,Bid+15*Point,Slippage,0,Bid-(TakeProfit-10)*Point,RED); Exit; }; // all we need to check in the empty terminal // we have checked already, now we exit Exit; }; // here is the code of checking of the positions opened earlier // (the placed orders will be checked // in the other block, now we check the already opened positions) for cnt=1 to TotalTrades { mode=Ordervalue(cnt,VAL_TYPE); If mode=OP_BUY then // if the already opened position were BUY { // lets check if EMA(16) has crossed EMA(60) downwards? If iMA(MAFastPeriod,MODE_EMA,0) <; iMA(MASlowPeriod,MODE_EMA,0) and iMA(MAFastPeriod,MODE_EMA,2) >; iMA(MASlowPeriod,MODE_EMA,2) and iMA(MAFastPeriod,MODE_EMA,5) >; iMA(MASlowPeriod,MODE_EMA,5) then { // try to close the position at current Bid price CloseOrder(Ordervalue(cnt,VAL_TICKET),Ordervalue(cnt,VAL_LOTS),Bid,Slippage,RED); Exit; }; // Here we check the trailing stop at open position. // Trailing stop ( Stop Loss) of the BUY position is being // kept at level 20 points below the market. // If the profit (current Bid-OpenPrice) more than TrailingStop (20) pips If (Bid-Ordervalue(cnt,VAL_OPENPRICE))>;(TrailingStop*Point) then { // we have won already not less than 'TrailingStop' pips! If Ordervalue(cnt,VAL_STOPLOSS)<;(Bid-TrailingStop*Point) then { // move the trailing stop (Stop Loss) to the level 'TrailingStop' from the market ModifyOrder(Ordervalue(cnt,VAL_TICKET),Ordervalue(cnt,VAL_OPENPRICE), Bid-Point*TrailingStop,Ordervalue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; If mode=OP_SELL then // if the already opened position were SELL { // check if EMA(16) has crossed already EMA(60) upwards? If iMA(MAFastPeriod,MODE_EMA,0) >; iMA(MASlowPeriod,MODE_EMA,0) and iMA(MAFastPeriod,MODE_EMA,2) <; iMA(MASlowPeriod,MODE_EMA,2) and iMA(MAFastPeriod,MODE_EMA,5) <; iMA(MASlowPeriod,MODE_EMA,5) then { // try to close the position at current Ask price CloseOrder(Ordervalue(cnt,VAL_TICKET),Ordervalue(cnt,VAL_LOTS),Ask,Slippage,RED); Exit; }; // Here we check the trailing stop at open position. // Trailing stop ( Stop Loss) of the BUY position is being // kept at level 20 points below the market. // If the profit (current Bid-OpenPrice) more than TrailingStop (20) pips If (Ordervalue(cnt,VAL_OPENPRICE)-Ask)>;(TrailingStop*Point) then { // we have won already not less than 'TrailingStop' pips! If Ordervalue(cnt,VAL_STOPLOSS)>;(Ask+TrailingStop*Point) or Ordervalue(cnt,VAL_STOPLOSS)=0 then { // move the trailing stop (Stop Loss) to the level 'TrailingStop' from the market ModifyOrder(Ordervalue(cnt,VAL_TICKET),Ordervalue(cnt,VAL_OPENPRICE), Ask+Point*TrailingStop,Ordervalue(cnt,VAL_TAKEPROFIT),Red); Exit; }; }; }; // there is one very important point - the control // over the waiting orders.An order cannot be valid more than 0.5 hour. // After which It should be canceled // For that purpose we compare current time // and time the order is placed If mode>;OP_SELL then// this is a waiting order! { // check how long it exists in the trading terminal // time is counted in seconds: // 10 minutes = 600 seconds, 30 minutes = 1800, 1 hour = 3600, 1 day = 86400 If (CurTime-Ordervalue(cnt,VAL_OPENTIME))>;1800 then { DeleteOrder(Ordervalue(cnt,VAL_TICKET),RED); Exit; }; }; }; // the end
zcz1955
注册时间2004-03-25
发表于:2004-05-13 10:10只看该作者
2楼
原文由 alan_txy 发表: 你的交易系统全面性较好,我的只有欧元盈利很好,其余的都一般(chf 150%, JPY 90%gbp 60%),我的环境是,小时图,每次只作1 lot,不平仓就不作新单,时间是从2003年2月到今年5月初.我修改后的测试,欧元最大亏损......
那么高的赢利不错了,贴出来大家学习学习啊这也没什么好藏的啊
zcz1955
注册时间2004-03-25
发表于:2004-05-13 10:17只看该作者
11楼
谁能给我个编的复杂点的啊最好是macd加布林线再你看着加点东西做gbp/usd赢利就行了,要不这回我的毕业论文死翘翘了哎,都怪自己忙于找工作都没塌塌时时学哎
个性签名

韬客外汇论坛TALKFOREX.COM

广告
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
rex
注册时间2001-08-07
发表于:2004-05-13 14:09只看该作者
13楼
现在可以了,肯定是“]]*/”的问题,谢谢zcz1955兄。我现在也是有思路,编不成语言测试。
个性签名

天下熙熙,皆为利来;天下攘攘,皆为利往。

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]