당사 팬 페이지에 가입하십시오
- 게시자:
- Vladimir Karputov
- 조회수:
- 5553
- 평가:
- 게시됨:
- 2017.03.02 10:01
-
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
Author of the idea — Ahmad Waddah Attar, author of thr MQL5 code — barabashkakvn.
The Expert Advisor trades using pending Buy Limit (BuyLimit) and Sell Limit (SellLimit) orders. Once the price moves very close to the pending order:
m_trade.BuyLimit(LastBuyLimitLot+IncLot,m_symbol.NormalizePrice(LastBuyLimitPrice-ExtStep));
if((LastSellLimitPrice-m_symbol.Bid())<=5*m_symbol.Point()) // FirstLot очень близко
m_trade.SellLimit(LastBuyLimitLot+IncLot,m_symbol.NormalizePrice(LastSellLimitPrice+ExtStep));
Place one more pending order.
To get the last price of the placed order we use OnTradeTransaction():
//| TradeTransaction function |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &trans,
const MqlTradeRequest &request,
const MqlTradeResult &result)
{
//--- Get the trade type as a value of the enumeration
ENUM_TRADE_TRANSACTION_TYPE type=trans.type;
Print(EnumToString(type));
//--- if a deal — the result of deal adding to history
if(type==TRADE_TRANSACTION_ORDER_ADD)
{
long order_type =0;
double order_price =0.0;
double order_volume =0.0;
string order_symbol ="";
long order_magic =0;
if(OrderSelect(trans.order)) // Select pending orders
{
order_type=OrderGetInteger(ORDER_TYPE);
order_price=OrderGetDouble(ORDER_PRICE_OPEN);
order_volume=OrderGetDouble(ORDER_VOLUME_INITIAL);
order_symbol=OrderGetString(ORDER_SYMBOL);
order_magic=OrderGetInteger(ORDER_MAGIC);
}
else
return;
if(order_symbol==m_symbol.Name() && order_magic==m_magic)
{
if(order_type==ORDER_TYPE_BUY_LIMIT)
{
LastBuyLimitPrice=order_price;
LastBuyLimitLot=order_volume;
}
if(order_type==ORDER_TYPE_SELL_LIMIT)
{
LastSellLimitPrice=order_price;
LastSellLimitlLot=order_volume;
}
}
}
}
Testing on EURUSD, M15 from 2015.06.07 to 2016.12.31 — "Every tick" mode, initial deposit 10000:
MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/17339
![e-TurboFx](https://c.mql5.com/i/code/expert.png)
Analysis of bars, if they contain N consecutive bars of the same type.
![MA Reverse](https://c.mql5.com/i/code/expert.png)
Trading by Moving Average. Checking for sufficiency of funds.
![up3x1_premium_v2M](https://c.mql5.com/i/code/expert.png)
Two iMAs on the current period and one on PERIOD_D1.
![Bull vs Medved](https://c.mql5.com/i/code/expert.png)
The Expert Advisor makes trading decisions based on simple candlestick combinations. It is designed for use on the H4 period.