[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Recognising a new month starting



PureBytes Links

Trading Reference Links

At 08:37 AM 1/7/2005, Chris Cheatham wrote:

>if you are looking to know as of the end of yesterday's bar but as of today
>in real time that today is new month how about...
>
>if lastbaronchart and  month(currentdate) <> month(d)


At 11:29 PM 1/7/2005, Adrian Pitt wrote:

>I think you might have it. It only highlights the last bar but that's
>ok, as I can add what I had previously for historical bars, and what I
>had previsouly was fine for backtesting.  Its amazing how such a simple
>solution can be a quandry to think of.  I'm sure many of the other
>helpers would have picked your suggestion as well, but they were
>probably trying to mark every prior instance on the chart as I was.
>Your input and solution is very much appreciated.  I do have one
>question though.  Without 'lastbaronchart' it doesn't work properly. Why
>does putting the True/False function in the formula resolve the issue?
>Isn't the lastbaronchart always going to be true?



>month(currentdate) <> month(d)

will be true for every day when the month of the date on your computer clock (CurrentDate) is not equal to the month of the date on a bar on the chart (Date), which is eleven months out of every year. So today, it would be true for every bar with a month other than January.

>lastbaronchart and  month(currentdate) <> month(d)

will restrict that selection to only the last bar on the chart.

If your data is always current, that condition will only be true on a Saturday, Sunday, or holiday (non-trading day) where Friday was the end of the previous month. Perhaps that is useful for something but I cannot imagine what. :-)

I think you originally wanted to know on each bar, if the next trading day would be a new month. I think there is no way to do that other than the brute force method of figuring out such all cases in advance or by using an add-in package that allows you to look at the next bar.

Bob Fulks