Greetings, all. I am in the process of trying to construct my first EA, and I have what I am guessing is probably a simple question.
As I understand it, the EA "start ()" function is executed on every tick, correct?
Do the built-in indicators also get updated on every tick so that I may compare them and take appropriate action? For instance, my EA is designed for an hourly timeframe, but I would like the EA to be able to trigger a buy or sell at any time WITHIN that hourly timeframe, not just at the close of the bar, if my indicators give such a signal.
Put another way, will a function such as this work:
Thanks for any help you can provide.
As I understand it, the EA "start ()" function is executed on every tick, correct?
Do the built-in indicators also get updated on every tick so that I may compare them and take appropriate action? For instance, my EA is designed for an hourly timeframe, but I would like the EA to be able to trigger a buy or sell at any time WITHIN that hourly timeframe, not just at the close of the bar, if my indicators give such a signal.
Put another way, will a function such as this work:
Inserted Code
if (ADXcrossed()) { // Take some action } // Function tests whether ADX crossed from below 30 to 30 or above int ADX_crossed() { static double previousADX; double currentADX = (iADX(NULL,0,14,PRICE_CLOSE,MODE_MAIN,0); if ((previousADX < 30) && (currentADX >= 30)) return 1; previousADX = currentADX; }
Prices are never too high to begin buying or too low to begin selling.