Forum

Clear instructions on how to get setup gmail email in MQL5 needed

I’ve seen a number of posts on setting up email here but none of them seems to give clear guidelines on the process. I am not sure exactly what each field in Options>Email should contain and how a simple email should be composed programmatically. I would really appreciate some help

Can’t find .mq5 and .ex5 files for my EA on a MacBook

I’ve never had the need to copy my EA from my MacBook till now. I want to test it out on a VPS . I went through to the expert folder and couldn’t find the files. I also tried creating new files and copying the code but that didn’t work. How can I get the files to appear in the Expert folder as that

how to convert double with zeros in front to integer?

I am trying to figure out how to convert a double that has zeros in front (eg, 0.0341 or 0.00020) to an integer (eg, 0.0341 to 341 or 0.00020 to 20). All zeros before the first non-zero digit should be dropped and the first non-zero digit to the last digit should form an integer

How to get double values to correspond to number of decimal places of a given pair?

I am doing a number of calculations involving OHLC of candles. I want all my calculations to be reduced to the number of decimal places that appear on a given pair. For example, GBPUSD shows chart prices to 5 decimal places (eg, 1.12333) so, I would want my double values to be formatted to 5 decimal

How can I find the smallest difference between two values for every pair?

Based on the pairs the smallest difference of two values may result in 0. 00001, 0.0001 or 0.001 and so on. For example, for GBPUSD with values 1.23434 and 1.23433, the difference is 0.00001 and for GBPJPY with values 164.712 and 164.711 the difference is 0.001. I have been manually doing the

How to get time when a rectangle is drawn to compare with candlestick times

I am using the following code to access a rectangle object manually drawn on a chart: void FindTradeInRect() { static datetime lastTime = 0 ; datetime currTime = iTime ( Symbol (), PERIOD_M1 , 0 ); if (currTime>lastTime) { for ( int i= ObjectsTotal ( 0 , 0 , - 1 )- 1 ; i>= 0 ; i--)

How can I start ENUM_TIMEFRAMES variables from a shift of specified minutes from their regular starting times?

I am working with the following array of ENUM_TIMEFRAMES elements: ENUM_TIMEFRAMES H1andBelowTFS[ 12 ] = { PERIOD_M1 , PERIOD_M2 , PERIOD_M3 , PERIOD_M4 , PERIOD_M5 , PERIOD_M6 , PERIOD_M10 , PERIOD_M12 , PERIOD_M15 , PERIOD_M20 , PERIOD_M30

How can I get the hour integer of datetime variable?

I have the following datetime variable: datetime candleTime1 = iTime ( _Symbol ,timeframes[i],j); and would want to get the hour integer for the candle in a way similar to what is done with MqlDateTime like this: MqlDateTime rightNow; TimeCurrent (rightNow); Print ( "Hour ="

How can I tell when I've reached the end of two nested for loops

This might seem quite trivial to some but I just can't seem to figure it out. I have a global variable 'bestMatch' that I keep updating within two for loops as seen in the relevant code below. How can I make sure both sets of nested for loops are have completed updating before I perform any further

How to make sure function only runs at specified interval and not when its initially placed on chart

In the code below I run a function every H4. But the issue is when I put it on the chart it runs immediately for the first time before it starts running every 4 hours. How can I fix this code so it runs only when the chart 4 hour duration ends? Please note that I've only included the most relevant