[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 343

 
hoz:

There is a stack of pending orders on both sides. If any of the pending orders are triggered, then on the other side the outermost pending order is deleted. In the screenshot I showed what happens if a buy order is triggered and the outermost short order is deleted.

I have done it if one position has triggered. But what if not one but 3 triggered at once? I.e., I should somehow estimate the number of triggered pending orders and close the pending orders of the opposite signal.

What is the best way to do it? Maybe, someone has already implemented this point? I have not decided to post this question to a separate branch. Perhaps, it will be very simple for those who understand this point better.

If we needed to delete only the lowest one position, we could find a position opened at the lowest price and delete it in the loop, but if there are several positions, what should we do? I would be glad to hear the opinion of those who already have experience with order grids.

Victor, when the bottom one is deleted, the next one, which has become the lowest one, will also be deleted by the same condition. Quick for you, but for the program the main thing is not to be on the same tick, but that's OK! Try it!
 

Here's a question - has anyone done any speed testing on different processors on the MT-5 tester?

If so, please give me a link. Or at least tell me which of the top AMD and INTEL processors is better in terms of speed?

Of course, we are talking about desktops, not laptops or supercomps. :-)

 
DruZhban:

Here's a question - has anyone done any speed testing on different processors on the MT-5 tester?

If so, please give me a link. Or at least tell me which of the top AMD and INTEL processors is better in terms of speed?

Of course, we are talking about desktops, not laptops or supercomps. :-)


everything on five is here :https://www.mql5.com/ru/forum
 
borilunad:
Victor, when the low one is deleted, the next one that has become the lowermost one will be deleted by the same condition. The rapidity is for you; the most important thing for the program is not to be on the same tick, but this is ok! Try it!


Boris, that's understandable. I was just thinking about this. I think we should start a loop from 0 to a variable that stores the value of triggered orders and run the function of finding the required order and then close it on each iteration of the loop. I am not sure how to fix that this procedure is executed at the current moment.

By the way, it would be better to search for the most extreme orders using the standard search function and then pass the values of order open time and price to the function of closing the orders, right?

 
hoz:

There is a stack of pending orders on both sides. If any of the pending orders are triggered, then on the other side the outermost pending order is deleted. In the screenshot I showed what happens if a buy order is triggered and the outermost short order is deleted.

I have done it if one position has triggered. But what if not one but 3 triggered at once? I.e., I should somehow estimate the number of triggered pending orders and close the pending orders of the opposite signal.

What is the best way to do it? Maybe, someone has already implemented this point? I have not decided to post this question to a separate branch. Perhaps, it will be very simple for those who understand this point better.

If we needed to delete only the lowest one position, we could find a position opened at the lowest price and delete it in the loop, but if there are several positions, what should we do? Well, I would be glad to hear the opinion of those who have experience in dealing with order grids


If i'm not mistaking, i'm trying to make a good move with the help of some pairs of pending orders.

deletion algorithm :

1) dig in the list of open positions and write (remember) their slots.

2) look in the list of set pending orders and check for a matching "slow" from the list of poses, if they match - delete the pending order.

And no more pain.

For example, if you're an old programmer, or you don't know anything about coding, or it's too fashionable to do everything in a different way? ??? а ?

 
Here are the source indicators, please help with outputting values (for example through the comment) (in numbers) equal to the price of each indicator in real time (I know icustom, but I can not understand what parameters you need to specify to be outputted exact values, then output 0, then the number is greater than 2m).
Files:
zigzag.zip  4 kb
 
DruZhban:

Here's a question - has anyone tested the speed of the MT-5 tester on different processors?

If so, please give me a link. Or at least tell me which of the top AMD and INTEL processors is better in terms of speed?

Of course, we are talking about desktops, not laptops or supercomps. :-)



On a 5 use the clouds for testing and forget about your processor, even if it's multi-core and fast. Really speeds it up many times over. But you will have to pay a penny. In fact, there's been a discussion here at some point
 

Good day to all!

My question seems to be simple, but I dug through all the articles, but could not find an answer - how does the return(-1) operator work? Where does it pass control to? In this code, for instance:

int start()
{
    //---- Запоминаем значения индикатора для дальнейшего анализа
    //---- Обратите внимание - используем 1-й и 2-й бары. Это даёт задержку в 1 бар 
    //---- (т.е. сигнал появится позже), но защищает от многочисленных открытий и закрытий
    //---- позиций в течении бара
    double MACD_1 = iMACD( Symbol(), 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1 );
    double MACD_2 = iMACD( Symbol(), 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 2 );
 
    int _GetLastError = 0, _OrdersTotal = OrdersTotal();
    //---- перебираем все открытые позиции
    for ( int z = _OrdersTotal - 1; z >= 0; z -- )
    {
        //---- если при выборе позиции возникла ошибка, переходим к следующей
        if ( !OrderSelect( z, SELECT_BY_POS ) )
        {
            _GetLastError = GetLastError();
            Print( "OrderSelect( ", z, ", SELECT_BY_POS ) - Error #", _GetLastError );
            continue;
        }
 
        //---- если позиция открыта не по текущему инструменту, пропускаем её
        if ( OrderSymbol() != Symbol() ) continue;
 
        //---- если MagicNumber не равен _MagicNumber, пропускаем эту позицию
        if ( OrderMagicNumber() != _MagicNumber ) continue;
 
        //---- если открыта БАЙ-позиция,
        if ( OrderType() == OP_BUY )
        {
            //---- если МАКД пересёк 0-ю линию вниз,
            if ( NormalizeDouble( MACD_1, Digits + 1 ) <  0.0 && 
                  NormalizeDouble( MACD_2, Digits + 1 ) >= 0.0    )
            {
                //---- закрываем позицию
                if ( !OrderClose( OrderTicket(), OrderLots(), Bid, 5, Green ) )
                {
                    _GetLastError = GetLastError();
                    Alert( "Ошибка OrderClose № ", _GetLastError );
                    return(-1);
                }
            }
            //---- если сигнал не изменился, выходим - пока рано открывать новую позицию 

else return(0);

With zero in brackets and without brackets everything seems clear. But what about (-1)?

Thank you for replying. :)

 
hoz:


Boris, that makes sense. I was just thinking about this. I think we should loop from 0 to a variable storing the value of triggered orders and run the function that searches for the required order and then closes it on every iteration of the loop. But I am not quite sure how to fix that this procedure is currently executed.

And, by the way, it is better to search for the most extreme orders using the standard search function, and then the open time value and price are passed to the function to close the orders, right?

Victor, I mean when a pending order is deleted, it is already in the history and when we open another position, another pending order is also deleted by the same condition because we check for the positions we have! And how it works, look through the logs! Then you'll see if it's right or wrong!
 
Hello all. This is a serious and urgent matter and I've looked all over the Internet, as they say... I decided to use MT4 for a long time, I've been using it for 3 days. I tried to use it for a while and it seemed to me that it was for the first time and I got confused with the settings and the browser forgot the sites I visited. I thought, it's nothing serious, but all of a sudden I go to MT and I see 4 H4 charts with a new system and I see the wrong price, I compare it with the StartFX 2, I open time frame H1 and D1 and I wait... I have been waiting for an hour and it will update year by year, but it won't do that. "Well, reinstall it and that's it" - you say, and I'll tell you "Fuck it". "So download an indicator of some software update from who knows what site" - you ask and I'll tell you "Fuck it twice". I really want to keep making money and strangle the computer help with 1 and then we'll see :-)