Forum

How to trim to i.e. 2 decimal places in the Data window?

in Indicator Data window,the numbers (after dot) show bunch of zeroes: i need to be shown there only 2 decimals after dot. used this function , but still doesnt help, there are still ZEROes shown... double RoundNumber(double number, int digits) { number = MathRound(number * MathPow(10, digits));

What difference between iHigh and High ?

does it matter if i use High[0] or iHigh(NULL,0, 0) in EA ? why iHigh is widely-used way

How to retain local value of variable?

I know, that in some cases non-buffered variables are lost. for example static int MyVariable = 0 ; ...... MyVariable = (Condition ? MyVariable+ 1 : MyVariable ); ...... but in some cases i found (when something changed on chart or input or etc.. without refreshing the chart F5 ), the value of

how get programs version in MQL?

for example, i want to have a condition like this; if (ThisIsMT5) then do1(); else do2(); how can i automatically determine if running platform is MT5 or MT4 (mql5 or mql5)

difference between offset and index

can anyone tell me what's difference between: iMA(NULL, 0, MY_LENGTH, 2 , MODE_EMA, PRICE_LOW, i ); iMA(NULL, 0, MY_LENGTH, 0 , MODE_EMA, PRICE_LOW, i+2 ); dont they return the same value? why does offset exists at all, as we can just put i+2 in index

what is "SetLevelValue"

hi, can someone tell me what does this function ? https://docs.mql4.com/customind/setlevelvalue i have SetLevelValue ( 0 , 50 ); SetLevelValue ( 1 , 68 ); SetLevelValue ( 2 , 32 ); and get such image: i cant understand how they act

How to write to C disk directly?

hi. with FileWrite, it only writes into application storage direcory (in C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\50CA3DFB510CC5A8F28B48D1BF2A5702\tester\files\ ) However, when doing int file_handle=FileOpen("C:/file.txt",FILE_READ|FILE_WRITE); it doesnt create a file there. why

Why EA is not executed during other minutes?

I frequently meet such situation. On chart, there is available 24 hours datafully, but from EA (i inserted "Print"), it seems it is only executed only on specific times, and WHY? what happens

How do you check CLOSE in EA?

Hello. I use script to force the EA to run once on every bar start. ..... if( Now == Time[0]) { return; } .... However, in my EA, let's say, Trade happens if CLOSE>OPEN of the bar (i dont matter ticks)... however, the EA is executed only on OPENs of bars... what is the solution? how can i get the

Any way to detect if current scope is EA or Indicator?

Hi. I want to have a variable/code in my library, that will tell if current script (it is used in) is EA or INDICATOR... what code can be used