Back Tester and ROC

Hi
I have been playing around with Negative ROC as an exit in the Back Tester using this formula - ​ROC(Week(PERIODAMOUNT=1), BARS=1) < 0
Using the Show View, the formula seems okay. But the results in the Back Tester are not what I would expect. I have attached an example but used a One Month period instead because it is easier to see my confusion. I would expect the exit day to be when the price is lower than one month ago. ​It's like the exit trigger is coming from the future results, not results prior to the exit day. Can you please explain what is happening here?
Thank you.

Hi John,

I think it’s a timeframe issue. The exit in your example is because the day’s close is less than the month-end close of the day before. So when using ROC(Week(PERIODAMOUNT=1), BARS=1) it will use the weekly (Friday) close, regardless of when the test is run. Instead use the CHANGE function set to one week and it will be a rolling week rather than from the Friday.

CHANGE(INT_TYPE=Week, INT_COUNT=1)

See here for more info on ROC vs CHANGE:

https://forum.optuma.com/topic/whats-the-difference-between-roc-and-change-functions/

Thanks Darren. The ROC explanation makes sense but I am still having trouble rationalising the results on some tests. Can you please clarify which period is the trigger date in the Back Tester. I had assumed the Back Tester was showing the buy period and the trigger would be the period before (as I had enter next open day ticked). The buy date on the example was 2 Oct 2017.

Hi John,

The timeframe for the signal criteria depends on the Data Timeframe setting in the test setup window. In this example the entry would be based on daily data and tested over the last 5 years (note that the timeframe isn’t included in the script formula so it will be based on daily MACD and MA values).

Capture