So I read in basic terms that an Indicator shows you trends, MA's, etc. but that Indicator scripts do not (or maybe is was cannot) do trade.buy and trade.sell functions. You have to write an EA to do trades.
My questions is really this:
If I write an EA to do trades, I'd want to code in some indicators/triggers for the trades to kick in or not kick in. Should I start with one of the Indicator scripts and modify it to do trades or should I write the script as an EA script and copy the indicator code to get the indicators working in the EA script?
I'm just a little confused about the structure of the Indicator scripts vs the EA scripts.
So I read in basic terms that an Indicator shows you trends, MA's, etc. but that Indicator scripts do not (or maybe is was cannot) do trade.buy and trade.sell functions . You have to write an EA to do trades.
Personally, I like to do this: to test an idea (to visually evaluate the idea) - I am writing an indicator. If the idea is of interest - I write an adviser on this indicator.
In general, the main thing is first the idea, then the realization of the idea.
Can you drive in the ocean? Can you boat down the highway?
Don't try to do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)
Just get the value(s) of the indicator(s) into EA/indicator (using iCustom) and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting. Detailed explanation of iCustom - MQL4 programming forum #33 2017.05.23
I found a good explanation here: https://www.mql5.com/en/articles/496
This is a good explanation if you're new to MT5 programming like I am.