NexusFi: Find Your Edge


Home Menu

 





Ninja back test: real or fake


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one kevinkdog with 6 posts (10 thanks)
    2. looks_two jupiejupe with 5 posts (0 thanks)
    3. looks_3 mcteague with 4 posts (0 thanks)
    4. looks_4 Mathemagician with 2 posts (5 thanks)
      Best Posters
    1. looks_one liquidcci with 3 thanks per post
    2. looks_two Mathemagician with 2.5 thanks per post
    3. looks_3 shodson with 2 thanks per post
    4. looks_4 kevinkdog with 1.7 thanks per post
    1. trending_up 7,732 views
    2. thumb_up 21 thanks given
    3. group 5 followers
    1. forum 20 posts
    2. attach_file 0 attachments




 
Search this Thread

Ninja back test: real or fake

  #1 (permalink)
 mcteague 
New York NY USA
 
Experience: Intermediate
Platform: esignal, thinkorswim,
Trading: Stocks
Posts: 122 since Oct 2012
Thanks Given: 63
Thanks Received: 35

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

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
25 thanks
GFIs1 1 DAX trade per day journal
19 thanks
The Program
18 thanks
  #2 (permalink)
Mathemagician
PA/USA
 
Posts: 6 since Apr 2014
Thanks Given: 4
Thanks Received: 11

The smaller the target, the shorter your trade. The shorter your trade, the more opportunity for new entries to be taken.

If you set your target to 10000 points, you'd have only one trade (or only one trade per day, if you're exiting at the close).

Make sense?

Reply With Quote
Thanked by:
  #3 (permalink)
 mcteague 
New York NY USA
 
Experience: Intermediate
Platform: esignal, thinkorswim,
Trading: Stocks
Posts: 122 since Oct 2012
Thanks Given: 63
Thanks Received: 35



Mathemagician View Post
The smaller the target, the shorter your trade. The shorter your trade, the more opportunity for new entries to be taken.

If you set your target to 10000 points, you'd have only one trade (or only one trade per day, if you're exiting at the close).

Make sense?


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.

This is a very simple system.

Started this thread Reply With Quote
  #4 (permalink)
 
liquidcci's Avatar
 liquidcci 
Austin, TX
 
Experience: Master
Platform: ninjatrader, r-trader
Trading: NQ, CL
Posts: 866 since Jun 2011
Thanks Given: 610
Thanks Received: 1,091

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."
Reply With Quote
Thanked by:
  #5 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009


mcteague View Post
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.

This is a very simple system.

What do you mean
Quoting 
As far as I know the back test does not wait for a trade to be closed before proceeding to the next trade.

Can't you look and see.
There is a parameter for this.
I wouldn't start with only 120 stocks. Start with 5000 at least. lol

Reply With Quote
  #6 (permalink)
 kevinkdog   is a Vendor
 
Posts: 3,647 since Jul 2012
Thanks Given: 1,890
Thanks Received: 7,338


mcteague View Post
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.

This is a very simple system.

Take a look at your logic. If you are already long, will the strategy open a brand new trade? Or, will it ignore subsequent signals, since you are already long?


You could also post the code (take any "secret sauce" out), and people could tell you exactly why you are seeing this behavior.

Follow me on Twitter Reply With Quote
Thanked by:
  #7 (permalink)
 mcteague 
New York NY USA
 
Experience: Intermediate
Platform: esignal, thinkorswim,
Trading: Stocks
Posts: 122 since Oct 2012
Thanks Given: 63
Thanks Received: 35

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.

{
SetProfitTarget("", CalculationMode.Ticks, 100);
SetStopLoss("", CalculationMode.Ticks, 200, false);

CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(PPO(12, 26, 9), PPO(12, 26, 9).Smoothed, 1)
&& PPO(12, 26, 9)[0] > Zero
&& ATR(14)[0] < Onepfine
&& PPO(12, 26, 9)[1] < PPO(12, 26, 9).Smoothed[1]
&& PPO(12, 26, 9)[2] < PPO(12, 26, 9).Smoothed[2])
{
EnterLong(DefaultQuantity, "");


* 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.

Started this thread Reply With Quote
  #8 (permalink)
Mathemagician
PA/USA
 
Posts: 6 since Apr 2014
Thanks Given: 4
Thanks Received: 11

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.

Hence, more trades for tighter targets.

Reply With Quote
Thanked by:
  #9 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709

If you want to be able to enter a new position while already in a position, you need to set "Entries per direction" to be more than 1 (the default)

Strategy.EntriesPerDirection

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.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #10 (permalink)
 mcteague 
New York NY USA
 
Experience: Intermediate
Platform: esignal, thinkorswim,
Trading: Stocks
Posts: 122 since Oct 2012
Thanks Given: 63
Thanks Received: 35



shodson View Post
If you want to be able to enter a new position while already in a position, you need to set "Entries per direction" to be more than 1 (the default)

.

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.

Started this thread Reply With Quote




Last Updated on June 7, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts