Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 311

 
PGM5:


and it is necessary to delete the closest order at the opening of one of the positions, because at this moment there may be other orders - far away from the current price

i can use an open positions counter + script to delete an order (if i'm thinking correctly, i don't know how to do it, i'm just getting started) Thanks in advance for the information.


Please learn the terminology, it's a real problem to understand what you need.

You place two pending orders, if one opens, you have to delete what?

This is a nice concept, the nearest order is in the direction of the open position or against it, or are you saying that you have to delete the opposite pending order?

Are there any other orders - where do they come from, from manual trading? From the same Expert Advisor, but open in different conditions?

Do you need a specific answer or is it as vague as the question? (Spend an extra minute formulating your question - it will help everyone)

 
ALXIMIKS:

Reading these lines I remember how I myself have been reproached for being illiterate in my posts, or rather lazy, and now I am even more aware of my wrongdoing.

1) what is a drawing machine? (as you understand it)

2) what is an elementary function to search for MACD divergence?

3) is it so difficult to write "divergence" in a search engine and select the third link in the "Code Base" category?

(If you hope that somebody will give you a ready-made tool and explain everything - hope, there are different people here: both believers and not so much)



I hope you know what proxemics is! Do you think the forum is for metaphysics?

The drawing tool - with the output on the chart.

The elementary functions are the functions that can be applied using only the MQL4 textbook, without using complex expressions.

How to use the indicator buffers when detecting the MACD divergence:

how to understand it?

for(i=limit-1; i>=0; i--) 
     {
      BufferMacdMain[i]   = iMACD(NULL, 0, macd_fast, macd_slow, macd_signal, PRICE_CLOSE, MODE_MAIN, i);
      BufferMacdSignal[i] = iMACD(NULL, 0, macd_fast, macd_slow, macd_signal, PRICE_CLOSE, MODE_SIGNAL, i);
      BufferMacdOsMA[i]   = BufferMacdMain[i] - BufferMacdSignal[i];
      BufferTop[i]        = EMPTY_VALUE;
      BufferBottom[i]     = EMPTY_VALUE;
      BufferCross[i]      = EMPTY_VALUE;
 
      double main2 = BufferMacdMain[i + 2];
      double main1 = BufferMacdMain[i + 1];
      double sig2  = BufferMacdSignal[i + 2];
      double sig1  = BufferMacdSignal[i + 1];
 
      if((main1>=sig1 && main2<sig2) || 
         (main1<sig1 && main2>=sig2))
 
Burger:


I hope you know what proxemics means! Do you think this forum is just for metaphysics?

Drawing - with output to a graph.

Elementary functions are functions which can be applied using only MQL4 tutorial, without using complex expressions.

How to use indicator buffers when detecting the MACD divergence:

how to understand it?


Firstly, find out what divergence is and how many values are needed to determine it. Here with examples.
 
Burger:


I hope you know what proxemics is! Do you think the forum is for metaphysics?

Drawing - with output to a graph.

Elementary functions are functions which can be applied using only MQL4 tutorial, without using complex expressions.

How to use indicator buffers when detecting the MACD divergence:

how to understand it?


This is not a club of psychics; if you want adequate answers, ask adequate questions. If you don't know how to phrase it, go in from afar, but so that it is clear and you don't have to ask a hundred times over what a particular individual means by this or that term.

Elementary functions are functions that do not use complex expressions. Awesome.

The code without closing loop brackets, without functions after a condition - what are you hoping for?

for(i=limit-1; i>=0; i--)      //цикл  расчета нерассчитанных баров, наверное
     {
      BufferMacdMain[i]   = iMACD(NULL, 0, macd_fast, macd_slow, macd_signal, PRICE_CLOSE, MODE_MAIN, i);   // расчет значения основной   линии масд на i баре
      BufferMacdSignal[i] = iMACD(NULL, 0, macd_fast, macd_slow, macd_signal, PRICE_CLOSE, MODE_SIGNAL, i); // расчет значения сигнальной линии масд на i баре
      BufferMacdOsMA[i]   = BufferMacdMain[i] - BufferMacdSignal[i];  // разница основной и сигнальной линии масд на i баре
      BufferTop[i]        = EMPTY_VALUE;                              // буфер заполняется EMPTY_VALUE на i баре (не рисуется на графиках)
      BufferBottom[i]     = EMPTY_VALUE;                              // буфер заполняется EMPTY_VALUE на i баре (не рисуется на графиках)
      BufferCross[i]      = EMPTY_VALUE;                              // буфер заполняется EMPTY_VALUE на i баре (не рисуется на графиках)
 
      double main2 = BufferMacdMain[i + 2];                           // переменная берет значение основной линии масд на i+2 баре с массива BufferMacdMain
      double main1 = BufferMacdMain[i + 1];                           // переменная берет значение основной линии масд на i+1 баре с массива BufferMacdMain
      double sig2  = BufferMacdSignal[i + 2];                         // переменная берет значение сигнальной линии масд на i+2 баре с массива BufferMacdSignal
      double sig1  = BufferMacdSignal[i + 1];                         // переменная берет значение сигнальной линии масд на i+1 баре с массива BufferMacdSignal
 
      if((main1>=sig1 && main2<sig2) ||                      // если main1>=sig1 и main2<sig2 тогда будет выполнятся условие (сигнальная пересекает основную снизу вверх)
         (main1<sig1 && main2>=sig2))                        // если main1<sig и main2>=sig2 тогда будет выполнятся условие  (сигнальная пересекает основную сверху вниз)
 
ALXIMIKS:


Please learn the terminology, because understanding exactly what you need is a real challenge.

You place two pending orders, if one opens you need to delete which?

Nearest order - a wonderful concept, is the nearest order in the direction of the open position or against it, or are you saying that the opposite pending order should be deleted?

Are there any other orders - where do they come from, from manual trading? From the same Expert Advisor, but open in different conditions?

Do you want a specific answer or is it as vague as the question? (Spend an extra minute to formulate your question - this will benefit everyone).

Yes, you got it right: when you open one order you have to delete the opposite pending order, the other orders are from the same EA, but opened under different conditions

Thanks in advance.

 
PGM5:

Yes, you got it right: when you open one order you have to delete the opposite pending order, the other orders are from the same EA, but opened under different conditions

Thanks in advance.


If I understood correctly what you want: this mechanism is called OCO (One Cansel Other - one cancels the other). This is the relationship between, for example, a take and stop for a "market order" (in MT4 terms) - one (take or stop) is triggered, the other is automatically deleted and the full implementation of this is not such a trivial task. Not in the sense of a very complex algorithm, but in the sense that it is not elementary. We have to write parallel accounting of orders: enter and track the trait by which the orders are linked. If I'm not mistaken, such a mechanism has not been implemented in MT5 either although it is a standard feature for stock terminals and works on the server side.

We can implement the mechanism on the client's side and "play with" the magician (it would be "not very" difficult in this case): all orders of which one must remain have the same magician. When checking: if there is a market one, all others are deleted. Then a magik needs to be generated, accompanied. Allocate a separate array for the magician: more than one pair of orders may have to be supported. It is impossible to lose a magik, hence either global variables or writing to the file. If we pay attention to more global data (considering not only order connectivity but also belonging/foreign), the accounting mechanism becomes more complicated: the magician becomes compound and actually we need to extend the standard algorithm of placing orders much deeper than we can do using "basic" (in your terminology) functions but anyway everything is client-side: i.e. if the terminal is shut down or communication is lost, the terminal will not work (keep track of orders).



 
VladislavVG:

If I understand correctly what you want: this mechanism is called OCO (One Cansel Other - one cancels the other). This is the relationship between, for example, a take and stop for a "market order" (in MT4 terms) - one (take or stop) is triggered, the other is automatically deleted and full implementation is not such a trivial task. Not in the sense of a very complex algorithm, but in the sense that it is not elementary. We have to write parallel accounting of orders: enter and trace the trait by which the orders are linked. If I am not mistaken, such a mechanism has not been implemented in MT5 either although it is a standard feature for stock terminals and works on the server side.

Although, we can implement the mechanism on the client's side and "play with" the magician (it will be "not very" difficult in this case): all orders of which one must remain have the same magician. When checking: if there is a market one, all others are deleted. Then a magik needs to be generated, accompanied. Allocate a separate array for the magician: more than one pair of orders may have to be supported. It is impossible to lose a magik, hence either global variables or writing to the file. If we do this in a more global way (considering not only order connectivity but also belonging/foreign), the accounting mechanism becomes more complicated: the magician will become compound and actually we need to extend the standard algorithm of placing orders much deeper than we can do using "elementary" (in your terminology) functions but anyway everything is client-side: i.e. if the terminal is shut down or connection is lost, it will not work (track orders).



Sorry, didn't know it was so complicated. I will think about how to simplify the system.

 
PGM5:

Sorry, I didn't realise it was so complicated. I will think about how to simplify the system.



To help.
 
r772ra:
To help.


This is only a very "modest" implementation which is not extensible: it deletes all orders of the EA or all orders of a given wizard for a given symbol if there is a market one. That is, it considers all orders placed on the instrument (with/without taking the magician into account) to be linked by the CCA ratio.

This may not be the case at all. For example, there may be 2 or 3 groups of linked orders out of 20 placed, and the rest are not linked at all. This EA cannot be expanded to such accounting - we have to rewrite everything or we can use this EA in manual mode: then the accounting of masters of linked order groups has to be done manually and we have to "hang" as many EAs as there are groups of orders in a trade.

 
VladislavVG:


This is just a very "modest" implementation that can't be expanded: it deletes all orders of the EA or all orders of this magician for this symbol if there is a market one. That is, it considers all orders placed on the instrument (with/without taking the magician into account) to be linked by the CCA ratio.

This may not be the case at all. For example, there may be 2 or 3 groups of linked orders out of 20 placed, and the rest are not linked at all. This EA cannot be expanded to such an accounting - we have to rewrite everything or we can use this EA in manual mode: then the accounting of masters of linked order groups has to be done manually and we should "hang" as many EAs as there are groups of orders in a trade.



Hi. How about removing everything else and leaving only this:

First two orders are set: buystop and sellstop orders with takeprofit only . Then when one of them is opened, the second one is deleted. The same pair of orders is also placed again. And again, when one of them opens or when takeprofit triggers, the same pair of orders is set. This is such a cycle.

Thank you in advance.

Reason: