Hi
I have the following code to show how many times the minimum price has been tested for the exponential 50
I need the exact opposite
How many times the price of the exponential average 50 has been tested
ema50 = EMA(C,50);
BarsOver50 = BarsSince( L < ema50);
// Bars since Low was Less than ema, i.e. how long has it been above the ema
////////////////////
// Explore
///////////////////
aboveColor = IIf (L>ema50, colorLime, colorDefault);
Filter=1;
AddColumn(Low, "Low", 1.2, colorDefault, aboveColor);
AddColumn(ema50, "ema50");
AddColumn(BarsOver50, "BarsOver50", 1.0, colorDefault, IIf(BarsOver50, colorYellow, colorDefault));
@M2-new The point that @Cougar was making was that you do not appear to want to learn AmiBroker. Getting help on the forum is easy if you appear to be making an effort, and when using someone else's code giving them the appropriate credit.
For example, you have this solution from my earlier post
BarsSince( L < ema55)
And you are asking,
Did you try the exact opposite?
BarsSince( ema55 < Low)
That really would not take much effort to at least make that attempt.
If that is what you are looking for then all combined,
///@link https://forum.amibroker.com/t/help-modify-the-code/12760/5
ema55 = EMA(C,55);
BarsOver55 = BarsSince( L < ema55);
// looking for the opposite of the above
emaAboveLow = BarsSince( ema55 < Low);
////////////////////////////////////////////
// Add the new line to the previous Explore
////////////////////////////////////////////
aboveColor = IIf (L>ema55, colorLime, colorDefault);
Filter=1;
AddColumn(Low, "Low", 1.2, colorDefault, aboveColor);
AddColumn(ema55, "ema55");
AddColumn(BarsOver55, "BarsOver55", 1.0, colorDefault, IIf(BarsOver55, colorYellow, colorDefault));
AddColumn(emaAboveLow, "#Bars ema > Low", 1.0, colorDefault, IIf(emaAboveLow, colorLightBlue, colorDefault));