[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 687

 
ОГРОМНОЕ СПАСИБО!!!!
 
ToLik_SRGV:

Boris, it's not difficult at all, here's a simple function that implements the martingale principle: ...

An elegant solution, but I would add an instruction: 1. Do not use when trading several instruments at the same time. 2. To disable the Expert Advisor before withdrawal and for the period of swaps accrual.

 
ToLik_SRGV:

Boris, it's not difficult at all, here's a simple function that implements the martingale principle:

Pass initial volume(double lot) and step(double x) as parameters.
Insert the method directly into OrderSend instead of the volume parameter.

Example of function call:


Would it be better to use AccountEquity() instead of AccountBalance() ??? Why an EA that sends a balance line into the sky while draining invested funds ? IMHO
 
artmedia70:
Would it be better to use AccountEquity() instead of AccountBalance() ??? Why an EA that sends a balance line into the sky while draining invested funds ? IMHO
Right, - completely forgot: ... 3. Don't Use Locks.
 
tara:

A neat solution, but I would add an instruction: 1. Do not use when trading multiple instruments at the same time. 2. Disable the Expert Advisor before withdrawal and for the period of swap accrual.


Thank you.
This feature is mainly for the tester, as in real trading, it is better not to use martin, imho of course.

Regarding 1.
Martin, as you know, can severely overload the balance, so to use on one account several advisors or one on different instruments using the martingale system in its work, can very bad, and most importantly will end quickly... So it is not about determining the loss of previous trades, this unit can be easily modified if desired, the point is the principle of handling any martin, it alone needs balance resources as much as possible.

Regarding 2.
It follows from the first, when operating a martin it is better not to keep more than one open position in the account, the function call should occur at the opening of the next position, so the swaps of the previous closed position should not radically affect the operation.

I stated my attitude to the martingale system at the very beginning, so for a tester this function is more than enough.

 
artmedia70:
Maybe it would be better to use AccountEquity() instead of AccountBalance() ???...

No, Artem, AccountBalance () returns the amount of money in the account without taking into account open positions, and it does not matter whether it is in floating profit or loss, while AccountEquity() returns balance with floating profit or loss, it turns out that for example one position is in floating loss, and Martin immediately doubles the lot?
As I said, the function is better to be called when there are no other open positions, and at this point AccountEquity() and AccountBalance() return the same numbers.

Why would an EA that sends a balance line to the sky while draining invested funds ?

How do you imagine it? The balance line through AccountBalance() is calculated based on closed positions, i.e. with a fixed profit or loss, how can it decrease the invested funds in the drawdown? Then what does AccountEquity() have to do with it, if the martin is properly counted with fixed positions? Take the same function of Kim, it is looking for the last CLOSED position in history.

Why would an EA that...

It's doomed anyway.

 
eugggy:
Does anybody know an indicator that returns several last extrema of the ZigZag?

Why do you need an indicator? Here is a function for you:

//+------------------------------------------------------------------+
double getZigZag(int ex = 1, int ExtDepth=12, int ExtDeviation=5, int ExtBackstep=3){
   double date;
   int step = 1;
   for(int shift = 0; shift <= Bars-1; shift++){
      date = iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, shift);
      if(date != 0){
         if(step == ex)return(date);else step++;
      }
   }
}
//+------------------------------------------------------------------+

Parameter ex is the number of zigzag extremum, counting from right to left, starting from 1. The other parameters are standard zigzag settings.

An example of how to use the function:
Return 3 last extremes of the zigzag.

//+------------------------------------------------------------------+
int start(){
   Alert("ZigZag point #1", getZigZag(1));
   Alert("ZigZag point #2", getZigZag(2));
   Alert("ZigZag point #3", getZigZag(3));
}
//+------------------------------------------------------------------+
 
ToLik_SRGV:

No, Artem, AccountBalance () returns the amount of money in the account without taking into account open positions, and it does not matter whether it is in floating profit or loss, while AccountEquity() returns balance with floating profit or loss, it turns out that let's say one position is in floating loss and Martin immediately doubles the lot?
As I said, the function is better to be called when there are no other open positions, and at this point, AccountEquity() and AccountBalance() return the same numbers.

How do you imagine it? The balance line through AccountBalance() is considered already closed positions, i.e. with a fixed profit or loss, how can it decrease the invested funds in the drawdown? Then what does AccountEquity() have to do with it, if the martin is properly counted with fixed positions? Take Kim's function, it is looking for the last CLOSED position in history.

It is doomed anyway.


I agree, Anatoly... :) All this is true (according to my modest knowledge) relative to a single order in a market, or to an order that has already closed with profit or with a loss... If you closed with a profit, it's OK, we keep going; if you get a loss, we double the lot and attack the gates with a cry of "For Stalin!!!"... and then it's a matter of luck - if it's icy... we double up again and shout even louder "For the Motherland..." If we're lucky, we wipe the sweat off our forehead and go down to the original lot...

And if we have a few open positions in the market? What should we do? For profitable positions we work with the initial lot, but what do you want to do with losses? This brings up the concept of the loss with the doubling of the lot, and we start foolishly dancing around the loss with the lot to get equity back from the drawdown... IMHO, it's the stupidest thing (I've done it before... :))

I came to the conclusion that it is better to close all the positions by equity within the total profit set in the settings. Better yet, it (this total profit) should be floating, so to say adjusted to the current market situation... plus similar floating targets.

Testing on different time intervals of history on five-minute periods separately for three or four years and in full for the whole period allows to conclude that it is not unreasonable and contains a rational grain... At least, it produces a stable 60% profit every month (I'll keep silent about two or three month drawdowns to equity/2 sizes... :))

The fact that martinis are better for drinking, but not for trading, is something everybody, who is interested in it, should know it from his own depot. No matter how much you tell people that rake hurts in the forehead - until they check it - they will not believe... And it's a good thing they believe it the first time... Otherwise they would start looking for errors in code, sacredly believing in the holy grail...

SO everything is IMHO.

 
artmedia70:

I agree, Anatoly... :) All this is true (according to my modest knowledge) relative to a single order in the market, or to an order that has already closed at a profit or a loss... If you closed with a profit, it's OK, we keep going; if you get a loss, we double the lot and attack the gates with a cry of "For Stalin!!!"... and then it's a matter of luck - if it's icy... we double up again and shout even louder "For the Motherland..." If we're lucky, we wipe the sweat off our foreheads and go down to the original lot...

This is an example of classic martin, for which this method was written.

But what if we have several open positions in the market? What should we do? For profitable positions we work with the initial lot, but for losing lots, what should we do? This brings up the concept of the loss with the doubling of the lot, and we start foolishly dancing around the loss with the lot to get equity out of the drawdown, at least into zero... IMHO, it's the stupidest thing (I tried it... :))

I totally agree with you, break is not the best idea from the beginning, and my relation to it is the same as to the martin, the break with a martin generally loses any meaning. Since it's not a full-fledged loss (not equal in volume), you can't hold it in the market for a long time, it doesn't make sense to place it, it's easier to just "turn over", for instance my broker doesn't allow losing lots.

I came to a conclusion that it would be better to close all positions by equity within an aggregate profit specified in the settings or, even better, to make it (this aggregate profit) floating, so to speak, adjustable to the current market situation ... ...plus similar floating targets.

The minimum is not a bad idea to take forex as a whole, rather than holding on to a single position, as long as the balance can support this trading philosophy. :)))

The idea that it's better to drink martinis rather than use them in trading, everyone who is interested in them should feel it on his/her own depo. However much you may tell people that rake hurts their forehead - they will not believe you until they check it... And it's a good thing they believe it the first time... Otherwise they will start looking for errors in the code, believing in the holy grail...

Again, it's hard to disagree with you, I personally had enough of the tester :)))
 
ToLik_SRGV:

At the very least it's not a bad idea to take forex as a whole, rather than holding on to a single position, as long as the balance can withstand this trading philosophy. :)))

Looking at numerous tests at different intervals of test periods, the balance is running smartly towards the sky (for investors, it is miraculous), but money is wandering back and forth, sometimes making you think about tightening the rules for entering the market...
Reason: