You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
The first three are symbol, timeframe, name ... the last two are mode and shift. Whatever extra values are there are passed as input.
Obviously I am not making myself clear.
Can I detect "int shift" in my indicator?......so I can add it to my internal indicator values.
-Stan
No, the Expert just "looks" at the indicator and picks the shift'th value (from the ExtMap buffers).
Usually an indicator when added to a chart computes it's values for all the bars. When the ticks come in, MT calls the indicator to compute the most recent bar (or most recent two bars or such). On a new bar, it just moves all values down the buffers (so that the old values remain aligned to the bars for which they were computed) and then you are called again to compute bar 0.
The main part of an indicator to do this is usually something like this:
On the first call (when attaching the indicator to a chart), IndicatorCounted() will be zero, so this way your indicator always fills the Buffers for the whole chart with their values. When new Ticks come in, IndicatorCounted() will be 999 (on a chart of 1000 bars), this means that you don't need to recalc the first 999, just do the current values for bar 0.
On an indicator with a Print as above, you will see this on the output (Experts or Journal tab).
This is done internally by MT. The first iCustom() call adds your indicator to a virtual chart with the given ("...") parameters and then lets it compute it's stuff as on live trading, feeding ticks and telling it what to recompute through the IndicatorCounted() call.
When you call iCustom() with a shift value, it just picks the shift'th value from the mode'th buffer and returns it to your expert. In other words, your indicator is not called for every iCustom call. It is called on a new tick, fills it's buffers and iCustom() just picks the value form the buffers as a human would look at the indicator lines for different bars.
The code snippet above also has a check that the indicator would never compute more than 10 bars when called from an expert. However, this means that your expert should never use an iCustom() call with a shift higher than 10, or it will get an unset value.
If you want a real function call (with control over when and how the indicator is called), you'll need to put it into a function, probably in an .mqh file and #include the function in your indicator and also in the expert.
Hope this will make sense.
Markus
Hope this will make sense.
It does make sense Markus, with exception for "FromExpert" variable.
How is it set and cleared?
If from External Input than it would be set only once and remain set even if I would disable expert on the Top Menu Bar.
Markus