Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1428

 
vitaliy zamkovoy #:

You are not describing the task correctly! It is not "once every 20 seconds", but every second to check the values that have passed some time ago. As for "why" - this is not a question for this discussion. (And 20 seconds is just as an example).

It's like a moving average, where the first candle is compared to the second candle. Only I have to calculate everything inside the current (zero) minute candle. (Or even better - on a line chart. After all, 20 seconds can flow to the first candle).

You have described your algorithm incorrectly, i.e. inaccurately, and it follows from the fact that it was not understood unambiguously by everyone. One understood it this way, it turned out to be wrong, another understood it differently, it turned out to be right according to you. This is a consequence of an inaccurate and unambiguous description of the algorithm. By the way, such a code with copying ticks will not work in 4k. 4ka does not memorise ticks, you need to memorise them yourself.)))))

 
Alexey Viktorov #:

I am so sick of reading all this nonsense... After all, the code is only FOUR lines, and the discussions are 3 pages long.

20,000 milliseconds is 20 seconds.

Next, put a condition on the size of the delta variable more/smaller, left/right or north/yuh....

Brutal code) On every tick, copy it))))))

 
Valeriy Yastremskiy #:

...

this code will not work in 4k with copying ticks.

...

Read the title of the topic.

 
Alexey Viktorov #:

Read the title of the thread.

))))) you can't argue)

 

Hi all, I am writing a code for checking open positions in the Expert Advisor.


#include <Trade\PositionInfo.mqh>

#include <Trade\Trade.mqh>

#include <Trade\SymbolInfo.mqh>

#include <Trade\AccountInfo.mqh>

#include <Trade\DealInfo.mqh>

#include <Trade\OrderInfo.mqh>

CPositionInfo  m_position;                   // trade position object

CTrade         m_trade;                      // trading object

CSymbolInfo    m_symbol;                     // symbol info object

CAccountInfo   m_account;                    // account info wrapper

CDealInfo      m_deal;                       // deals object

COrderInfo     m_order;                      // pending orders object



//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

bool ExistBuy(long magic_number)

{

   for (int i = PositionsTotal() - 1; i >= 0; i--)

   {

      if (m_position.SelectByIndex(i))

      {

         if (m_position.PositionType() == POSITION_TYPE_BUY && m_position.Magic() == magic_number && m_position.Symbol() == Symbol())

         {

            return (true);

         }

      }

   }

   return (false);

}



The same code is available for sell positions. Everything works. But there is one broker (maybe there is a little more) he can open duplicate positions on a real account despite the check. And he does it not always. I.e. the error (opening a duplicate position) is not caught in the tester - everything is ok there, on the real account it is caught, but not always.


What is going on? Why is it so?

 
jcinvestorYury open positions in the Expert Advisor


The same code is available for sell positions. Everything works. But there is one broker (maybe there is a little more) he can open duplicate positions on a real account despite the check. And he does it not always. I.e. the error (opening a duplicate position) is not caught in the tester - everything is ok there, it is caught on the real account, but not always.


What is going on? Why is it so?

Hello! And what are your conditions for opening a long and/or short position? Do you check that there is already one open BUY and/or SELL position?

Regards, Vladimir.

 
MrBrooklin #:

Hello! And what are your conditions for opening a long and/or short position? Do you check there that there is already one open BUY and/or SELL position?

Regards, Vladimir.

This is a demonstrative code, "How not to write" ...

 
I am not a dummy and even a dinosaur on the market, but I can not catch up with the reason forinstalling Expert Advisors,which at the beginning of the installation are indicated in the window, and then fly out of the window.... They fly out of the window at once. When running through all the pairs in the overview, in the tester, also do not show the results, after selecting a particular pair and running it, except for the ruble or in general, the window is empty.... At the same time, some Expert Advisors work normally and in the tester too, how to understand, compiled Expert Advisors, hooligans. Please enlighten me with such a confusion ?
Как купить торгового робота в MetaTrader Market и установить его?
Как купить торгового робота в MetaTrader Market и установить его?
  • www.mql5.com
Каждый продукт в Маркете MetaTrader можно купить и через торговые платформы MetaTrader 4 и MetaTrader 5, и прямо на сайте MQL5.com. Выберите продукт, который лучше всего подходит под ваш стиль работы, оплатите его удобным для вас способом и не забудьте активировать.
 
Hello.
Can you tell me how to level points of different pairs? (Three-digit and five-digit quotes).
For example: EURUSD EURJPY GOLD.
How is it done, for example, in the Signals service?
There the profit is shown in dollars and pips.
 

Guys, give me a hint, please.

I was not a very good programmer in MT4 ) Now I'm switching to MT5.

I have encountered such a nuance:

I want open orders to be not more than one at a time, on mt4 it was easy enough to solve this ... In MT5 in the manual it is written "DO NOT confuse orders and deals" and it is written that it is necessary through the function

HistoryDealGetInteger

HistoryDealGetInteger function to request something there..... I don't understand anything, honestly. Please, kind people, explain it humanely.