Edward Garnica placed to work or it is necessary to place it in the three symbols that you mention.
Any symbol can be used, even a symbol other than the three mentioned, as they are all defined in the code.
Works well on historical data (target profit set at 0.1$). I set the delay (ping) at the level of 60 ms.
I also tried it on real data on a demo account:
It opens and closes trades, but at a disadvantage. Probably because of the long ping time (I had about 60 ms).
I want to try via VPS.
I also tried it on real data on a demo account:
It opens and closes trades, but at a disadvantage. Probably because of the long ping time (I had about 60 ms).
I want to try via VPS.
sfhomebiz #:
Works well on historical data(target profit set at 0.1$). I set the delay (ping) at 60 ms.
The reason is this. Works well on historical data(target profit set at 0.1$). I set the delay (ping) at 60 ms.
void CloseArbitragePositions() { double totalProfit = 0; // Calcola il profitto cumulativo delle posizioni col Magic Number for(int i = 0; i < PositionsTotal(); i++) { ulong ticket = PositionGetTicket(i); if(PositionSelectByTicket(ticket)) { if(PositionGetInteger(POSITION_MAGIC) == MagicNumber) totalProfit += PositionGetDouble(POSITION_PROFIT); } } if(totalProfit >= ProfitTarget) { Print("Profit target raggiunto: ", totalProfit, ". Procedo alla chiusura delle posizioni."); // Chiude le posizioni iterando all'indietro per sicurezza for(int i = PositionsTotal() - 1; i >= 0; i--) { ulong ticket = PositionGetTicket(i); if(PositionSelectByTicket(ticket)) { if(PositionGetInteger(POSITION_MAGIC) == MagicNumber) { string sym = PositionGetString(POSITION_SYMBOL); if(!trade.PositionClose(sym)) Print("Errore nella chiusura della posizione su ", sym, " - ", GetLastError()); else Print("Posizione su ", sym, " chiusa con successo."); } } } } }
// This is more powerfull, higher trashold usable int CheckArbitrageOpportunity(double &diff, double &impliedPrice, double &directPrice)
{ double price1 = SymbolInfoDouble(symbol1, SYMBOL_BID); double price2 = SymbolInfoDouble(symbol2, SYMBOL_BID); directPrice = SymbolInfoDouble(symbol3, SYMBOL_ASK); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff > Threshold) return 1; price1 = SymbolInfoDouble(symbol1, SYMBOL_ASK); price2 = SymbolInfoDouble(symbol2, SYMBOL_ASK); directPrice = SymbolInfoDouble(symbol3, SYMBOL_BID); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff < -Threshold) return -1; return 0;
}
michal_ #:
// This is more powerfull, higher trashold usable int CheckArbitrageOpportunity(double &diff, double &impliedPrice, double &directPrice) { double price1 = SymbolInfoDouble(symbol1, SYMBOL_BID); double price2 = SymbolInfoDouble(symbol2, SYMBOL_BID); directPrice = SymbolInfoDouble(symbol3, SYMBOL_ASK); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff > Threshold) return 1; price1 = SymbolInfoDouble(symbol1, SYMBOL_ASK); price2 = SymbolInfoDouble(symbol2, SYMBOL_ASK); directPrice = SymbolInfoDouble(symbol3, SYMBOL_BID); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff < -Threshold) return -1; return 0; }
Why do have you decided to use the bid of the first two symbols to calculate the ask of the directprice and viceversa ..?
// This is more powerfull, higher trashold usable int CheckArbitrageOpportunity(double &diff, double &impliedPrice, double &directPrice) { double price1 = SymbolInfoDouble(symbol1, SYMBOL_BID); double price2 = SymbolInfoDouble(symbol2, SYMBOL_BID); directPrice = SymbolInfoDouble(symbol3, SYMBOL_ASK); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff > Threshold) return 1; price1 = SymbolInfoDouble(symbol1, SYMBOL_ASK); price2 = SymbolInfoDouble(symbol2, SYMBOL_ASK); directPrice = SymbolInfoDouble(symbol3, SYMBOL_BID); impliedPrice = price1 * price2; diff = (impliedPrice - directPrice) / directPrice; if(diff < -Threshold) return -1; return 0; }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Triangular Arbitrage:
This Expert Advisor (EA) implements a triangular arbitrage strategy between three currency pairs: EURUSD, USDJPY and EURJPY
Author: Джованни Орсани