论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:1928回复:3
hilow
注册时间2004-09-25
MT人工智能之一(AIP)
楼主发表于:2004-09-26 18:25只看该作者倒序浏览
1楼 电梯直达
电梯直达
Metatrader expert advice ----测试结果惊人 /*[[ ALWAYS IN PLAY Lots := 1.00 Notes := Best if use in H1 or higher timeframe Update on every tick := Yes Enable Alerts := Yes Disable alert once hit := No Lots := 1 Stop Loss := 999 Take Profit := 25 Trailing Stop := 999 ]]*/ // ========================================================= // DECLARATION defines: risk(25),mm(1)&#59; vars: spread(0), Slippage(5), sl(0),tp(0),maxSimOpen(0), mode(0), buffer(0), lastHigh(0), target(0), entryTS(0), lastLow(0), cnt(0), first(0), lotMM(0), tHour(0)&#59; cnt= 1&#59; // ========================================================= // VALIDATION If CurTime - LastTradeTime < 300 Then Exit&#59; If Bars<100 or TakeProfit<10 then Exit&#59; If IsIndirect(Symbol)=TRUE then Exit&#59; // ========================================================= // DATE CHOKE - For testing purposes If TimeYear(time[0]) < 2004 then { Exit&#59; } else if TimeMonth(time[0]) < 2 then { Exit&#59; }&#59; // ========================================================= // PYRAMIDING - LINEAR // // Money management risk exposure compounding if mm<>0 then { lotMM=Ceil(Balance*risk/10000)/10&#59; if lotMM < 0.1 then { lotMM = lots&#59; }&#59; If lotMM > 1 then { lotMM = Ceil(lotMM)&#59; }&#59; If lotMM > 100 then { lotMM = 100&#59; }&#59; } else { lotMM=Lots&#59; }&#59; // Adding simultaneously opened position if mm = 1 then { If balance < 1000000 then maxSimOpen=1&#59; If balance > 1000000 then { maxSimOpen=(Balance*risk/10000)/1000&#59; } else { maxSimOpen=1&#59; } }&#59; if mm = 2 then { if balance < 1000000 then maxSimOpen=1&#59; if balance > 1000000 then { maxSimOpen=(Balance*risk/10000)/1000&#59; if maxSimOpen > 20 then maxSimOpen=20&#59; } else { maxSimOpen=1&#59; }&#59; }&#59; entryTS = 10*Point&#59; //Entry trailing stop - points buffer = 1.0*Point&#59; //Filter/buffer above or below bar High/Low - points target = TakeProfit*Point&#59; //Profit target - points lastHigh = High[1]&#59; //Last bar high lastLow = Low[1]&#59; //Last bar low spread = Bid-Ask&#59; //Spread // ========================================================= // TRADE ENTRY tHour = GetGlobalVariable("tHour")&#59; If TotalTrades<maxSimOpen Then { //SHORT TRADES ENTRY CRITERIA If Open[1]>Close[1] and //Last bar bearish, open greater than close&#59; Ask-lastLow<10*Point and //if Bid rises or falls to within 10pips of Low [1] bar ago, allow order to set&#59; iSAR(0.05,0.5,0)>Bid and tHour != TimeHour(time[0]) then { SetGlobalVariable("tHour",TimeMinute(time[0]))&#59; // Set stoploss to last bar high + spread sl = lastHigh+spread&#59; //place order to sell m-s equals Low[1]-1pip&#59; //Sell on stop, 1 lot,at:Low[1]-1pip,slip0,Target:Low[1]-1pip-25pip&#59; SetOrder(OP_SELLSTOP, lotMM, lastLow-buffer-spread, Slippage, sl, lastLow-buffer-spread-target, RED)&#59; Exit&#59; }&#59; //LONG TRADES ENTRY CRITERIA If Open[1]<Close[1] and //Last bar bullish, Open less than Close&#59; lastHigh-Bid<10*Point and //if Bid rises or falls to within 10pips of High[1] bar ago, allow order to set&#59; iSAR(0.05,0.5,0)<Bid and tHour != TimeHour(time[0]) then { SetGlobalVariable("tHour",TimeMinute(time[0]))&#59; sl = lastLow+spread&#59; SetOrder(OP_BUYSTOP, lotMM, lastHigh+buffer+spread, Slippage, sl, lastHigh+buffer+spread+target, LIME)&#59; Exit&#59; }&#59; }&#59; // ========================================================= // TRAILING STOP ADJUSTMENT If TrailingStop<5 then {print("invalid Trailing Stop")&#59;Exit&#59;}&#59; For cnt=1 to TotalTrades { mode=OrderValue(cnt,VAL_TYPE)&#59; If mode=OP_BUY then { //if Bid-open price is now higher than 10pips profit.... If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(entryTS) then { //and the value of the stop loss order is lower than 10pips below the Bid... If OrderValue(cnt,VAL_STOPLOSS)<(Bid-entryTS) then { //then adjust the stop loss part of the order to the Bid - 10pips ModifyOrder(OrderValue(cnt,VAL_TICKET), OrderValue(cnt,VAL_OPENPRICE), Bid-entryTS, OrderValue(cnt,VAL_TAKEPROFIT), BLUE)&#59; Exit&#59; }&#59; }&#59; If OrderValue(cnt,VAL_STOPLOSS)>=OrderValue(cnt,VAL_OPENPRICE) then { ModifyOrder(OrderValue(cnt,VAL_TICKET), OrderValue(cnt,VAL_OPENPRICE), OrderValue(cnt,VAL_STOPLOSS), Ask+TakeProfit*Point, BLUE)&#59; Exit&#59; }&#59; }&#59; If mode=OP_SELL then { //if current Ask price dropped 10 pips or more below the open price If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(entryTS) then { //and the stop loss order is greater than 10pips above the current Ask.. If OrderValue(cnt,VAL_STOPLOSS)>(Ask+entryTS) then { //then adjust the stop loss part of the order to Ask+10pips ModifyOrder(OrderValue(cnt,VAL_TICKET), OrderValue(cnt,VAL_OPENPRICE), Ask+entryTS, OrderValue(cnt,VAL_TAKEPROFIT), BLUE)&#59; Exit&#59; }&#59; }&#59; If OrderValue(cnt,VAL_STOPLOSS)<=OrderValue(cnt,VAL_OPENPRICE) then { ModifyOrder(OrderValue(cnt,VAL_TICKET), OrderValue(cnt,VAL_OPENPRICE), OrderValue(cnt,VAL_STOPLOSS), Bid-TakeProfit*Point, BLUE)&#59; Exit&#59; }&#59; // ========================================================= // CLEANING PENDING TRADES // check how long it exists in the trading terminal - time is counted in seconds // if the current time ignoring hours is greater than 58minutes cancel the open order(allowing new one to place). If mode>OP_SELLSTOP then { If Minute>58 then { DeleteOrder(OrderValue(cnt,VAL_TICKET),INDIGO)&#59; Exit&#59; }&#59; }&#59; If mode>OP_BUYSTOP then { If Minute>58 then { DeleteOrder(OrderValue(cnt,VAL_TICKET),INDIGO)&#59; Exit&#59; }&#59; }&#59; }&#59; }&#59; Exit&#59; [此帖子已被 hilow 在 2004-9-27 2:44:47 编辑过]
TK29帖子1楼右侧xm竖版广告90-240
个性签名

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
jxq168
注册时间2004-07-28
北客
注册时间2005-01-26
发表于:2005-02-01 08:28只看该作者
3楼
有 &#59 是什么呀?
个性签名

无主宰!
非自然!

stock
注册时间2004-12-12

本站免责声明:

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

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

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

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

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

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