How To get lowest price in certain period

hi everyone,

can anyone help me to solve my problem ??
i am a newbie in programing especially ini AFL. i need some help create my own AFL.
i want to get lowest price in certain period and repeat every year.
ex :
from 1 july until 31 august every year i want to get the lowest price. i already try to convert the date into datenum and also i try to use this code but its failed.
i really thank for anyone can help me and forgive if my english was so bad coz im from indonesia

dt=Month()==7; dn=Month()==8; sk= Date(); range=(sk > dt) AND (sk < dn) ;

Here's one way to do it.

The lowest price will be available on the final day of the period and will persist until the final day of the same period the following year.

July = 7;
August = 8;
BarMonth = Month();
JulyAugust = BarMonth >= July AND BarMonth <= August;
LastDayofMonth = TimeFrameExpand(True, inMonthly, expandPoint);
LastDayInAugust = LastDayofMonth AND BarMonth == August;
LowestPriceinJulyAugust = ValueWhen(LastDayInAugust, LLV(L, BarsSince(!JulyAugust)));

Filter = 1;
AddColumn(L, "Low");
AddColumn(LowestPriceinJulyAugust, "LowestPriceinJulyAugust");

image

1 Like

dear @MacAllan

thanks for ur help, its very helpfull
even its doesnt so closed to what i want but ur code open up my mind. by the way are may code was right ?

July = 7;
August = 8;
BarMonth = Month();
BarYear = Year();
Bar1Year = Year () -1 ;
JulyAugust = (BarMonth >= july and baryear == bar1year ) AND BarMonth <= August;

if i want to get price from july a year before untuk august now ?
once again thanks for the help