The market is always wrong

 
A continuation of the theme "Arbitrage". There are already a lot of pages, and the critics have made a mess of it, so a new topic.

I managed to raise equity over the balance. It looks like this (EURJPY H1):





EA source code attached to the post. So is the tester report.

For this, I had to add one more input parameter to the code: beginEquity - initial equity. I.e. the initial balance. In the Strategy Tester, the Expert Advisor automatically monitors whether the level of beginEquity is exceeded. And if it is exceeded, it starts the game anew, i.e. it changes beginPrice into Bid, beginEquity into the current equity and changes the magic number (increases by 1).

But on Demo and Real, the Expert Advisor will only generate an alert asking to change these parameters manually. The matter is that the Expert Advisor does not save previous parameters anywhere at terminal or computer shutdown, and it will not be able to restore them after restarting (those who really need them can create a file database or store parameters in global variables).
Therefore, we will have to monitor the signals of Expert Advisors and if they start displaying messages, we will have to manually change the above input parameters for the entire group.
 
Here I am, critic, finding you here too, Yuri. Now I'm going to shit in here too. Superficial analysis of the report shows that from August 20, 2004 to 22:00 on May 4, 2007 at initial deposit of 200,000 72,252 profits were made, and at 22:00 all remaining positions were closed, which brought about 528,000 profit in one go (7 times more than in the whole testing history!). The effect is probably caused simply by the end of testing period.
 
Mathemat:
Here I am, critic, finding you here too, Yuri. Now I'm going to shit in here too. Superficial analysis of the report shows that from August 20, 2004 to 22:00 on May 4, 2007 with initial deposit of 200,000 one made 72,252 profits, and at 22:00 all remaining positions were closed, which brought about 528,000 profit in one fell swoop (7 times more than in the whole testing history!). The effect is probably simply due to the end of the testing period.
The moment of testing completion can be seen on the right-hand chart as a strictly horizontal green band (equity) and a sharp non-linear "growth" of the balance below this very horizontal line. In other words, the tester closes all positions and the balance "grows" until it is equal to equity. Obviously, there were many open positions with positive profit at that moment. Otherwise equity cannot rise higher than the balance.

The Tester closes all open positions at the end of the testing period. If the equity is not equal to the balance at that moment, the balance will be equal to the last equity value after closing all the positions. Therefore, do not call this behaviour of the tester an "effect", because it is the principle of operation.
 
Hello!
Here's your grandmother's day! Just kidding.
As Mathemat said "by surface analysis" well very nice! Not a single negative value. I'll put it to test online. But here's what I do not understand (maybe I misunderstood): I do not turn off my gambler and do not close the terminal. Will the alert be displayed in such conditions or will the EA trade by itself as it should? What will happen if I am disconnected from the internet for a while and then re-connected? Without any disconnection from my side?
For me the question is very important because of my absence from the computer for at least 18 hours a day (sleep, work, etc.) and if in that time disconnection occurs, or I can not enter new data. ..... well, not really good.
Also, if I understood correctly: if you switch on the cam or terminal, you just need to enter the current values and everything will go as it should be, i.e. reconnect the EA?
Also, if the alert is displayed, but we do not do anything, does the EA continue trading according to the old settings or does it wait for the new ones to be entered?
If possible, please give these points more details!!!!
Thanks for another reason to rack my brains a bit! (in a good way).
Sincerely !!!!
 
I do not know why, but in tester mode the Expert Advisor opens deals in batches of about ten, is this a coincidence or not?
I don't know why, but in tester mode the Expert Advisor opens deals in bunches of about ten pieces. If you take 5 minutes from the start 3000, the EuroUSD, from 02.01.2007 to this day, opens ten positions that are closed for some reason not at the end of the period, but somewhere on 12.02.2007 a solid sinking, and this sinking is basically those first ten open orders. And this picture is repeated not only at small times. Even if we increase the deposit up to 50,000, it is also losing. Change the time frame, to 1 hour, it is also losing. Something is wrong here!
The first one is the most beautiful so far. Maybe I have done something wrong?
Sincerely!
 
Hello!

I have a small question: I downloaded the Expert Advisor, but it generates an error on compilation:
MODE_MARGINREQUIRED' - variable not defined C:\Program Files\PFG FX Trader\experts\ArbitrageReverse_1. 5.mq4 (244, 49)
What is MODE_MARGINREQUIRED variable useful for and how to set it?

 
Implex:
Hello!

I have a small question: I downloaded the Expert Advisor, but it generates an error on compilation:
MODE_MARGINREQUIRED' - variable not defined C:\Program Files\PFG FX Trader\experts\ArbitrageReverse_1. 5.mq4 (244, 49)
What is MODE_MARGINREQUIRED variable useful for and how to set it?


Upgrade your terminal to the latest build 204 by downloading the distribution from: http://www.metatrader4.com/files/mt4setup.exe
 

Although I haven't finished the test of the old EA as planned, I've been thinking about how to improve that version. And then Yuri came up with a new one. It's no longer "fifth element", but "sixth". How can I work here? My hands are shaking.

But seriously, I have a question about the code. It may be naive, so I am not only addressing Yury. Maybe someone else will clarify it. I will be grateful to them.

In ArbitrageReverse_1.1.mq4, and in the new version of ArbitrageReverse_1.5.mq4, the same structure is repeated, which is unclear to me: It is a call of the user function closeby(ticksell, tickbuy) after a block rounding of orders currently open. For ArbitrageReverse_1.1.mq4 it is line [106], for 1.5 it is line [128]. The function makes sense - if there are open SELL orders and open BUY orders (one symbol each), SELL will be closed by BUY. What I don't like is that there is no precondition for this operation to take place. In other words, only if we have BUY and SELL, the orders should close. But further in the code, already in block 'dt' the call of function closeby(ticksell, tickbuy) (for v:1.1 line [163], for v:1.5 [189]) is framed in conditions. And that seems more correct to me. In principle, I'll soon see what's going on myself, having traced all assignments to variables, while I work on my minor bugs. But now I'll ask Yuri directly:
Is the closeby call needed in line [106] v:1.1 or [128] v:1.5 and if so, what will "close" in [163] for v:1.1 or in [189] for v:1.5 if it turns out that everything that can be closed must be closed before that? I understand that there may be a difference in lot volumes, but still, something here seems "off" to me.

The closeby(tickbuy, ticksell) call in [200] for v:1.1 or in [224] for v:1.5 is more or less clear - if an open order SELL or BUY is defined in open orders, and in block "dt", depending on conditions, an opposite order can be opened by OrderSend function - then the close will be executed respectively.

Anyway, if I've asked something stupid, I apologize. Point out the error and I will correct it.

Sincerely, Fed.

 
I've already posted an EA on CodeBase which, by adhering to arbitrage tactics, also earns on positive swaps. After moderator verification the code will be available HERE
 
Hello!
I tried to understand - the logic of this modification depends on the beginPrice , beginEquity that needs to be changed manually. i think the only results on the euroyenne were the same and the rest were net drains when the test was closed ... And equity is not often higher than the balance. Thanks
 
Fed:

Although I haven't finished the test of the old EA as planned, I've been thinking about how to improve that version. And then Yuri came up with a new one. It's no longer "fifth element", but "sixth". How can I work here? My hands are shaking.

But seriously, I have a question about the code. It may be naive, so I am not only addressing Yury. Maybe someone else will clarify it. I will be grateful to them.

In ArbitrageReverse_1.1.mq4, and in the new version of ArbitrageReverse_1.5.mq4, the same structure is repeated, which is unclear to me: It is a call of the user function closeby(ticksell, tickbuy) after a block rounding of orders currently open. For ArbitrageReverse_1.1.mq4 it is line [106], for 1.5 it is line [128]. The function makes sense - if there are open SELL orders and open BUY orders (one symbol each), SELL will be closed by BUY. What I don't like is that there is no precondition for this operation to take place. In other words, only if we have BUY and SELL, the orders should close. But further in the code, already in block 'dt' the call of function closeby(ticksell, tickbuy) (for v:1.1 line [163], for v:1.5 [189]) is framed in conditions. And that seems more correct to me. In principle, I'll soon see what's going on myself, having traced all assignments to variables, while I work on my minor bugs. But now I'll ask Yuri directly:
Is the closeby call needed in line [106] v:1.1 or [128] v:1.5 and if so, what will "close" in [163] for v:1.1 or in [189] for v:1.5 if it turns out that everything that can be closed must be closed before that? I understand that there may be a difference in lot volumes, but still, something here seems "off" to me.

The closeby(tickbuy, ticksell) call in [200] for v:1.1 or in [224] for v:1.5 is more or less clear - if an open order SELL or BUY is defined in open orders, and in block "dt", depending on conditions, an opposite order can be opened by OrderSend function - then the close will be executed respectively.

Anyway, if I've asked something stupid, I apologize. Point out the error and I will correct it.

Sincerely, Fed.

If in demo and real mode closing of counter positions were as perfect as in tests, surely it would be enough to leave only one call to closeby() before the last return(0) in start event. Therefore, in test mode, no matter how traceable it is, no closing in additional calls will happen.

But in demo mode and in real life, closed positions often fail to close on counter for some reason (for example, there is no connection with server for a short time), so I had to provide additional calls to closeby().
Reason: