Questions from Beginners MQL4 MT4 MetaTrader 4 - page 123

 

How do I add a value to the buy/sell condition if the RVI indicator for example: when two lines cross each other it opens a buy/sell order, but I want it to be not just a crossing, but if the crossing is above 0 Value ?

MM and MS are RVI indicator lines

  if (MM > MS && MoM < MS && MoM < MM)
   {
    OrderSend(_Symbol, OP_BUY, Lot, Ask, 3, Ask-SL*Point, Ask+TP*Point, "", Magic, 0, Red);
   }
  if (MM < MS && MoM > MS && MoM > MM)
   {
    OrderSend(_Symbol, OP_SELL, Lot, Bid, 3, Bid+SL*Point, Bid-TP*Point, "", Magic, 0, Red);
   }


 

Hello !

Can you tell me how to use the obj label to display a string of more than 64 characters?

 
Игорь:

Hello !

Can you tell me how to use the obj label to display a string of more than 64 characters?

Two obj labels side by side. The left one is aligned to the right edge, the right one to the left

 
novichok2018:

Can you explain this line of your code:OrderInfo arrstBuyOrderInfo[MAX_ORDERS_CNT], arrstSellOrderInfo[MAX_ORDERS_CNT]; Why doesOrderInfo have no brackets and no type?

OrderInfo is a data type. Just like int, double, etc. In this case OrderInfo is a structure. I gave an example of its declaration in my postof closing positions? Where? And maybe the function of closing positions with arrays should look somehow different? It is a bit complicated for me. Thank you.

So far we have considered only the first task - collection of information about working orders. The trade signal generation and trade actions execution are Tasks 2 and 3 respectively. We have not got to them yet.

The idea of information gathering is not to have to go through the entire list of orders again at every "sneeze". In a correctly written EA, this action is performed only once per iteration. Further on, we work only with the created data.

Вопросы от начинающих MQL4 MT4 MetaTrader 4
Вопросы от начинающих MQL4 MT4 MetaTrader 4
  • 2018.02.13
  • www.mql5.com
Если у Вас вопросы по MQL4, MT4, MetaTrader 4, пожалуйста пишите в этой теме. Особенно когда вопросы касаются торговых функций...
 
Aleksey Rodionov:

How do I add a value to the buy/sell condition if the RVI indicator for example: when two lines cross each other it opens a buy/sell order, but I want it to be not just a crossing, but if the crossing is above 0 Value ?

MM and MS are RVI indicator lines


The value of both lines should be compared to zero. Isn't it?

And it's not clear what MoM is.

 

there is this line from MQL5, MQL4 compiler complains about it, how can it be rewritten?

//--- set new color
   m_pixels[y*m_width+x]=(r<<16|g<<8|b<<0|255<<24) &0xffffffff;

//check operator precedence for possible error; use parentheses to clarify precedence   Canvas.mqh
 
Ihor Herasko:

OrderInfo is a data type. Like int, double, etc. In this case OrderInfo is a structure. I gave an example of its declaration in my posthttps://www.mql5.com/ru/forum/160587/page121#comment_6556328.

I understand your example correctly: The #define directive will substitute number 500 everywhere it meets MAX_ORDERS_CNT ? And why should a number be assigned a type?

And why cannot we just specify extern int cnt=500 ? And then there will be OrderInfo arrstOrderInfo[cnt], arrstBuyOrderInfo[cnt], arrstSellOrderInfo[cnt]; ?


Also: in your post on p122 it is not clear to me what is&arrstOrderInfo[],&nOrdersCnt and.n? Sorry if my questions seem silly - as it is, I'm trying to figure it out more on my own, although I'm having a bad experience.

 

Good afternoon

Please help me to upgrade my indicator

I need to add 2 buffers, "native" indicator draws an arrow (up or down) in the identification of the gap and gives a signal in buffer 6 or 7

I would like to have a buffer 8 and 9 where in the gap signal +1 (up) or -1 (down) 0 in the absence of

I tried to make it myself, but nothing works, I have no skills in programming

 
novichok2018:

Do I understand your example correctly? The #define directive will substitute the number 500 wherever MAX_ORDERS_CNT is encountered ? And why should a number be assigned a type?

Yes. And note that it will be substituted at the compilation stage and not during program execution.

And why cannot you just specify extern int cnt=500 ? And then there will be OrderInfo arrstOrderInfo[cnt], arrstBuyOrderInfo[cnt], arrstSellOrderInfo[cnt]; ?

No, because int cnt is the declaration of a variable. And a variable can change its value while the program is being executed. And static array's memory is not allocated during program's execution. The memory size should be known already at the compilation stage. In order to change the array's size during the program's execution, you need to use a dynamic array. Well, that's something for later, when you get used to static arrays.

Also: in your post on p122 it is not clear to me what is&arrstOrderInfo[],&nOrdersCnt and.n? Sorry if my questions seem silly - I'm trying to understand them myself, but I'm not very good at it.

I'll simplify the answer a bit to avoid confusion. The (&) sign indicates that the function argument can change its value at runtime and will return to where the function was called from, with a different value. In the case in question, the SaveOrder function can change the contents of the g_arrstBuyOrderInfo and g_arrstSellOrderInfo arrays as well as the g_nBuyOrdersCnt and g_nSellOrdersCnt variables.

 

Hello !

Can you tell me how to repaint the bars without using templates in mt4 !??

Or how to apply a colour scheme !??

Reason: