Results 1 to 5 of 35

Thread: Referencing Indior Arrays.

  1. #1
    Is it possible to mention an array that has already been initialized in an indior. Something similar to the iCustom feature passing the window index, indior buffer and name /range index.

    I have an indior that creates 6 buffers/arrays. Then I have a couple of different indiors that run duplied code to create maybe 2 or 3 of the very same buffers. What's working fine but I am discovering it can be expensive in functionality, the details of that I won#8217;t enter today.

    If I understand it correctly, iCustom, using its own parameters, actually runs the code ( in its ribbon) to create the desired return value, which is great but not what I want if my primary concern right now is performance.

    What I'm after is the ability to reference a particular collection of an indior that's ALREADY initialized. In this case the referencing will be from a different indior mounted in the same window. However, it would be useful if it could be retrieved from elsewhere since I have other indiors from separate sub windows that again duplie code to create 1 or two of the base indior's buffers.

    I have read through a lot of articles but not finding what I want. I don#8217;t think it#8217;s possible as surely this would be a nicely documented egy for partially overcoming the 8 buffer limit on each indior. (Why would they have that ?)

    Hmmm#8230;. Or am I answering my own question here8230; is the remedy to redesign my indiors to use a series of iCustom calls#8230;. Hmnmmmm#8230;. . Complex and likely beyond my newcomer programming skills.

    Any thoughts/tips or a critical #8220;NO#8230; it may#8217;t be done#8221; will be greatly valued. Sorry if this question has been addressed before and/or exhibits my own ignorance of MQL.

    Lots of thanks in advance to any replies.

  2. #2
    Verify your indiors are just calculating for candles which have shifted. Among the biggest performance killers are indiors which go through every candle every tick.

  3. #3
    Quote Originally Posted by ;
    Verify that your indiors are only calculating for candles which have shifted. Among the biggest performance killers are indiors which go through each candle each tick.
    Thank you for the answer .

    Yes, with counted_bars = IndiorCounted()
    ect ect.

    I love it is difficult to comment on code when I have none submitted.... However, I suppose I was just hoping there are a quick and effortless answer....

    YES .... You do it like this.

    I'm confident that the basic code is ok... I will post it if desired.... But I am confident the basic code is great because composed it .... hahahahah.

    The difficulty I'm having is much more theoretical than anything else... I'm finding that I'm dupliing a lot of code to replie a value that's already produced within an indior .... Wouldnt it be good if I could reference that value instead of running the code again and again.... Like I said .... My code is running good, but since I tweak it here and tweak it there experimenting with different indiors which use the same base inidior buffers... this question keeps coming up for me .... I want to spend hours trawling help files and articles here and at tsd to find out whether there is a solution to what I'm sure is a common problem.

    Basically .... Can an intialized array within an indior be referenced from a different separate indior.

    The indior in question is one that plots a basket of currency pairs as one currency pair . . .ie it sums that the HLOC of every currency pair and plots it as a candle.

    Maybe I'm not explaining it clearly enough. However, I cant think of a better way to explain it other than submitting pages and pages of code.


    ================================================== ==============
    fine here are some segments of this code that can help clarify what I mean .... I am able to post the indiors if desired but it would take some time as I have made quite a lot of modifictions into the basic basket indior that let me load different baskets quickly ... however I am sure you will see exactly what I mean in relation to the threads question.


    Int start()
    {
    int counted_bars=IndiorCounted();
    dual ch,cl,cb,coworkers;
    if(counted_barslt;0) return(-1);

    //-- last counted bar is going to probably be recounted
    if(counted_barsgt;0) counted_bars--;
    int pos=Bars-counted_bars;

    while (posgt;=0)
    {

    ch =gethigh(Pair1,Tperiod,pos) gethigh(Pair2,Tperiod,pos) gethigh(Pair3,Tperiod,pos)
    gethigh(Pair4,Tperiod,pos) gethigh(Pair5,Tperiod,pos) gethigh(Pair6,Tperiod,pos)
    gethigh(Pair7,Tperiod,pos)
    gethigh(Pair8,Tperiod,pos) ;

    cl = getlow(Pair1,Tperiod,pos) getlow(Pair2,Tperiod,pos) getlow(Pair3,Tperiod,pos)
    getlow(Pair4,Tperiod,pos) getlow(Pair5,Tperiod,pos)
    getlow(Pair6,Tperiod,pos) getlow(Pair7,Tperiod,pos)
    getlow(Pair8,Tperiod,pos);

    cb =getbid(Pair1,Tperiod,pos) getbid(Pair2,Tperiod,pos) getbid(Pair3,Tperiod,pos)
    getbid(Pair4,Tperiod,pos) getbid(Pair5,Tperiod,pos)
    getbid(Pair6,Tperiod,pos) getbid(Pair7,Tperiod,pos)
    getbid(Pair8,Tperiod,pos);

    co =getopen(Pair1,Tperiod,pos) getopen(Pair2,Tperiod,pos) getopen(Pair3,Tperiod,pos)
    getopen(Pair4,Tperiod,pos) getopen(Pair5,Tperiod,pos)
    getopen(Pair6,Tperiod,pos) getopen(Pair7,Tperiod,pos)
    getopen(Pair8,Tperiod,pos);

    ....
    These values are then passed into a succession of buffers and utilized to plot a candle.

    The called fuctions are under:-
    ....

    Dual gethigh(string c,int tf, int ni)

    if (StringLen(c) lt; 6) return(0);
    RefreshRates();
    dual chigh = iHigh(c),tf,ni)/MarketInfo(c,MODE_POINT);
    yield(chigh);

    dual getlow(string c,int tf, int ni)

    if (StringLen(c) lt; 6) return(0);
    RefreshRates();
    dual clow = iLow(c),tf,ni)/MarketInfo(c,MODE_POINT);
    yield(clow);


    dual getbid(string c,int tf, int ni)

    if (StringLen(c) lt; 6) return(0);
    RefreshRates();
    dual cbid = iClose(c),tf,ni)/MarketInfo(c,MODE_POINT);
    yield(cbid);


    dual getopen(string c,int tf, int ni)

    if (StringLen(c) lt; 6) return(0);
    RefreshRates();
    dual copen = iOpen(c),tf,ni)/MarketInfo(c,MODE_POINT);
    yield(copen);

    ================================================== =======


    So now assume I want to create an RSI indior or Stochs indior for your basket.... Rather than having to duplie code to replie the buffers for say ... the bid (such as RSI) .... Or the High, low, bid buffers (such as Stochs)

    can it be possible to Reference the Original Indior in say .... Sub Window1, indior= BasketBars, buffer1, array element 27 or anything.

    Hopefully you can see where I'm going for this. Is there something that I'm overlooking in overall MQL programming which could decrease all this redundant/duplied code I'm currently using.

    As I said .... My indiors are working fine .... However, I have this nagging feeling that I'm missing something which could make the entire thing SO simpler and maybe quicker.

    I love that having the ability to reference the original indior... wouldn't lead to much quicker performance in this case as both buffers ... from the orig and at the RSI basket indior are only modifiying the latest changed candles as you pointed out.... but theoretically .... Might it be possible.

    As the end result of the egy uses multiple timeframes for all 8 baskets, every period utilizes RSI and Stochs with each using 3 distinct periods .... Therefore, even though in 1 case the performance increase might be negligible , general it could be significant.

    Thank you for any help or hints.... I love it.

  4. #4
    I see what you are asking for and unfortunately you cannot mention the buffers out of a conducting indior. That would actually be fine, and MT4 is not about fine. LOL!

    Your only hope is the iCustom function at which it is possible to reference each of those buffers individually.

  5. #5
    Quote Originally Posted by ;
    I see what you're asking for and sadly you cannot reference the buffers out of a running indior. That would really be nice, and MT4 isn't about nice. LOL!
    Thanks .

    I didnt think so.

    Oh well .... At least Im not wondering.

    Cheers mate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.