Download MetaTrader 5

using build 670 and having brain fart - need help with iCustom in EA

To add comments, please log in or register
NeilG
65
NeilG  

Hi,

I'm stuck and would appreciate some assistance...

I'm trying to use iCustom in a EA.  I have to supply a shift as the last parameter of iCustom but I don't want to look at bars I've already processed.  I tried using the following:

void OnTick()
  {
   
   int counted_bars=IndicatorCounted();

Print("counted_bars=",counted_bars);
   if(counted_bars<0)
      return;
   if(counted_bars>0)
      counted_bars--;

... and then calling iCustom in a loop.  I assume because it is an EA, IndicatorCounted() returns -1 so the loop never enters.

How do I include iCustom in an EA and make sure I can send the proper shift value to iCustom?

Thanks,

Neil 

whroeder1
15326
whroeder1  
snafu4: make sure I can send the proper shift value to iCustom?
  1. You decide what the proper shift must be. E.g. MA cross would be 1 and 2. Constant.
  2. Then call it. Detailed explanation of iCustom - MQL4 forum
NeilG
65
NeilG  
WHRoeder:
snafu4: make sure I can send the proper shift value to iCustom?
  1. You decide what the proper shift must be. E.g. MA cross would be 1 and 2. Constant.
  2. Then call it. Detailed explanation of iCustom - MQL4 forum
... of course.  Thanks.  As I said, brain fart.
To add comments, please log in or register