I tried to make a scan searching for the Moving average crossing in the last 78 bars but I end up searching for the longer than 20 bars no matter what coding I use .
Here is the code i used ;
input price = close;
input length1 = 55;
input length2 = 21;
def AverageType1 = averageType.SIMPLE;
def AverageType2 = averageType.HULL;
def avg1 = movingAverage(averageType1,price,length1);
def avg2 = movingAverage(averageType2,price,length2);
plot scan = (avg2 crosses above avg1 ) within 78 bars ;
Here is the code i used ;
input price = close;
input length1 = 55;
input length2 = 21;
def AverageType1 = averageType.SIMPLE;
def AverageType2 = averageType.HULL;
def avg1 = movingAverage(averageType1,price,length1);
def avg2 = movingAverage(averageType2,price,length2);
plot scan = (avg2 crosses above avg1 ) within 78 bars ;
Last edited: