Re: Supertrend indicators for MT4

171
rogerha wrote: Thu May 27, 2021 3:16 am Actually investigating this further, it is specifically the iCustom call to SuperTrend that is causing the problem. It is coded to make the call once every new bar, and like clockwork, every time it makes that call, the memory usage increases until of course it cannot increase any more. I also make some calls on another custom indi, and that doesn't do the same thing. If I disable the Supertrend call from my code, then they memory usage remains constant. Is there anything in the SuperTrend indi that might not play nicely with iCustom ?

My Code is very simple:

Code: Select all

 if ( iCustom(NULL,0,"!SuperTrend cci (arrows + alerts + candles)",60,"Close price",60,"Display line(s)",true,LimeGreen,Orange,1,LimeGreen,Orange,3,Linen,Green,Crimson,8,Linen,Lime,Orange,4,false,false,false,false,false,false,"alert2.wav",true,2,2,"Up in a circle type arrow","Down in a circle type arrow",0.5,0.5,LimeGreen,Orange,5,1) < 9999999 &&
        iCustom(NULL,0,"!SuperTrend cci (arrows + alerts + candles)",60,"Close price",60,"Display line(s)",true,LimeGreen,Orange,1,LimeGreen,Orange,3,Linen,Green,Crimson,8,Linen,Lime,Orange,4,false,false,false,false,false,false,"alert2.wav",true,2,2,"Up in a circle type arrow","Down in a circle type arrow",0.5,0.5,LimeGreen,Orange,5,2) > 9999999 ){
            SuperTrend=1;
            }
Thanks in advance to people.
One thing i don't understand is what is the <> 9999999? Never seen that before.


Re: Supertrend indicators for MT4

172
mrtools wrote: Thu May 27, 2021 4:08 am One thing i don't understand is what is the <> 9999999? Never seen that before.
Well MrTools - I don't have your skill but I noticed that when that particular buffer value goes 'blank' in the data window that it isn't actually zero, but seems to be something like 'infinity' ie. A massive number, So it either has a value of the super trend line or this massive number...... It seems to work, but just this memory leak is a pain..

Re: Supertrend indicators for MT4

173
rogerha wrote: Thu May 27, 2021 4:25 am Well MrTools - I don't have your skill but I noticed that when that particular buffer value goes 'blank' in the data window that it isn't actually zero, but seems to be something like 'infinity' ie. A massive number, So it either has a value of the super trend line or this massive number...... It seems to work, but just this memory leak is a pain..
Don't worry not questioning your skill at all, just am always learning, was wondering what that was. Might recheck you iCustom calls also the main trend buffer for that is #17 and if = 1 upTrend and =-1 dnTrend.
These users thanked the author mrtools for the post:
rogerha

Re: Supertrend indicators for MT4

174
mrtools wrote: Thu May 27, 2021 4:35 am Don't worry not questioning your skill at all, just am always learning, was wondering what that was. Might recheck you iCustom calls also the main trend buffer for that is #17 and if = 1 upTrend and =-1 dnTrend.
Oh that's good to know, thanks MrTools, will take a look at that and see if it improves things. Appreciate your time.

Re: Supertrend indicators for MT4

175
For anybody that might be interested at a later date, I resolved the memory leak with replacing the code earlier in the thread with the code below and calling the iCustom as an Integer. If I am honest - I have only a little understanding as to why that may have fixed the problem - but it may help somebody else down the line. Thanks again for the pointers @Mrtools.

Code: Select all

   int SupTrendNew = iCustom(NULL,0,"!SuperTrend cci (arrows + alerts + candles)",60,"Close price",60,"Display line(s)",true,LimeGreen,Orange,1,LimeGreen,Orange,3,Linen,Green,Crimson,8,Linen,Lime,Orange,4,false,false,false,false,false,false,"alert2.wav",true,2,2,"Up in a circle type arrow","Down in a circle type arrow",0.5,0.5,LimeGreen,Orange,17,1);
   int SupTrendOld = iCustom(NULL,0,"!SuperTrend cci (arrows + alerts + candles)",60,"Close price",60,"Display line(s)",true,LimeGreen,Orange,1,LimeGreen,Orange,3,Linen,Green,Crimson,8,Linen,Lime,Orange,4,false,false,false,false,false,false,"alert2.wav",true,2,2,"Up in a circle type arrow","Down in a circle type arrow",0.5,0.5,LimeGreen,Orange,17,2); 
  
   
   if (SupTrendNew==1 && SupTrendOld==-1){SuperTrend=1;}
   if (SupTrendNew==-1 && SupTrendOld==1){SuperTrend=0;}
   
EDIT: Further testing and it hasn't fixed - continuing to research.


Re: Supertrend indicators for MT4

180
mrtools wrote: Sun Jan 31, 2021 1:25 pm Added it as an option on this version.

PS: For the Histogram version of the new Supertrend, please see here: Supertrend Averages (New Format) Histogram MT4.
hi, mrtools , is it possible to add standard error and standard deviation in addition to ATR. thank you inadvance


Who is online

Users browsing this forum: Bing [Bot], DVanAssen, Energybias, kvak, Rabi, Ruby [Bot], sunmetal, Telegram [Bot], TheJurgFX and 105 guests