Please help with how to program an AFL to check a signal based on closing price of the last day of the month and take the trade on the 1st day of the next month at Open.
I am using the following but it is taking the signal based on 2nd last day of the month and trading on last day of the month.
I'm not sure if you know this but I'm going to mention it: your ref statement is looking into the future. In this particular case I do not see an issue in doing this, but in general you will want to use negative ref's so that you're looking back.
@techtrader2 you appear to be new to the forum, so welcome to the forum! But for future questions or posts please read the proper method of entering code in your post,
And when you run into difficulty with something you have coded, @Pinecone has helped illustrate one of many different methods of debugging your code and finding your mistakes. But here are some excellent suggestions,
Thanks @Pinecone this worked! Could you please advise should I do if I want to check for the same thing on the last day of the week i.e. on Friday candle closing
This is really simple stuff, you'd be better off reading documentation and learning what's going on in code if you ever want to do something significant with it.