So far I have failed to code a kind of ETF savings plan simulation. A savings plan works like this… on the 1st or last day of each month you buy a share of an ETF, for example SP500. So that means cumulative orders true. That would be the standard. But I want to know whether it is really better to only buy when the price is above a certain MA, the standard here is usually the SMA200 in Daily. And then whether it is better to sell all shares if the price slips below this SMA or to simply hold and not buy any new shares. What I’m having trouble with is that the code only buys once a month, cumulate Orders=true
Can someone please code this simulation for me?