Forum

How to make ensure that not more than one trade is taken per pair when multiple pairs are traded

I'll be putting my EA on several pairs at the same time which is something I'm doing for the first time. Usually with one pair its quite easy to manage using a check for PositionsTotal () Now I want to make sure that not more than one trade is taken per pair when trading with multiple pairs. How can

How can I programmatically enable and disable sounds for alerts

I know that alert sounds can be manually enabled and disabled through Tools>Options>Events in mt5. I am trying to figure out how I can play alert sounds only when specific conditions have been met. In all other cases alarm sounds should be off

How to extend rectangle till price passes both lower and upper values

I use the following code to draw a rectangle from one candle to another. bool drawRectangle( int candleInt, const double top, const double bottom, ENUM_TIMEFRAMES cDuration, color rectColor) { bool checkBarCount = true ; int useCurrDuration = PeriodSeconds (cDuration)/ PeriodSeconds ();

How can I set CopyRates for timeframe array elements

I am trying to find all consecutive timeframe pairs (for timeframes from M2 to H1) that preserve a candlestick’s upper wick for the duration of a week and keep updating the pairs regions drawn every 5 minutes. A rectangle will be drawn for the wick area. Let me explain further: This is the array of

How to search for candle patterns on lower timeframes contained within a single candle in MQL5?

Generally I know how to search for a pattern in lower timeframes between two datetime values. I need to do something a bit different now. How can I search within for patterns on lower timeframes within one candle? For example, say, I have an H1 bullish candle and I want to search for a candle

How can I check if candle highs and lows are the same within multiple timeframes using MQL5

From the image, I’ve marked the high of candle index (i) and low of candle index (i + 1). These candles are on the H1 chart. How can I search multiple lower timeframes within the two H1 candles to determine if there are similar consecutive candles that have the same price for the high and low as in

How to get Moving Average Cross price

I am writing an EA that uses crossing moving averages . I tell the crossing of moving averages in the following way: // if shift5MA > shift0MA if (shift5MAArray[ 1 ] > shift0MAArray[ 1 ]) { //if shift5MA < shift0MA VALID SELL if (shift5MAArray[ 2 ] < shift0MAArray[ 2 ]) {

how to expose hidden arrow objects from custom indicator in chart's objects list

I have an indicator that draws arrows on the chart as seen in the image below: I tried searching for the arrow objects in ' Object List' but there were no objects there. I also checked ' Object List>List All' menu. I guess the way that the indicator is written has hid them from the chart. How

How to use Candlestick Strength Indicator to access strength of a given bar in my EA

I found the indicator MS-Candle-Index ( https://www.mql5.com/ru/code/24254 please refer to the fixed SmoothAlgorithms.mqh at https://www.mql5.com/en/forum/321609 ). How I can use the indicator to access the strength value of the last closed candle (i.e index 1) of a given timeframe within my EA

How to determine if price returned to a certain region of values or not on a specific timeframe

My code below draws a rectangle based on certain conditions. I want to add another condition for drawing the rectangle. The rectangle is drawn from the open to the high of a bullish candle with index (i+1) as shown in the code. How can I tell if : price has already reentered the region price has