Im using a combination of ADX trail stop/slim ribbons and 9sma
i have the full code for everything working fine as a strategy however when i try to convert to a scanner it doesnt seem to be 100 percent. if i ask it to show me things that are true within 2 bars it shows me things that dont meet or are too far out any help would be appreciated
input trailType = {default modified, unmodified};
input ATRPeriod =14;
input ATRFactor = 2.0;
def atr = Average(TrueRange(high, close, low), 14);
input averageType = AverageType.WILDERS;
input length = 14; #DI+- length
input adxlength = 20; #ADX sideways length
input SMA1_length = 12;
input displace = 0;
input price = close;
input crazyfast_length = 4;
#8
input superfast_length = 8;
#13
input fast_length = 13;
#21
input slow_length = 21;
def exit = Average(price[-displace], SMA1_length);
def mov_avg4 = ExpAverage(price[-displace], crazyfast_length);
def mov_avg8 = ExpAverage(price[-displace], superfast_length);
def mov_avg13 = ExpAverage(price[-displace], fast_length);
def mov_avg21 = ExpAverage(price[-displace], slow_length);
def hiDiff = high - high[1];
def loDiff = low[1] - low;
def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
#def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
def "DI+" = 100 * MovingAverage(averageType, plusDM, length) / atr;
def "DI-" = 100 * MovingAverage(averageType, minusDM, length) / atr;
def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
def ADX = MovingAverage(averageType, DX, length);
def bullentry = "DI+" >= "DI-" and ADX > 20;
def bearentry = "DI+" <= "DI-" and ADX > 20;
def arrow = (mov_avg4 > mov_avg8 and mov_avg8 > mov_avg13 and close > exit and bullentry is true);
plot bullish =arrow;
i have the full code for everything working fine as a strategy however when i try to convert to a scanner it doesnt seem to be 100 percent. if i ask it to show me things that are true within 2 bars it shows me things that dont meet or are too far out any help would be appreciated
input trailType = {default modified, unmodified};
input ATRPeriod =14;
input ATRFactor = 2.0;
def atr = Average(TrueRange(high, close, low), 14);
input averageType = AverageType.WILDERS;
input length = 14; #DI+- length
input adxlength = 20; #ADX sideways length
input SMA1_length = 12;
input displace = 0;
input price = close;
input crazyfast_length = 4;
#8
input superfast_length = 8;
#13
input fast_length = 13;
#21
input slow_length = 21;
def exit = Average(price[-displace], SMA1_length);
def mov_avg4 = ExpAverage(price[-displace], crazyfast_length);
def mov_avg8 = ExpAverage(price[-displace], superfast_length);
def mov_avg13 = ExpAverage(price[-displace], fast_length);
def mov_avg21 = ExpAverage(price[-displace], slow_length);
def hiDiff = high - high[1];
def loDiff = low[1] - low;
def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;
#def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
def "DI+" = 100 * MovingAverage(averageType, plusDM, length) / atr;
def "DI-" = 100 * MovingAverage(averageType, minusDM, length) / atr;
def DX = if ("DI+" + "DI-" > 0) then 100 * AbsValue("DI+" - "DI-") / ("DI+" + "DI-") else 0;
def ADX = MovingAverage(averageType, DX, length);
def bullentry = "DI+" >= "DI-" and ADX > 20;
def bearentry = "DI+" <= "DI-" and ADX > 20;
def arrow = (mov_avg4 > mov_avg8 and mov_avg8 > mov_avg13 and close > exit and bullentry is true);
plot bullish =arrow;