Forum

Basic question about how many bars to copy when using CopyBuffer in an EA.

I need a large number of bars (E.g. 1000) of indicator data in my EA. When the EA starts, obviously it will then need to copy 1000 bars from the indicator in an array. On subsequent ticks (or in my case, subsequent bars, since it is stopped from doing the copy every tick), should I copy 1000 bars

Bars() returns 0 when called on first execution of indicator after the terminal starts, but not on subsequent executions.

I use the number of bars on the chart as a limit to a loop iteration. If the indicator is already loaded on the chart when the terminal starts, Bars() returns 0, and my code fails. If I remove and then replace the indicator on the chart, it returns the correct number and my code succeeds. Why is

static array in a class -> unresolved static variable

I am trying to create a class to hold variables related to various ongoing potential trade setups. A new Trade_Setup object is created each time a support/resistance level is approached/breached. To avoid adding multiple setups at the same level, I want to save the levels that have ongoing analysis

DRAW_FILLING type indicator buffers mixed up?

I am trying to get my indicator, to, among other things, display the next likely support and resistance levels as a coloured band. The buffers placed above the DRAW_FILL declarations behave as expected, and the support levels display, but not the resistance levels. The values are correctly set in

xxx bytes of undeleted memory when returning an object pointer

I needed ti return a collection of results from a function , and so in the absence of tuples I chose to return a CArrayInt object pointer. As I am returning it though, I cannot delete it before doing so, and so end up with the xxx bytes of undeleted memory message. What is the solution to this

Comment Hotkeys

Perhaps this is a peculiarity of my setup, but I cannot get the comment and uncomment hotkeys to work. If I select the command from Edit->Advanced->Comment it works, but not the combination of Ctrl+'. I am using a UK English keyboard on Windows 8. Is there a trick to this or are they broken

"XXX bytes of leaked memory" "YYY objects of type DbleLess left" "ZZZ undeleted objects left"

I am getting messages of "XXX bytes of leaked memory" "YYY objects of type DbleLess left" "ZZZ undeleted objects left" The function is called from the main OnStart() loop. I thought I was deleting the objects - so why the memory leak? void UpdateNearestLevels( int SupOrRes, const int Bar, double &

How can I use either < or > (or other comparative operator) in an expression depending on a function input?

I have two longish blocks of code that are identical except in various comparative statements '>' is switched with '<', '>=' with '<=' etc. I wanted to put these in a function and use one operator or another depending on a function input. In C++ I could create a comparator function for each

Control the price labels on vertical axis

is there a way to set MT5 so that only multiples of X (say, 5 pips) are displayed on the vertical price axis, as opposed to the seemingly random multiples displayed currently

Bars() always returning zero.

No matter what I do I can't seem to get Bars to return the number of bars between two times. Please could someone tell me what is wrong with the code below. This is run as a script just to test. void OnStart () { datetime OpenTime[ 10 ]; if ( CopyTime ( _Symbol , _Period , 0 , 10 ,OpenTime)==-