Latency Arbitrage Pro
- 专家
- Thomas Bradley Butler
- 版本: 2.30
- 更新: 15 十一月 2023
- 激活: 5
THIS WILL WORK IN VOLITALILE MARKETS, NOT IN LULLS. YOU MUST FIND THE VALUES YOURSELF; I DO NOT PROVIDE THIS AS ITS IMPOSSBLE. ARB IS REAL TIME
Try the full version here: https://www.mql5.com/en/market/product/103005
Does not work in backtest as it is meant for 2 pairs. Latency Arb Pro aims to find and capitalize on arbitrage opportunities between two specified currency pairs, "EURUSD" and "GBPUSD." The idea behind arbitrage trading is to take advantage of temporary price differences between these two correlated currency pairs to make a profit. Use at your own risk.
Here's how the EA works:
-
Input Parameters:
- Before running the EA, you can customize some settings to suit your preferences:
- CurrencyPair1 and CurrencyPair2: These are the two currency pairs that the EA will monitor for arbitrage opportunities. By default, it looks at "EURUSD" and "GBPUSD," but you can change them as needed.
- ArbitrageThreshold: This is the minimum price difference required to trigger an arbitrage trade. If the price difference between "EURUSD" bid and "GBPUSD" ask is greater than this threshold, the EA detects an arbitrage opportunity.
- Before running the EA, you can customize some settings to suit your preferences:
-
Initialization (OnInit function):
- During the initialization phase, the EA subscribes to the price feeds of the specified currency pairs using the SymbolSelect function. This allows it to receive real-time bid and ask prices for "EURUSD" and "GBPUSD."
- The OnInit function is executed when you load the EA onto a chart.
-
Arbitrage Opportunity Check (OnTick function):
- The OnTick function is the core of the EA, and it runs whenever there's a new tick (price update) received from the broker for any symbol on the chart.
- Inside this function, the current bid and ask prices for "EURUSD" and "GBPUSD" are obtained using the SymbolInfoDouble function.
- The price difference between "EURUSD" bid and "GBPUSD" ask is calculated, and the EA checks if this difference exceeds the specified ArbitrageThreshold to determine if there's an arbitrage opportunity.
-
Lot Size Calculation:
- To execute the arbitrage trade, the EA calculates the lot size based on either the available margin or specific risk management rules that you can define.
- The NormalizeLotSize function calculates the optimal lot size by considering the free margin, tick value, and tick size of "EURUSD."
- The calculated lot size is then normalized to ensure it aligns with the lot step, minimum lot, and maximum lot allowed by the broker.
-
Arbitrage Trade Execution (OrderSend function):
- When an arbitrage opportunity is detected (price difference > ArbitrageThreshold), the EA initiates two trades simultaneously:
- It sells "EURUSD" using the OrderSend function with the OP_SELL operation.
- It buys "GBPUSD" using the OrderSend function with the OP_BUY operation.
- The EA checks if the trade orders are executed successfully and handles any possible errors or requote situations.
- When an arbitrage opportunity is detected (price difference > ArbitrageThreshold), the EA initiates two trades simultaneously:
-
Requote Handling:
- If the OrderSend function encounters a requote error (Error 138), the EA takes appropriate action to avoid missing the arbitrage opportunity.
- Requote handling is achieved by fetching the updated ask or bid price using SymbolInfoDouble and resending the order with the new price.