Question on iCustom

 

Hi

I ve got three indicator. indA, indB and indC.

The code following is what i m using in all of the three indicators. The key point is that they look back up to a N amounts of bars specified in the extern history variable.

extern int history=300;

...
..

start()
{
...
    counted_bars = IndicatorCounted();
    candles=Bars-counted_bars; // Index of the first uncounted

    if (candles>history-1)                 // If too many bars ..
    {
       candles=history-1;                       // ..calculate specified amount
    }
     
    while  (i<=candles)
    {
     ...............
     }
}


So, the case is that IndC is calling with an iCustom the IndB (eg iCustom(....,"IndB",500,0,i); ) and the IndB is calling with an iCustom the IndA (eg iCustom(....,"IndA",500,0,i); ).
Now my question is:
- While calling IndB (from IndC as i said above), if i set the iCustom history parameter in a X number(eg 1000, like iCustom(....,"IndB",1000,0,i); ), does this means that with this X number IndB will also call IndA and IndA will finally use X number to make calculations?

I m already almost sure that the answer is yes but just want to confirm cause mt4 sometimes acting strangely.

 
  1. You said "IndB is calling with an iCustom the IndA (eg iCustom(....,"IndA",500,0,i); )." Where does it get the 500 value in the iCustom call?

    If it is hard coded then your changing values in your iCustom is irrelevant.

    If it uses the value from it's own external variable, then your "answer is yes."

  2. //candles=Bars-counted_bars; // Index of the first uncounted
    candles=Bars-1-counted_bars; // Index of the first uncounted
    See Contradictory information on IndicatorCounted() - MQL4 forum
 
WHRoeder:
  1. You said "IndB is calling with an iCustom the IndA (eg iCustom(....,"IndA",500,0,i); )." Where does it get the 500 value in the iCustom call?

    If it is hard coded then your changing values in your iCustom is irrelevant.

    If it uses the value from it's own external variable, then your "answer is yes."


Thanks for your answer, it was very useful.

Ok so when its hard coded there is no problem, right?

Thanks for the correction in my code. So far var candles was ==1 (299 and then 1). Does this cause any redrawing? Or any fault in the backtesting?

Thanks

 
athanfx: Ok so when its hard coded there is no problem, right?

IndB (eg iCustom(....,"IndB",500,0,i); ) and the IndB is calling with an iCustom the IndA (eg iCustom(....,"IndA",500,0,i); ).

How should I know what you want? If you change the external to 999 and it's hard coded you get
IndB (eg iCustom(....,"IndB",999,0,i); ) and the IndB is calling with an iCustom the IndA (eg iCustom(....,"IndA",500,0,i); ).
 
WHRoeder:
How should I know what you want? If you change the external to 999 and it's hard coded you get


Yes i know that. It was just a wrong way of thinking. Its clear now. Thanks.

Reason: