Forum

Difference between two values of MA

Hi everybody, I just want to make that seem to be a simple calculation to obtain the difference beween two MA decimal Values. I want to substract like this : First Value - Second Value Here is my code: double CurFastMAValue= NormalizeDouble (fast_ma_buffer[ 0 ], 6 ); double LastFastMAValue=

How to close lowest position

Hi everybody, I'm a newby and i work with MT5. I'l developping my own EA and i need in somme situations to close only the lowest position. That mean i have to identify and select it and i don't know how to do that. Actually to close a position i use this : for ( int i= PositionsTotal ()- 1 ; i>= 0 ;

Store variable value to Array (MQL5)

Hello all, I need to store variable values into an array i tried : double AverageRSI=(MaxRSI+MinRSI)/ 2 ; //--- Copy Average values to buffer ArrayFill (average_rsi_buffer, 0 , 2 ,AverageRSI); But it doesn't work Can anyone help me

How to close all opened positions in profit for the current symbol

Hi everybody, A new challenge, i Need to close all the opened positions in profit, compliant with the minimum profit i want, for the current symbol only. I read some related topics on this forum but i can't make it work. Here is my code void CloseAllProfit() { double PositionProfit=

If conditions not respected

Hello Everybody I experienced several problems with my MQL5robot wich don't respect if conditions to open or close positions. Here is my code : //--- Logical to enter new position if (PosSellOpened== false && PosBuyOpened== false && PosSellOpened== false && CurRsiValue<rsi_high_treshold &&

Executing function only once per current bar

Hello everyone, I am a beginner in coding and with the MT5 language. I'm trying to develop a slightly evolved EA. I already managed to perform basic functions but now I am stuck. My problems are: In the OnTick function () I check the position opening condition four times, at defined times, during