I am trying to code a simple exploration.
getting some difficulty to code a Condition
Can some one help me to code condition 3 in following code.
// Exploration Conditions
Con1 = Close >EMA(C,20); //Price close above 20 EMA
Con2 = EMA(C,20) > EMA(C,200); // EMA 20 > EMA 200;
//Con3 = EMA 20, EMA 50, EMA 100 is in range of 5%.
Thanks in advance
Do you mean something like this?
ema20 = EMA( C, 20 );
ema50 = EMA( C, 50 );
ema100 = EMA( C, 100 );
band = 5; // %
highestEma = Max( ema20, Max( ema50, ema100 ) );
lowestEma = Min( ema20, Min( ema50, ema100 ) );
middle = ( highestEma + lowestEma ) / 2;
topBand = middle * ( 1 + band / 100 / 2 );
bottomBand = middle * ( 1 - band / 100 / 2 );
inBandRange = bottomBand < lowestEma AND highestEma < topBand;
Cond3 = inBandRange;
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.