Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 680

 
Sayonaraaa1:
I can't download the tool into the terminal, what should I do?

So, if people have bought an indy, what is your connection to it?

 
When I apply an indicator to the "First Indicator Data", how do I know which buffer is being taken for the calculation?
 
Sergey Basov:

I have it roughly like this:

In the input parameters block:

MaxLossBalanceBlock - maximal drawdown of balance in % for all symbols, at which orders on the current symbol will be opened (does not affect the averaging orders), 0 - not used.

It is not used in the function of searching for signals to enter:

But you will have to adapt it to your code yourself, I have very little free time.

If there are open positions, the drawdown should be calculated based on equity, not on the balance. The balance may be zero or even less than zero if the equity is positive. How would you calculate it?

And if your balance is a billion, but your equity is around the margin stake, what then?

 
Sergey Basov:

I wrote a long time ago and in a hurry, but nobody has offered any other help (code example) so far. That is why it is what it is.

The question was:

So, if your balance is a billion and equity is close to a margin call, the Expert Advisor will not open new orders, it will just bring the open orders to their TP and that will be it - only the averaging ones will open ))

It's called nonsense :)

And so:"only the averaging ones will open" - no, they won't - there is no margin.

 
How do I calculate the lot with dynamic T/P so that the profit in the currency of the deposit. is always equal to N units?
 
Ghabo:
How do I calculate the lot for dynamic T/P, so that the profit in the depo currency. is always equal to N units?
Lot=Money/(Staples*Tick)
Money - earned/lost
Stopplos - in broker points
Tick - SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE);
From here you can spin it as you want:
Staples=Money/(Lot*Tick)
Money=Lot*Stopplos*Tick
 
Roman Sharanov:
When I apply an indicator to "First Indicator's Data", how do I know which buffer is taken for calculations?

only search the forum and "First Indicator's Data" articleshttps://www.mql5.com/ru/search#!keyword=First%20Indicator's%20Data

and then check it yourself

HH: not a very popular way of calculation in indicators, usually they don't bother - if you want to calculate an indicator programmatically, you just look in the "Data window" or in the indicator source, find the needed buffers and use them in calling your indicator later

Поиск - MQL5.community
Поиск - MQL5.community
  • www.mql5.com
Поиск выполняется с учетом морфологии и без учета регистра. Все буквы, независимо от того, как они введены, будут рассматриваться как строчные. По умолчанию наш поиск показывает страницы...
 
Artyom Trishkin:

Thank you.

 double Деньги =10.0;
 double Тейк_Профит=100;
 double tick_value=SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE);
 double  Lot=Деньги/(Тейк_Профит*tick_value);

How do I expand the formula to know what the profit in the depo currency will be when the Take Profit is reached ?

 
Ghabo:

How do I expand the formula to know what the profit in the depo currency will be when the Take Profit is reached ?

Probably like this, for sell:

profit=NormalizeDouble((OrderOpenPrice()-Ask)*MarketInfo(_Symbol,MODE_TICKVALUE)*lot/Point,2);

for a Bid-based purchase, i.e. ( Bid -OrderOpenPrice())

 
Igor Makanu:

probably like this, for selling:

profit=NormalizeDouble((OrderOpenPrice()-Ask)*MarketInfo(_Symbol,MODE_TICKVALUE)*lot/Point,2);

to buy by Bid, i.e. ( Bid -OrderOpenPrice())

This solution does not take into account commissions and swaps. The points seem to be in profit, but with costs - losses.

We need to operate with:Lot -> Money -> Distance, and the cost of the tick