Forum

Data output is shifted by one day

void OnTick () { //Code should only be executed once per day (at the end of the day) static datetime oldtime; if (oldtime!= iTime ( NULL , PERIOD_D1 , 0 )) { stronger( "EURUSD" ); oldtime = iTime ( NULL , PERIOD_D1 , 0 ); } bool stronger( string Pair) // Function

How to equalize iterations for skipped Sunday bars?

Hi guys, Basically the indicator gathers data over the last x bars (given as length ). If the indicator is used on D1 it is supposed to ignore Sunday bars, hence the if-clause. I don't want to just skip the Sunday with continue but also still look back exactly x bars. So I add to length with

How to put the start & end date of a backtest into a variable?

...so that I can use that to name a csv-file which the EA produces. Is there already a built-in variable for that

How to test with 0 spread?

Hi, I don't want to test a certain strategy. More like to prove if an event1 leads to a certain outcome. Therefore I would like to run some tests but without any spread to not skew the result. Now it seems that a input of '0' in the relevant spread field in the strategy tester leads to the current

How to exit a void function early?

Hi, while a function can be exited with return(), how can I exit a void function after a certain condition is met and I don't wanna execute the remaining code in the function? Thanks

Little loop isn't working as it is supposed to :)

Hello, I am writing a script to loop over each day and collect certain data points like ATR(1) dependent on the day of the week and write it into a multidimensional array. So that I can do calculations on this array like the average ATR of all mondays and output the data into a csv file. So far so

Objects disappeared but reappear if I rename them

Hi, It's probably kind of a basic problem. I am coding a table with lot of objects to write different values. I don't know exactly what I changed but suddenly all objects disappeared, switching timeframes etc. didn't help. Then I found out that if I change the object name (add or delete one

Newbie question about array

How do I assign a variable into an array (if even possible)? The most obvious way doesn't work. string s = "hello" ; string test[]= {s, " sir" };

ATR indicator for a specific time range

Hi, I am a beginner in programming (know some phython basics and can write basic functions in mql4) and I would like to program an intraday ATR indicator for a specific time range. For example I want to have the ATR(5) of the NY Trading session from 1430pm to 2100pm. I think I would use a for-loop

Need help - Indicator got removed instantly

Hi, I am pretty new to programming and I worked through some first tutorials and now I thought I'd try out different things and see how far I would get. I want to make some market overview in a tabular style. I borrowed some code pieces from similar projects and now I just want do it step by step