SPY Accumulator Code help

Greetings All, will some one code this basic accumulation code in AFL for me and all others too? Thanks so much. :)

if (this is the start of a new month) then
set buy flag = true

if (buy flag == true) and
((close today is less than 1%
below the close five days ago) or
(this is the last trading day of the month)) then
buy (monthly allocation budget)/(share price) shares
of SPY on the close
set buy flag = false

Similar threads