Forum

Need your idea how to reset bool flag when a new bar is formed

Hi, I need some ideas. I want to reset a flag when a new daily bar is formed. The problem is that sometimes, when a new daily bar is formed, the MT4 server stops, and the flag doesn’t reset. Is there any way to solve this? datatime Day_Open_Time; if (TimeDay( TimeCurrent ()) !=

How to get longer TF price data from shorter TF?

I want to get candle price data with iHigh and iLow. When I backtest EA in TF H1 and try to read TFM5 price data, but I can not. double price = iHigh ( NULL , 5 , 0 ); If I run this code in TFH1, why I can not get data

How to move Text layer from the label laler ?

Hello, I put text label on the chart and also put label (white painted) on the chart. But yellow text label is under the label and I can not read it. How to move the text above the white label? Is it z-order to solve the issue

How to know daily closed profit

Hi, I want to know today's closed total profit.(whole account) Here is the code. However, when I open a new account and run the EA, it shows as same as account balance like below picture. This is because there is no closed profit today? Do I need to add some code ? double ProfitDey( int type) {

How to sort the value using ArraySort except zero data?

Hi, I want to sort the Array. but I want to sort except zero (0). Is it possible with ArraySort code ? double Array[ 7 ]={ 0 , 3 , 0 , 2 , 4 , 1 , 5 }; ArraySort (Array); I want to get below. Array[7] = {5,4,3,2,1}

Order modify error 1 in Break Even code.

I coded a break even code. But when I run it, sometimes it shows order modify error 1. I just want to move stoploss to zero(0) but I tried to use = 1 to avoid order modify error1 Can you advice where the problem? extern int MoveToBreakEven= 2 ; //BE_Start Pips void BreakEven() { int exitTypePer

How to use MathPow function

Hi, I am happy if you can tell me about exponent . Value = 2^3 = 2x2x2=8 Below is the code double Value = MathPow ( 2.0 , 3.0 ); But I want to know below. How can I know x=3 with mql4 code

I want place an order at the beginning of a new candle in Renko chart.

I am testing some order code in Renko chart. What I want is to place an order at the beginning of a new candle. In normal chart it is OK, but when I use Renko chart. I observed many entry on the same candle. Do you have any solutions ? if (lastAlertTime != Time[ 0 ]) { OpenOrder here

How to count 30sec after bool flag=true

Hi, I just want to ask for your useful idea. If flag becomes true, I just want to count 30sec, After 30sec, then I want to delete object. I tried to use Sleep (30000), but this sleep time stop other program in EA, so I don't want to use it. Do you have any good idea ? bool flag; If (some event

I just want to know how to recognize the rectangle object.

I just want to know how to recognize the rectangle object is on the current bar. Is it possible to know the rectangle is overlapping on the current or previous bar? This is to use buy and sell entry signal