Suppose I want to set periodicity to weekly. In other words, instead of manually setting this option "Analysis-Settings->Data->Periodicity->Weekly", I would like to set the periodicity to weekly through AFL code. Can this be done?
Unfortunately no.
But you can run a check via code. This example code will check the AA Periodicity is set to Daily.
// Switch (Automatic Analysis Periodicity Checker)
periodicityCheck = True;
if (periodicityCheck)
{
if (Status("action") == actionScan OR Status("action") == actionExplore OR Status("action") == actionBacktest)
{
if (NOT Interval() == inDaily) Error("Automatic Analysis 'Periodicity' - Must be set to 'DAILY'!");
}
}
6 Likes
Unfortunately no.
On a lighter note, it should rather be "Logically No"
AB always accommodates shifting to higher TF anyway.
you plan the journey and fill the fuel tank accordingly
The answer is - what you are trying to do is NOT part of AFL, but part of Analysis project.
You should store Analysis Project (.APX) via File->Save As menu. Analysis project includes formula AND THE SETTINGS (including periodicity) Later you can just open the project (.APX) via File->Open and both formula AND the settings (including periodicity) will be set correctly.
5 Likes