[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 688

 
Investors these days are smart: they know what equity is. They've had enough of these balance sheet rockets in the sky...
 
Mathemat:
Investors these days are smart: they know what equity is. It seems they have had enough of these rockets of balance into the sky...
:) Alexey, there are still some rich men in Russia who look enchantingly into the sky following the balance... :)

... Only there is such a thing as conscience and honesty, directly stemming from conscience... :)

A thought came to me later and I added: it's not just conscience and honesty... there are consequences as well... For the sane ones, of course...

 
ToLik_SRGV:

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

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

An example of using the function:
Let us return the last 3 extrema of the zigzag.


This is very inefficient, there will be three loops within this function, while all three tops can be found in one.

In order to retrieve several values from the indicator, we should start an indicator buffer for them and specifically maintain this buffer in the indicator code. And the buffer will take too much memory. So, it's not too effective solution.

It would be effective to integrate the code of the zigzag in the needed indicator, and then the tops would be able to be registered the moment they appear. And in order to structure the code somehow, the zigzag itself should be made as a function, or rather, one step of the zigzag. Then the indicator of the zigzag will look like this

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int    counted_bars=IndicatorCounted();
//----
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(int i=0; i<limit; i++) {    RunZZ(i);    }

//----    return(0);   }

This loop can be easily pasted into an indicator or an Expert Advisor. And it would be easy to use the "internal" data of the zigzag without unnecessary problems.

 
Candid:

This is very inefficient, inside this function loop, there will be three loops while all three vertices can be found in one...

This may be true, but integrating ZigZag code into an EA or other indicator, in this particular case, is like firing a machine gun at a sparrow, an unnecessary complication.
As far as I understood, a person needs a few last extrema of ZigZag, therefore cycles of my method will be "short" enough and won't strongly overload the system.
 
ToLik_SRGV:

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

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

An example of using the function:
We return the last 3 extrema of the zigzag.


Thanks a lot, I was working with this zigzag all day yesterday, it somehow returns 0 when I call iCustom. It remains for me to "bolt" this function to the Expert Advisor, I will try it, maybe it will work.
 
Candid:

This is very inefficient, inside this function, there will be three cycles while all three vertices can be found in one.

In order to extract several values from the indicator, you need to create an indicator buffer for them, and you should specially maintain this buffer in the indicator code. And the buffer will take too much memory. So, it's not too effective solution.

It would be effective to integrate the code of the zigzag in the needed indicator, and then the tops would be able to be registered the moment they appear. And in order to structure the code somehow, the zigzag itself should be made as a function, or rather, one step of the zigzag. Then the indicator of the zigzag will look like this

This cycle can be easily pasted into an indicator or an Expert Advisor. And it would be easy to use the "internal" data of the zigzag without unnecessary problems.

Thanks for the help, but I don't want to mess anything up in the zigzag, I'm just learning.
 
ToLik_SRGV:

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

How do you envisage this? The balance line through AccountBalance() is counted by closed positions, i.e. with a fixed profit or loss, how can it drain the invested funds, in a 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's doomed anyway.

I wondered - what should be the basis for calculating the risk for a new trade, if the main criterion is the lowest risk? -

AccountFreeMargin(), AccountEquity(), AccountBalance() ...?

- AccountBalance() - does not take into account open trades.

- AccountEquity() - this is what we see on the balance chart? - In this case we will rely on the money that doesn't belong to us yet.

- AccountFreeMargin() - can we use this? (I admit I may be misunderstanding what it is)

 
eugggy:
Thanks for the help, but I don't want to mess anything up in the zigzag, I'm just learning.


As an example of a fast zigzag, which builds a channel on the last tops

Files:
 
Vinin:


As an example of a fast zigzag that builds a channel over the last peaks

OK, I'll give it a try. But it probably won't work for figure identification.
 

Hello.

I probably have a simple question for a pro, imho, question about character limit in mql4.

I've read that a variable of string type can fit not more than 255 characters, but is there a similar limitation for if?

If so, what are they? :)

Can signals to open a position be written under one if? or should the code be split into blocks?