Elite indicators :) - page 157

 

It will work

You might use something like if (previousNumberOfBars != Bars) or if (volume[0]==1) but the volume usage is sensitive (leaves much more space for error, and almost sure that on first execution it will not calculate all the necessary bars, since the volume is already going to be > 1)

What I would recommend in any case is to invert the first two lines of the loop, to become something like this :

if(lastbar != Time[0])

{

for(int i=limit; i>=0; i--)

{[/php]You need to check that condition only once

regards

mladen

Snowski:
Quick coding question:

If I want an indicator to start its calculation on the open of a new bar, how can I code this?

I now have this - just an example, but I doubt it's correct:

[php]

datetime lastbar;

double buffer_a[];

double buffer_b[];

//+------------------------------------------------------------------+

//| Custom indicator iteration function |

//+------------------------------------------------------------------+

int start()

{

int bars_counted = IndicatorCounted();

if(bars_counted < 0)

{

return(1);

}

bars_counted--;

int limit = Bars - bars_counted;

if(limit>BarsToLoad && BarsToLoad>0)

{

limit = BarsToLoad;

}

for(int i=limit; i>=0; i--)

{

if(lastbar != Time[0])

{

buffer_a = iMA(Symbol(), 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, i);

buffer_b = iMA(Symbol(), 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, i+1);

//LONG ARROW

if(buffer_a > buffer_b)

{

ExtMapBuffer1 = Open - distance;

}

//SHORT ARROW

if(buffer_a < buffer_b)

{

ExtMapBuffer2 = Open + distance;

}

lastbar = Time[0];

}

}

//----

return(0);

}

//+------------------------------------------------------------------+
 

Yep, of course, switch the loops...much better.

Which method you reckon is most accurate, the if(previousNumberOfBars != Bars) orif(lastbar != Time[0]) option..?

I personally see no obvious difference at first glance, but I may be wrong. I do agree on the Volume option, not good for indicator, might work OK in EA.

Thanks alot mladen, great help to my rather poor indie coding skills...

Cheers,

San.

 
chris1010:
Mladen or Mr Tools would it be possible to add a pop up and email alert to this one, please? It seems to me that when all lines in the indicator window are together at the same time at the very top of the indicator window or the very bottom of it a good buy or sell point is identified. Thank you for any help. Chris

Here you go Chris since the market now closed not able to test the alert live but got alert to pop up on 1 minute chart so hopefully it should be ok, alert should go off when wso and wro are both at user selectable buy or sell levels. And agree with you this indicator when both lines are either at max or min seems to be good sell and buy opportunities.

 

Mr Tools. Thank you. It's cool to have great programmers help me out.

 

San

Frankly, I do not know which one to recommend.

Barsis a kind of internal metatrader variable of a current chart and Time[0] is an element of an array structure describing every single bar it has in its history for the current chart. My guess is that first Bars is updated to reflect the new array size, and that then the newly added structure to the array is updated with data (time, "volume" and prices) But if they do it in a "sequential manner" (not allowing other threads execution till the code execution is finished - and I am almost 100% sure that it is the way it is done - as far as I figured out there is always a separate thread that is downloading data and managing all the thing we are talking about, and all of us noticed a "pause" in execution when we open a new chart and more data is downloaded and added to arrays and variables and charts we then use from metatrader code) then both variables are going to be visible to a user at a same time ... Access time should be the same ... So : all the same

regards

mladen

Snowski:
Yep, of course, switch the loops...much better.

Which method you reckon is most accurate, the if(previousNumberOfBars != Bars) orif(lastbar != Time[0]) option..?

I personally see no obvious difference at first glance, but I may be wrong. I do agree on the Volume option, not good for indicator, might work OK in EA.

Thanks alot mladen, great help to my rather poor indie coding skills...

Cheers,

San.
 
mladen:

Fudo, all is OK. Only had some things that needed to be done without delay and my posting at TSD suffered a bit because of that. Now it is resolved so my time will be less divided

Wish a great weekend to all

regards

mladen

hi mladen,

I'm happy to hear all is well

when you get a chance, I posted 2 indicators, an MA of RSX and the Triangular MA abands.

can the Triangular MA abands be applied to the MA of RSX?

Thanks!

Fudo

Fudomyo:

mladen,

would it be possible to combine the MA of RSX (or even a simple RSX if the MA of RSX isn't possible) with Triangular MA abands?

Thanks
 

Thanks mladen, excellent explanation, never looked at it that way (threads in MT4)...learnt something again.

Sticking with the current setup (Time[0]).

Cheers, San.

 

...

Fudo

Here you go

Made some changes (actually a new indicator, but it is what I derived as an idea) Check if that is what you had in mind.

First change is that I removed that color blocks and added color to RSX line so now it shows when it is above or bellow the signal line (so the color change is not the slope of RSX, but its relation to signal line). The second is that it is a single file indicator now (no need for external Rsx indicator)

As of what is it applied to : you can choose - if you set TmaApplyToto 0 it will be applied to RSX else it will be applied to signal line (MA of RSX)
regards

mladen

Fudomyo:
hi mladen,

I'm happy to hear all is well

when you get a chance, I posted 2 indicators, an MA of RSX and the Triangular MA abands.

can the Triangular MA abands be applied to the MA of RSX?

Thanks!

Fudo
 

Interpolate adding

hi mladen

mtf movingaverage

mtf stohactic

interpolate adding

thanks

 

casaliss,

Those (and a couple more ) you can find in this thread : https://www.mql5.com/en/forum/178741

They do not have it as an option, but those indicators are in fact applying linear interpolation

regards

mladen

casaliss:
hi mladen

mtf movingaverage

mtf stohactic

interpolate adding

thanks