Help modify the code

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));

Do you?


This shows that you are making no efforts to learn rather simply want to copy-paste generosity of others.

1 Like

Thanks for your response
[Cougar]

I need the exact opposite ?

How many times the price of the exponential average 55 has been tested

This shows that you are making no efforts to learn rather simply want to copy-paste generosity of others. ؟؟؟؟؟؟؟؟؟؟؟؟؟

**** I need help and a beginner
All of you and I benefit from the efforts of others saved them .

@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));

An example of what is being calculated,

image

Or visually,
image

6 Likes