I was testing a simple strategy using ninja trader. I ran it 3 times for the period 1/1/2008 till today.
The only change I made was in the target I used for the test. The trade criteria was exactly the same.
4 point target had 1033 trades with 49% profitable
2 point target had 1358 trades with 61% profitable
1 point target had 1651 trades with 73% profitable
All had a 2 point stop.
Why would the number of trades be different? All back tests used the same strategy. The only change was to the target.
Would I be wrong to conclude that Ninja trader is not actually back testing? That is it is not using real data. But that it is testing with randomly generated data.
That would be very disappointing, since that is not what back testing means. Is there some reason the trade numbers might be different that I am not considering? Thanks
As far as I know the back test does not wait for a trade to be closed before proceeding to the next trade. I am not testing this on only one instrument, like the ES.
I have a list of about 120 stocks that I am testing using EOD data.
Just realize there can be limitations with backtesting. After you backtest it is advisable to go through large sample of your trades to check and see if any problems. Not all strats backtest well and can give you false results. I will not trade a strat unless backtest and live results match very closely and I have a understanding of any issues.
"The day I became a winning trader was the day it became boring. Daily losses no longer bother me and daily wins no longer excited me. Took years of pain and busting a few accounts before finally got my mind right. I survived the darkness within and now just chillax and let my black box do the work."
The following 3 users say Thank You to liquidcci for this post:
I think ninja as a limit of 200 stocks per list. So testing 5000 would be difficult. These are just things that are within a certain price range and trade 1 ( or maybe 2) million on average per day.
There really isn't any secret sauce. This strategy is not intended for automated trading. Its purpose is to help me better understand how well certain indicators work, and to get some idea of whether I am on the right path regarding my trading. This is pretty much just a scan that I do for stocks on the close. But I would actually weed out a lot from the results I get. I certainly would not trade them all.
But I just do not have the skill necessary to place all the subjective criteria I might use, like price line to choppy, into the strategy. So I am simply looking for a general sense of whether this setup is trade-able
Originally I was thinking of this like being the house in Las Vegas. A 60% profitable rate would yield a 2 trade profit for every 10 trades. But I realize it is a little more complicated than that, as there are other factors.
Anyway as I said there is no secret sauce. It is pretty basic and simple. It is unlikely I have found the secret to crushing the street.
/// Called on each bar update event (incoming tick)
protected override void OnBarUpdate()
// Condition set 1
if (CrossAbove(PPO(12, 26, 9), PPO(12, 26, 9).Smoothed, 1)
&& PPO(12, 26, 9) > Zero
&& ATR(14) < Onepfine
&& PPO(12, 26, 9) < PPO(12, 26, 9).Smoothed
&& PPO(12, 26, 9) < PPO(12, 26, 9).Smoothed)
* Onepfine means 1.5
I was really trying to find out the value of having my PPO crosses above or below zero or minus 1.
Again all I did was change the profit target and got totally different numbers of trades. So I am not sure what that means. Thanks to all for replies.
I could be wrong, but I still believe your code is skipping entry signals when already in a trade. This is the default behavior of every trading platform I know.
For example, if you're already long 100 IBM and get another buy signal that second buy signal would be ignored. However, if you tighten your target on that trade you are more likely to be out of the first trade by the time the second signal arrives, so the second signal is less likely to be ignored.
The tighter your target, the more likely you are to be flat when the next signal arrives.
The looser your target, the more likely you are to already be in a trade when the next signal arrives, causing the later signals to be ignored.
One problem with backtesting this is if you are targeting 1pt and your ATR is, say 5pts, then you will almost always have a winner. If you are also using a stop and your stop is also 1pt and the day bar went up at least 1pt as well as down at least 1pt during that bar, it will be counted as a loser because Ninja doesn't know if it hit the target or stop first (within the bar) so it just treats it as a loser (or winner, can't remember, either way the results are not reliable). Make sure your stops and targets are greater than some multiple of ATR of the timeframe being traded. Or, place your orders on a smaller, secondary timeframe (like 5mins) within the day bars, if you have access to that data (more complicated to code too).
P.S. You can backtest on more than 200 instruments at a time but it might be really slow, especially if you are connected to a real-time data feed while you are backtesting.
The following 2 users say Thank You to shodson for this post:
Thanks for explaining this. that could certainly explain the difference in the number of entries. I also appreciate the explanation of how back testing results can be falsely affected by the way I lay out my stops and targets. That was very interesting.
It just seems to me that since we have these tools we should try to find out what our setups and indicators are really worth. That is pretty much all I am trying to do. When a trend indicator like MACD, PPO, or TSI cross their signal lines how reliable is that as a trading signal? What does it really mean? These kinds of indicators are the easiest examine this way. So that is where I am starting. I think even people not interested in automated trading should try and test their setups to see whether they have any real chance of making money.
Again thanks for the "number of entries" explanation. I just did not know.