Profiling means collecting program parameters during its execution. During a profiling, the execution time and the number of calls of individual functions and program code lines are measured. With this tool, the programmer is able to find and optimize the slowest code sections. Profiling can be performed on the normal chart of the trading...
Mike Tanton: but there are 13 iCustom calls and they are only called once... so essentially that would not make a difference
They are not called once, or else the EA would never open orders (except perhaps on initial tick.) They are called per bar or per tick. We can't see your broken code.
Mike Tanton: Is it better (faster) to structure - getting -the values of my Global Variables like this:
You aren't using the arrays except for intermediate storage. Not in loops. No need for them.
Value_1 = iCustom(Symbol(),0,Etc1.,0,i);
But again, you don't care about a few milliseconds. Your CPU usage is elsewhere. We can't see your broken code.
EAs : Don't do per tick that you can do per
bar, or on open.
If you are waiting for a level, don't reevaluate, wait until
price reaches it (or a new bar starts and you recalculate.)
If you are waiting for an order to open or close, only look when
OrdersTotal has changed.
How to get backtesting
faster ? - MT4 - MQL4 programming forum
lippmaje:
uint ticks=GetTickCount();
...code to profile
ticks=GetTickCount()-ticks;
Print("code used ",ticks," ticks");
The editor → debug has its own profiler.
lippmaje: And using NULL instead of Symbol() is a tad faster.
Agree.
Don't use NULL.
You can use NULL in place of _Symbolonly in those calls
that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not.
Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as
possible and more efficient.
Most of the cycles will be used by iCustom. Try to minimze the calls to it.
Thanks Lippmaje, but there are 13 iCustom calls and they are only called once... so essentially that would not make a difference
Without code it's just speculation, as you see. You can profile your code by counting how many ticks have passed:
If it's below ~16 you need to scale it up (call the code in a for loop or so) to get more precise figures.
And using NULL instead of Symbol() is a tad faster.
Without code it's just speculation, as you see. You can profile your code by counting how many ticks have passed:
If it's below ~16 you need to scale it up (call the code in a for loop or so) to get more precise figures.
And using NULL instead of Symbol() is a tad faster.
Thanks for the info... I'll have a good look at it...
They are not called once, or else the EA would never open orders (except perhaps on initial tick.) They are called per bar or per tick. We can't see your broken code.
Array_1[15,1];
Array_1[i,0] = iCustom(Symbol(),0,Etc1.,0,i);
Value_1 = Array_1[i,0];
Stop capitalizing Global Variables. That is the name of Global Variables of the Terminal
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor
EAs : Don't do per tick that you can do per bar, or on open.
If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts and you recalculate.)
If you are waiting for an order to open or close, only look when OrdersTotal has changed.
How to get backtesting faster ? - MT4 - MQL4 programming forum