The market is always wrong - page 3

 

I haven't dealt with the Expert Advisor yet, but I use a similar code to calculate equity

if (AccountEquity() > beginEquity) {
      if (IsTesting()) {
         beginPrice = Bid;
         magicnumber++;
         beginEquity = AccountEquity();
      } else {
         Alert("Please refresh beginPrice, beginEuqity and change magicnumber");
      }

I suggest equating the variable to the balance during initialization as the second option

int init()
  {
//----
   if (IsTesting()) {
      beginEquity = AccountBalance();
   }
   return(0);
  }

In this case there will be no need to check equity before running the EA,

static double beginEquity = 200000;

Because its equity is equal to the balance before the start of the Expert Advisor!

Vyacheslav.


 
Winner:
Reshetov:
If you are willing, you can do so. Otherwise the funds will go to reinvestment.
And what is the risk of not losing a depo, if the advisor opens positions for the whole depo????
As soon as the MT tester starts to support multi-trading, it will be possible to get an empirical estimate of the probability of losing on historical data.

For now, the tester can only empirically assess risk on single pairs.

An analytical estimate of risk for this tactic has not yet been derived.
 
Reshetov:
timbo:
YuraZ:
A very good strategy,
...
the other issue is that withdrawals are made after a year or two
I read a book about forex, stocks, etc. In particular, it was about employees of various funds that seemingly increase depositors' money and which are considered as professionals and almost celestials. So there was a thought on the subject that they are the same people as anyone else, no better and no worse, and they make mistakes no less often. The "deposit" is just so big that it allows to sit out any drawdown.
In other words, if you are not in such a hurry to withdraw, and the deposit size is immense, it makes no difference which way you open - sooner or later you will be in the black.
If you open a buy position at a historical maximum or sell position at a historical minimum, the profit will wait till the next historical extremum. There is a difference in entering and exiting the market, and it is significant.

To avoid such situations it would be better to add a simple thehanalysis and to avoid being overly concerned choose a period of a day.
 

Thank you for your answer, respected Mr. Reshetov. I've already realized myself that these lines are for safety precautions, something like {try...catch} in other languages. Especially, in the test I've really never entered Closeby function.

I seem to have created something for the test. Although I still can't rule out errors, I thought I'd show you something I've been working on. I plan to do it on Finlist (I feel more comfortable there), but since Yuri is on this forum I'll probably start here.

In general, what you will see here will help you understand how EA's signals are generated.

So far I have added a version 1.1 of the EA algorithm. Yuri keeps giving me new versions and I have to dig them like a snail. It seems to be the same as version 1.1 but sellprofit has >0.001 instead of 0.01.

The test is carried out according to my plan, so don't be sorry. It means that my depo for now is $1000 and therefore I have a limited number of pairs in use. So far I only use one EUR group. I limit the test to 24 hours. My program is flexible and of course I may set duration of 2 or 10 days. But for the time being I don't care about that, what is important is a general understanding of the algorithm. Especially since it still takes a long time to calculate. Test day is half an hour calculation, it's because of view table (see below). It's very long, but I'm actually outputting all variable assignments to the table and stuff. I even envy the MQL test - how fast they make everything run. Of course, everything is done in a more professional way, but you won't see everything there. But for me it is one grain at a time - but I have a clear view.

Some explanations. My quotes are specially prepared - it means that they have holes and so on. Such processing takes time as long as I don't want to load fresh data and I have the range of historical quotes from 01/01/05 to 16/09/06. So the test is within those limits and that's enough for me for now. Yes, the quotes are forexclub, minute and taken from forextester.

I provide 3 tables where you can see all the developments:

1) _history - it is similar to "Account history" in mql, but only open and closed orders are located together, the sign of separation is field [flag]. Everything is clear there. Field id_operation: if "1", it's BUY/.

2) _resources: total balance, equity and profit by open orders at the current moment of time for all involved currency pairs. Everything should be clear here too, except the [ID] field - this is my internal date identifier. I can explain in more detail, if you have any questions, but in general, what date it corresponds to can be seen in the third table _view, where everything is detailed, and in _resources the total of each minute is displayed.

3) _view - everything is very detailed, for each currency pair there is a different history of transaction development. The [Actual_price] field is the Close of a minute quote. Bid, Ask - I get +-spread (spread is taken from Alpari, but because everything is in tables, I can correct it, but I don't see much sense, anyway everything is approx.) And data reading is very simple - the first version of the EA, and the row number will be a pointer, and in what place was the assignment in the variable (for example, the field [money_54] corresponds to 54th line of the EA, where money is recalculated. If "0", it means, there was no calculation in this place, because there were no corresponding conditions) . Check comment field, operations are documented there and correspond to history in table _history. Yes, one possible misunderstanding. The Itog_profit field is the total profit for the current moment of the open orders for the given currency pair. The sellprofit or buyprofit field may be different because it only contains data of the last open sell or buy order. So in the loop <for> for the list of open orders. The rest should be clear, unless you find my mistakes.

I have just started to look at it myself. I was pleased with the test at first. I poked four times at the first available day (I'm not even looking at the chart yet) using 2 symbols EURUSD+ EURCHF, made one day calculation and had good results - from 15 to 150 pips. But then I got to the day when total for the day ended with -80 pips. Once again I am interrupting the test and this is not correct. Apparently if the test continues there will be a different result. But for now I'm looking at it this way.

This version of the test is a kind of scalping and Yuri correctly says that his EA is quite different and the deposit should not be small because the technological process of the EA operation is violated when the deposit is small, averaging does not work as expected due to lack of funds and the fight for "survivability" may result not very positive.

Once again I will say that I admire Yuri's Expert Advisor as much as I do. Very interesting and original. But see for yourself - it is both beautiful and dangerous, at least version 1.


Sincerely, Fed

Yes, once again: Depo $1000, Bl=1000, BeginPrice - current at datetime calculation. The purpose of the test is to understand how signals are generated.

First test - 15/03/05 10:00 till 16/03/05 10:00

It was a "news" day, but since we are watching generation of signals (who cares), it's all the same for now.

First for 2 pairs EURUSD and EURCHF



 
Now the same input parameters, but only one EURUSD is taken
 

Now 2 pairs EURUSD and EURCHF, depo 1000, bl 1000, c 15/03/05 00:00 to 16/03/05 00:00. I.e. slightly changed time, BeginPrice=current.

 
Well and 1 pair EURUSD, depo 1000, bl 1000, from 15/03/05 00:00 to 16/03/05 00:00.




Well, for now, I will stop filling mql with my creations. Maybe it's not interesting, maybe at this stage someone will find my error. And I can show the change of calculation depending on Bl and BeginPrice <> current

Sincerely, Fed
 
FION:
Reshetov:
timbo:
YuraZ:
A very good strategy,
...
the other issue is that withdrawals are made after a year or two
I read a book about forex, stocks, etc. In particular, it was about employees of various funds that seemingly increase depositors' money and which are considered as professionals and almost celestials. So there was a thought on the subject that they are the same people as anyone else, no better and no worse, and they make mistakes no less often. The "deposit" is just so big that it allows to sit out any drawdown.
If you are not in such a hurry to withdraw, and the deposit size is immense, it does not make much difference which way you open - sooner or later you will be in the black.
If you open long position on the historic maximum and sell on the historic minimum, the profit will wait till the next historic extremum. Reshetov: There is a difference for entering and exiting the market, and it's significant.

To avoid that it may happen, it would be good to add simple tehanalysis and choose a day period to avoid overdoing it.
I just did not read the book attentively. And this book clearly states that "professionals" trade strictly by counter-trends and most often by the averaging method. That's why there's no way for them to buy at the local high and sell at the local low.
 
Fed:

Thank you for your answer, respected Mr. Reshetov. I myself have already understood that these strings are for safety precaution, something like {try...catch} in other languages. Especially, in the test I really never entered the Closeby function

It's really a pity that MQL is not object-oriented. Handlers of exceptional situations and homemade event handlers greatly simplify the life of programmers, because many bugs can be fixed beforehand. And while there is no OOP, we have to try to foresee various outrages at the algorithmic level, and the code is not too kosher.
 
Paha:
Hello!
Just kidding.
As Mathemat said "on the surface analysis" well, very nice! Not a single negative value. But what I do not understand (maybe I misunderstood): I do not turn off the gambler and do not close the terminal. Will the alert be displayed under such conditions or will the EA trade by itself as it should? What will happen if I disconnect from the Internet for a short time and then restore the connection? 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 usual, 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 !!!!
Short-term disconnection from the Internet does not affect the tactics of the Expert Advisor in any way.

In general, you can do without allergies and switch to semi-handheld, especially if there is no possibility to monitor the Expert Advisors. The principle is to start a new game (i.e., a new magik and beginPrice for all EAs) when the equity level exceeds the previous one.

I.e. when there is an opportunity, look at the equity. If it has exceeded the previous level, then:
  1. Stop all EAs from working.
  2. We close opposite positions for all symbols using "close overlapped orders" in order not to lose on the spread.
  3. Increase the wizards by 1 and set their beginPrice at the current Bid, i.e. start a new game.
  4. Remember the current equity level. For example, write it down on a piece of paper or in a file.
  5. Start the EAs with the new settings.
  6. Go to work, business or chicks.
  7. When the opportunity arises to look at equity again and change the settings, we look at it and if the previous level is exceeded, we proceed to point 1. If it is not exceeded yet, we proceed to point 5.
Reason: