This is not mine and I did not make it, I found it on another thread and wanted to share here with y'all. Also is it possible for someone to make it as close to the original as possible ? I will post a link to John Ehlers original code on his website.
Code:
#NICA_ZEROLAG
#This is my version, anyone is welcome to play with it and modify it for better results.
input length = 32;
input GainLimit = 22;
input Thresh = 0.75;
def alpha = 2 / (length + 1);
def EMA = alpha * close + (1 - alpha) * EMA[1];
def Value1 = -GainLimit + GainLimit;
def Gain = Value1 / 10;
def EC = alpha * (EMA + Gain * (close - EC[1])) + (1 - alpha) * EC[1];
def Error = close - EC;
def BestGain = Gain;
def LeastError = 1000000;
plot EC1 = alpha * (EMA + BestGain * (close - EC[1])) + (1 - alpha) * EC[1];
EC1.SetDefaultColor(Color.ORANGE);
plot EMA48 = alpha * close + (1 - alpha) * EMA[1];
#Plot1(EC);
#Plot3(EMA);
#plot EC Crosses Over EMA and 100*LeastError / Close > Thresh Then Buy Next Bar on Open;
#plot EC crosses Under EMA and 100*LeastError / Close > Thresh Then Sell Short Next Bar on Open;