// Downloaded From https://www.WiseStockTrader.com /* Strongest Stocks Explorer - For Research Purposes only Introduction: - This piece of afl code is written for EOD charts in t+ markets (originally designed for Vietnamese market) to find all of the stocks with super strong rally in really short amount of time in the past, expressed in the form of consecutive limit-up bars, then specifies the date the rally ends. - The types of stocks the explorer looks for are usually penny stocks, which soars up in a few days or even in a week or two, then collapse really quickly. Used for: - t+ market (if you trade in t+0 markets then please take this as a reference only and modify the code as per need) - End-of-day/EOD chart only Purpose: - Assist you in finding and doing a research about stocks with strong rally in shortest time possible. Params/Input: - s: the number of up bar. - rallyPerBar: how much one up bar increases compared to previous bar's close. Return/Result - The day, month and year of the strong rally in short time of a stsock - The bar index of the bar where the rally ends. Instruction: - First set the span, i.e. the number of up bars that the stock should have. By default, I set it to 4, meaning 4 consecutive up bars. - Next define rallyPerBar, i.e how much one up bar (daily) rises. By default, it is 1.05, or 5%. - In exploration window, choose Range = From-To-dates and set both date box Today (Today must not be the date that does not exist in your Ami data like Sunday or so). - If you want more results from one stock, adjust the dates in the exploration window backward. - (optional) You can adjust the liquidity of the ouput stocks in liquidityA and liquidityM. */ // params s = Param("Span", 4, 4, 10, 1); rallyPerBar = Param("Rally/bar", 1.05, 0, 1000, 0.001); liquidityA = Param("MAVol20Bars", 5000, 0, 999999999, 1); liquidityM = Param("MedianVol20Bars", 2000, 0, 999999999, 1); condL = MA(V, 20) >= liquidityA AND Median(V, 20) >= liquidityM ; nonStock = !StrMatch(Name(), "^*") AND !StrMatch(Name(), "FUES*") AND !StrMatch(Name(), "FUEV*") AND !StrMatch(Name(), "C???*") AND !StrMatch(Name(), "VN??*") AND !StrMatch(Name(), "HNX30") AND !StrMatch(Name(), "UPCOM") AND !StrMatch(Name(), "E1VF*") ; switch(s) { case 4: consecutiveBars = Ref(C, 1)/C < rallyPerBar AND C/ Ref(C, -1) >= rallyPerBar AND Ref(C, -1)/ Ref(C, -2) >= rallyPerBar AND Ref(C, -2)/ Ref(C, -3) >= rallyPerBar AND Ref(C, -3)/ Ref(C, -4) >= rallyPerBar ; break; case 5: consecutiveBars = Ref(C, 1)/C < rallyPerBar AND C/ Ref(C, -1) >= rallyPerBar AND Ref(C, -1)/ Ref(C, -2) >= rallyPerBar AND Ref(C, -2)/ Ref(C, -3) >= rallyPerBar AND Ref(C, -3)/ Ref(C, -4) >= rallyPerBar AND Ref(C, -4)/ Ref(C, -5) >= rallyPerBar ; break; case 6: consecutiveBars = Ref(C, 1)/C < rallyPerBar AND C/ Ref(C, -1) >= rallyPerBar AND Ref(C, -1)/ Ref(C, -2) >= rallyPerBar AND Ref(C, -2)/ Ref(C, -3) >= rallyPerBar AND Ref(C, -3)/ Ref(C, -4) >= rallyPerBar AND Ref(C, -4)/ Ref(C, -5) >= rallyPerBar AND Ref(C, -5)/ Ref(C, -6) >= rallyPerBar ; case 7: consecutiveBars = Ref(C, 1)/C < rallyPerBar AND C/ Ref(C, -1) >= rallyPerBar AND Ref(C, -1)/ Ref(C, -2) >= rallyPerBar AND Ref(C, -2)/ Ref(C, -3) >= rallyPerBar AND Ref(C, -3)/ Ref(C, -4) >= rallyPerBar AND Ref(C, -4)/ Ref(C, -5) >= rallyPerBar AND Ref(C, -5)/ Ref(C, -6) >= rallyPerBar AND Ref(C, -6)/ Ref(C, -7) >= rallyPerBar ; case 8: consecutiveBars = Ref(C, 1)/C < rallyPerBar AND C/ Ref(C, -1) >= rallyPerBar AND Ref(C, -1)/ Ref(C, -2) >= rallyPerBar AND Ref(C, -2)/ Ref(C, -3) >= rallyPerBar AND Ref(C, -3)/ Ref(C, -4) >= rallyPerBar AND Ref(C, -4)/ Ref(C, -5) >= rallyPerBar AND Ref(C, -5)/ Ref(C, -6) >= rallyPerBar AND Ref(C, -6)/ Ref(C, -7) >= rallyPerBar AND Ref(C, -7)/ Ref(C, -8) >= rallyPerBar ; case 9: consecutiveBars = Ref(C, 1)/C < rallyPerBar AND C/ Ref(C, -1) >= rallyPerBar AND Ref(C, -1)/ Ref(C, -2) >= rallyPerBar AND Ref(C, -2)/ Ref(C, -3) >= rallyPerBar AND Ref(C, -3)/ Ref(C, -4) >= rallyPerBar AND Ref(C, -4)/ Ref(C, -5) >= rallyPerBar AND Ref(C, -5)/ Ref(C, -6) >= rallyPerBar AND Ref(C, -6)/ Ref(C, -7) >= rallyPerBar AND Ref(C, -7)/ Ref(C, -8) >= rallyPerBar AND Ref(C, -8)/ Ref(C, -9) >= rallyPerBar ; case 10: consecutiveBars = Ref(C, 1)/C < rallyPerBar AND C/ Ref(C, -1) >= rallyPerBar AND Ref(C, -1)/ Ref(C, -2) >= rallyPerBar AND Ref(C, -2)/ Ref(C, -3) >= rallyPerBar AND Ref(C, -3)/ Ref(C, -4) >= rallyPerBar AND Ref(C, -4)/ Ref(C, -5) >= rallyPerBar AND Ref(C, -5)/ Ref(C, -6) >= rallyPerBar AND Ref(C, -6)/ Ref(C, -7) >= rallyPerBar AND Ref(C, -7)/ Ref(C, -8) >= rallyPerBar AND Ref(C, -8)/ Ref(C, -9) >= rallyPerBar AND Ref(C, -9)/ Ref(C, -10) ; break; default: consecutiveBars = Ref(C, 1)/C < rallyPerBar AND C/ Ref(C, -1) >= rallyPerBar AND Ref(C, -1)/ Ref(C, -2) >= rallyPerBar AND Ref(C, -2)/ Ref(C, -3) >= rallyPerBar AND Ref(C, -3)/ Ref(C, -4) >= rallyPerBar ; break; } endBar = ValueWhen(consecutiveBars, BarIndex(), 1); endDay = ValueWhen(consecutiveBars, Day(), 1); endMonth = ValueWhen(consecutiveBars, Month(), 1); endYear = ValueWhen(consecutiveBars, Year(), 1); Filter = condL AND nonStock ; AddColumn(endBar, "BarIndex", 1.0); AddColumn(endDay, "Day", 1.0); AddColumn(endMonth, "Month", 1.0); AddColumn(endYear, "Year", 1.0); SetSortColumns(-6, -5, -4); AddRankColumn(); AddSummaryRows(16, 1);