Need help on afl

@AlgoGeek @Neotrade @nithin @portfolioplus911 The below mentioned code, I use it to find the stocks that are “Near all time high”. I need an exact opposite of this afl to find stocks that are “Near all time low”. that is the opposite replica of this code. Could you please help me reverse the code .?? I’m really bad at coding. Your help would be much appriciated. I really really need this one code… Please guys help me out :hushed:

a = Highest(Close);
a1 = Highest(High);

b = ((a / Close) - 1) * 100;

Filter = b < 1.5; // Near all time highs

SetOption(“NoDefaultColumns”, True );
AddTextColumn(Name(),“Ticker”,1.0,colorDefault,colorDefault,60);
AddColumn( DateTime(), “Date”, formatDateTime,colorDefault,colorDefault,68 );
AddColumn( IIf(ROC( C, 1 ) >=0, ROC(C,1),IIf(ROC( C, 1 ) < 0,ROC(C,1),Null)) ,"%C",1.1,colorDarkGrey,IIf(ROC( C, 1 ) >=0,colorPaleGreen,IIf(ROC( C, 1 ) <0,colorPink,colorLightGrey)));
AddColumn(C , "Close ",1.2, colorBlack );
AddColumn(a , “HighClose” , 1.2 , colorBlue);
AddColumn(a-C , “Closediff” , 1.2 , colorBlue);
AddColumn(b , “B” , 1.2 , colorBlack);
AddColumn(a1 , “Highest” , 1.2 , colorRed);
SetSortColumns(7);
_SECTION_END();

the above give code is incomplete or not working,
if your requirement is to find the all time highest high or lowest low, check the below given afl

/*
Scan New High and New Low

Scan OR exploration which can find any futures OR stock that has reached Break New High AND New Low :

User choose on “Scan by Day/Week/Month” option.

  1. User input if scan by Day
  2. User input if scan by Week (Default)
  3. User input if scan by Month

*/

//–User Input

YMWD = ParamList(“Choose scan by”, “Day|Week|Month”, 1);
Wk = Param(“Week High”, 52, 1, 52);
Mth = Param(“Month High”, 12, 1, 12);
Days = Param(“Day High”, 260, 1, 260);

if (YMWD == “Week”)
{
x = Wk;
Days = 5wk;
}
else
if (YMWD == “Month”)
{
x = Mth;
Days = 20
Mth;
}
else
{
x = Days;
}

Buy = High > Ref(HHV(High,Days),-1);
Sell = Low < Ref(LLV(Low,Days),-1);

Filter = (Buy OR Sell);

AddTextColumn(FullName(), “Security”, 1.0, colorDefault, colorDefault,200);
AddTextColumn( WriteIf(Buy, “HIGH”, WriteIf(Sell, “LOW”, “”)),
"Break “+x+” “+YMWD+” ",

          1.0, colorDefault, colorDefault,100);

@AlgoGeek @Neotrade @nithin @portfolioplus911 thanx for the effort but i was looking to scan for stocks that are about to break the support or those are near its support in a daily time frame.
Some of the Conditions are

  1. trend is down
  2. Near its previous support (number of days to analyze is > 100)

Can you please help me code this .? I’m trying to code it but not able to do it correctly. Your help would be much appriciated. .

Kindest Regards

Pavan

This is error im facing when i try to copy paste the code you just posted. Is there any way how i can solve this .??

Regards
Pavan