Discussing the article: "Forex arbitrage trading: A simple synthetic market maker bot to get started"
Interesting approach. Started as is without optimisation. It keeps the balance, there is an increase in small steps.
If you want, you can move the closing of the grid to the end of the day, before the formation of swap. At present, the grid is closed at the start of trading. Or not to use daily closing at all.
There is definitely room for development and application in complex solutions.
Go on!
The article popped up in the English translation, and I wondered what I had missed in the Russian original in March.
It turned out to be fabulous rubbish. ;-)
“When adding exposure after the initial entry, do you always scale the entire three-pair triangle symmetrically, or do you ever add positions only on the specific pair that shows the largest imbalance?”
Could this work on a Real Account? or is one of the Bots that only works on Demo Accounts?
Stanislav, I am asking without jerking and teasing - where is this fairy-tale nonsense located? Honestly, I would like to go into it and fully understand what is wrong in this article!
With respect, Vladimir.
Stanislav, I am asking without jerking around and teasing - where is this fabulous nonsense located? Honestly, I would like to go into it and fully understand what is wrong in this article!
Let's start with the fact that MT5 supports accounts with netting and hedging accounting on equal rights. The proposed system is strictly for hedging, but there is no mention of that. On netting, counter positions from counter orders quickly start to collapse into a loss.
Secondly, the idea to capture a short-term successful difference of quotes on crosses is not new (you can start, for example, with the works of hrenfx or getch - they, although for MT4, but the essence does not change and give a good idea of the market picture in dynamics). It is senseless to do it with the help of pending orders opened without online control of the momentary synthetic spread. Such orders immediately start with a minus in the amount of the sum of spreads on all pairs, and the author of this article suggests then to hold positions in the hope that someday to wait from the broker inefficiency of quotes even more than this spread. The grid of orders does not change the situation, but just allows you to sit out losses a little longer, closing only the profit and accumulating floating minus.
Thirdly, the article completely omits the issue of margin, and even if we imagine a huge deposit, what would be the % of profit, if, let's say, we managed to wait for the grid to close in the plus?
And now on the actual realisation with a lot of mistakes. For example,
// Adjustment for pairs with JPY and other exotic currencies string quoteCurrency = StringSubstr(symbol, 3, 3); if(quoteCurrency == "JPY" || quoteCurrency == "XAU" || quoteCurrency == "XAG") pointCost *= 100.0;
This is rubbish. MT5 returns the correct pip value regardless of the currency. The only nuance is that for forex the pip value is returned in the account currency, but for exchange instruments - in the currency of quotation and therefore manual recalculation to the account currency is required there. But it is not important for this article.
Next.
// Adjustment factor based on current balance sheet double equityRatio = accountBalance / BaseEquity;
If we want to allocate only a part of the money to the Expert Advisor and not the whole account, this relation should be written in the opposite direction. Now it turns out that if the account is 10000 and we have allocated 1000 for the base, the Expert Advisor will be opened with lots 10 times larger than the account would allow for a full load.
I changed it this way for my tests (otherwise the error of lack of margin comes out quickly):
// Adjustment factor based on current balance sheet double equityRatio = BaseEquity ? BaseEquity / accountBalance : 1.0;
I left this part as it is, but there are a lot of mysteries here:
// Calculation of the optimal risk-adjusted lot double riskAmount = accountBalance * (RiskPercentage / 100.0); double calculatedLot = (riskAmount / 100.0) * equityRatio / (pointCost * basePrice);
RiskPercentage is exactly a percentage, so RiskPercentage/100 gives a fraction of the money in kind in the riskAmount variable.
But what is that magic 100 that the amount of money is divided by? Is it a hardwired leverage?
And why are we dividing the money by the cost per point * price? The risk is usually taken as the distance of the stop loss, but since we have a grid, it would be logical to take the distance of the grid as a measure of risk, but that is not the case here. And 100 is not equal to the grid step by default, and the grid step is supposed to be customisable. At Forex, the formula for calculating margin (if this is it) is different, and in principle, it is better to request it through the API of MT5, rather than trying to calculate it on your own using formulas from the ceiling.
Further, I had to make such an edit in the commission calculation - it was (gave 0):
double commission = PositionGetDouble(POSITION_COMMISSION);
Became (the history is filtered by the position at the beginning of the cycle):
double commission = 0; // PositionGetDouble(POSITION_COMMISSION); for(int j = 0; j < HistoryDealsTotal(); j++) { commission += // multiple by 2 because out fees are not yet charged and may be equal to in 2 * (HistoryDealGetDouble(HistoryDealGetTicket(j), DEAL_COMMISSION) + HistoryDealGetDouble(HistoryDealGetTicket(j), DEAL_FEE)); }
Without details I would like to note that to work with different brokers I had to add Prefix/Suffix inputs for symbols and add them to expressions everywhere.
After edits and experiments we get a stable and expected drain.
- 2009.11.27
- www.mql5.com
Let's start with the fact that MT5 supports accounts with netting and hedging accounting on equal footing. The proposed system is strictly for hedging, but there is no mention of it. On netting counter positions from counter orders quickly start to collapse in a loss....
.... After corrections and experiments we get a stable and expected drain.
Stanislav, thank you for such a detailed answer.
Regards, Vladimir.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: Forex arbitrage trading: A simple synthetic market maker bot to get started.
The revolution in my thinking happened in 2017, when, after a series of painful losses, I began to study how big players actually trade. I meant not those who talk about their "million-dollar earnings" on YouTube, but real institutions – banks, hedge funds, and proprietary trading firms.
And here's what I found: they do not use fancy indicator strategies. They apply mathematical principles, risk management, arbitrage, market making and other approaches based on a fundamental understanding of market mechanisms. That is when I made my decision: I had to trade like a big player, or not trade at all.
I spent the next three years studying institutional trading methods. I immersed myself in the world of intermarket correlations, statistical arbitrage and algorithmic trading. I experimented with Python and MQL, creating prototype systems that mimicked the approaches of large market participants, but were adapted for retail traders with their capital and technology limitations.
In January 2020, on the eve of one of the most turbulent periods in the history of financial markets, Tris_Optimized was born — my answer to the question: "How can a retail trader apply institutional strategies?"
This EA does not attempt to predict market movements, does not rely on technical analysis indicators, and does not require "intuition". Instead, it mathematically calculates potential imbalances between three related currency pairs and places a grid of orders ready to catch these imbalances when they arise.
Over five years of continuous operation in real market conditions, Tris_Optimized has proven its viability. It has survived the pandemic, inflation spikes, interest rate changes, and geopolitical crises — and continues to generate consistent profits (in those rare times when I actually trade, rather than sitting up all night poring over code ideas and the actual codes). This is not a miracle system promising exorbitant returns, but a reliable working tool based on the fundamental principles of institutional trading.
Author: Yevgeniy Koshtenko