My regard to all the experienced members and vast knowledge gathered within Forum. The more I scroll and search, the more learning I get from here. And answers to almost all my queries.
But after days of forum searching and experiments, I am still stuck with one unsolved problem for me.
I am trying to match my Backtest result with Scan window before going Live. Problem I am facing is while my nBarStop is working fine in Backtest window, it does not work in Scanner.
Same is also mentioned by The Great Tomasz here : scan-vs-exploration-vs-backtest-summary-of-differences, if I understand it correctly.
I am using a simple code as below but unable to replicate the backtest result in scan window.
Please advise if there is any way to apply nBarStop in scan window and How can I ensure going Out of Trade after fixed bar count provided my target SL Or Profit is not hit?
No, as explained I other forum thread, Scan only shows content of Buy Sell Short Cover arrays and ApplyStop is NOT evaluated, because ApplyStop in an instruction for the Backtester, not for Scan. The only way to have ApplyStop evaluated is to run Backtest.
Thanks @Tomasz for quick help. Equity(1) worked exactly what I wanted.
Btw, is there any specific meaning to when you say 'SINGLE symbol backtest' ? as I am running scanner against a watchlist containing multiple symbols.
Just out of curiosity, want to understand why you preferred to keep the SCAN functionality without nBarStop? You have already made arrangement using Equity(1) but not in Scanner directly.
It is not an arrangement, if you read the comments section; it is logically possible to run a backtest on the current symbol that is already being scanned, but you can't run a SCAN and do a portfolio-level backtest within it.
5 - n-bar stop is a feature of Backtest, not Scan.
Thanks @nsm51 for taking your time to reply. Genuinely I read the @Tomasz comments at the end of referenced article, before asking further clarity on the rationale behind not having nBarStop in SCAN.
I also got that it's a Backtest functionality and not SCAN.
I was curious on the thought process behind as I thought of BACKTESTING as a pre-production step for SCANNER.
These are just different things. Coffee is different than tea. This is how it is like.
Scan, exploration and backtest are DIFFERENT THINGS.
Scan just displays RAW (unprocessed) Buy/Sell signals as YOU wrote them in the code nothing more.
ApplyStop is BACKTESTER-only instruction. Like AddColumn is EXPLORATION-only instruction.
Like Backtest ignores AddColumns, so Scan and Exploration ignores ApplyStop.
It has been explained here:
Just read carefully.
Equity(1) is an in-line (i.e. performing its job at the line it is called) single-security backtester in a box. It performs entire single-security backtest including evaluation of ApplyStop for current symbol and produces Equity value for that backtest as a return value. The parameter "1" tells it write back signals for exits that were triggered by ApplyStop back to sell/cover arrays.