Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am trying to enter into multiple trades at same bar. In the attached image, I first Long at first bar and then first short in 5th bar and immediately Long in 5th bar. When I backtest, for the 5th bar, I just see Long trade entry and there is no entry for short trade that I've made in 5th bar. May I know why is this and how to get the entry of both short and Long trade details for the same bar in backtest result.
I tried using SetOption("AllowSameBarExit", True ); and SetOption("HoldMinBars", 1); but in vain.
Can you help answer these questions from other members on NexusFi?
I've selected both Long and Short in Settings. I've attached two new images with Time mentioned.
At 09:59, I expect backtest to show me both short and Long trades entry. In the attached snippet(sorted by Date), at 09:59, it just shows Long trade and not the short trade. May I know why is that
At 3:25:59, a short trade and Buy trade is placed. But, when i Backtest, the backtest result just shows the buy trade that I have placed. In addition, I have short trades at 3:18 PM and 3:24 PM and other times. Even they are not part of backtest results.
The last short trade as per backtest result is at 2:40:59 PM. After that, though I've many short trade entries, they are not shown in backtest. The next result after 2:40:59 PM is at 3:25:59 PM and that is where I enter into Buy trade again(which could be result of cover = Buy). Does it mean that Backtest doesnt show any short trades that i've made after 2:40:59 PM until the short trade I placed at 2:40:59 PM is covered back at 3:25:59 PM. Can't I enter into new short trade when I already have other short trade in open.? Please help clarifying this
As aside you should better use sections in your code by using status( "action" ) because otherwise you run redundant code in environments where it is not required to be run. This becomes more essential the longer/ the more resource hungry your entire code becomes.
I went through the setbacktestmode documentation and related doc amibroker.com/guide/h_portfolio.html.
Multiple positions in a bar would be hold back along with exit signals if I use backtestRegularRaw2Multi. I have a below set of code added now.
SetBacktestMode(backtestRegularRaw2Multi); // I also tried with backtestRegularRawMulti
SetOption("AllowSameBarExit", True );
Setoption("holdminbars", 1);
But, Still I dont see two position details for the same bar in Backtest result. I am expecting my backtesting results to show something as below
BANKNIFTY Short 6/12/2015 3:25:59 PM 17521.3
BANKNIFTY Long 6/12/2015 3:25:59 PM 17521.3