Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Avg. Trade values for a viable trading strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Avg. Trade values for a viable trading strategy

    How high would the "Avg. trade" in the Strategy Analyser have to be in order to be a viable after-costs trading system?

    I know that there are many other factors to consider and that even an Avg. Trade of $100 does not mean that you definitely have a viable system. E.g. it might be from a single trade. Etc....

    But let's focus on this particular number for now, despite the fact that there are many other factors to consider.

    E.g. if the number is negative then this would not be a viable trading strategy.

    It would have to be high enough to cover the "All In Costs", which through NT are $0.53 per contract.

    But, there are other costs. E.g. the spread cost. If it costs 1 tick for each execution then in ES this is $25 per round trip. So does that mean that a viable ES strategy would have to have an "Avg. Trade" value of at least $25.53?

    Hope you can see what I am getting at here. What I want to know, especially from those of you who are actually trading live with real money, is what range of numbers for "Avg. Trade" do you have in your back tests? Are they higher than $25.53?

    Am I on the right track in looking for strategies that have Avg. Trade greater than $25.53 and rejecting those that only have, say, $7?

    Any input/discussion greatly appreciated!

    #2
    Originally posted by AlgoJason View Post
    How high would the "Avg. trade" in the Strategy Analyser have to be in order to be a viable after-costs trading system?

    I know that there are many other factors to consider and that even an Avg. Trade of $100 does not mean that you definitely have a viable system. E.g. it might be from a single trade. Etc....

    But let's focus on this particular number for now, despite the fact that there are many other factors to consider.

    E.g. if the number is negative then this would not be a viable trading strategy.

    It would have to be high enough to cover the "All In Costs", which through NT are $0.53 per contract.

    But, there are other costs. E.g. the spread cost. If it costs 1 tick for each execution then in ES this is $25 per round trip. So does that mean that a viable ES strategy would have to have an "Avg. Trade" value of at least $25.53?

    Hope you can see what I am getting at here. What I want to know, especially from those of you who are actually trading live with real money, is what range of numbers for "Avg. Trade" do you have in your back tests? Are they higher than $25.53?

    Am I on the right track in looking for strategies that have Avg. Trade greater than $25.53 and rejecting those that only have, say, $7?

    Any input/discussion greatly appreciated!
    Strategies that trade fat tail events, will always have low avg trade. For example, you can have a strategy that's wrong 99.99% of the time but still be profitable. If the strategy trade 2000 times and netted -25 each trade except 1 trade and made 30k; you'd still net 5k overall but your "average trade" would be 4.9$!

    But you're right, obviously we want strategies that have a high avg trade because of slippage and commission. In my above example, I am assuming those numbers were post commission.

    Ninjatrader allows you to enter commission information per trade for futures. I wouldn't test strategies without having the option enabled for future markets. I trade forex, so for me, I worry about slippage rather than commission cost.

    The other thing that I have done to reduce slippage (because I don't really like the NT build-in slippage option) is that I only execute trades when price has drifted away from my entry at least 15 pips.Because the problem I was facing (esp during optimization) was that, I was realizing computers are extremely good at "over fitting." In other words, computers during optimization don't take slippage under account and will execute trades between bid/ask spread, and in simulation it will show you made tons of money. But in reality those trades would never have executed. Below is the code that I incorporate for all my strategies:

    Code:
    			if(Position.MarketPosition==MarketPosition.Long 
    				&& (Close[0] - Position.AveragePrice > 0.0015 
    				|| Close[0] - Position.AveragePrice < -0.0015))
    				
    			{
    			
    			if(Position.MarketPosition==MarketPosition.Long 
    				&& Close[0] > Position.AveragePrice+(ATR1[0]*Target))
    				
    			{
    				ExitLong(2,Position.Quantity,  @"PT",@"Target1");	
    			}							
    			}
    For example, above code is for a profit target, but it will only execute if price has drifted apart from my entry. Then to further reduce slippage, I am sending my execution to appropriate bid tick data to simulate a "market order."

    I'm working on building a strategy for futures at the moment, and my modification of the above code for future market (Nasdaq futures) is:

    Code:
    			if(Position.MarketPosition==MarketPosition.Long 
    				&& (Close[0] - Position.AveragePrice >10
    				|| Close[0] - Position.AveragePrice < -10))
    				
    			{
    			
    			if(Position.MarketPosition==MarketPosition.Long 
    				&& Close[0] > Position.AveragePrice+(ATR1[0]*Target))
    				
    			{
    				ExitLong(2,Position.Quantity,  @"PT",@"Target1");	
    			}							
    			}
    This way, my exits will only occur when the market has drifted 10$ away from my entry. You can do the same for Stops. This way, you'll reduce slippage. The only slippage I have to worry about is real time, but I've done everything I can possibly do to reduce my slippage in simulation mode. Now in the real market, the distribution of positive/negative slippage 50/50. In other words, you can theoretically get a better fill in live trading or a negative fill, and the odds of that are 50/50.

    Comment


      #3
      Thanks for your reply and for posting your code to manage the stops and profit targets. At the moment I am using the SetTrailStop and SetProfitTarget functions of NT with minute bars.

      I am facing exactly the issue that you mention too. I have tick data for every trade going through the exchange but do not have the order book data (Bid, Ask). So the prices flick in horizontal channels between the Bid and Ask as traders take the bid or ask.

      NT simulation will allow buy and sell at the price it sees, which is unrealistic here because obviously the price is not changing at all, it is just flicking between the bid and ask and all buys should be at the ask and all sells at the bid. Not a criticism of NT, it just is what it is.

      I have built in some precautions (like not reacting unless the price moves by at least 4 ticks and setting the stop and profit target to at least 4 ticks), but I do like your code which manages the stop and profit targets manually.

      I am not comfortable with the way that NT handles bars TBH. Not a criticism of NT, just that I like to see the data inside the bar to become convinced of what is going on.

      I have been thinking about revamping my code to run on 1 second bars (the indicator does not have to speed up though, it physically will be doing the same thing at the same speed but the resolution will be 1 second instead of 1 minute) so that the charts will execute orders inside the 1 second bar and I can manage the target and stop loss as you posted.

      I am getting around $5-$9 per trade average profit in my back-testing, but I am worried that in reality the cost of trading including spread, slippage and commission would be around $25 on average and therefore would result in losses in the long run.

      Comment


        #4
        Hello AlgoJason,

        Thank you for your post.

        Concerning fills I can forward this as a feature request. Concerning the bars building, have you looked into Tick Replay for this purpose?

        I will respond when I have an ID for the feature request for custom fill engine.

        Comment


          #5
          Hello AlgoJason,

          Thank you for your patience.

          The feature request for a custom fill engine in simulation has been assigned the internal tracking id of SFT-1137.

          Please let me know if you have any questions.

          Comment


            #6
            Thanks Patrick.

            I have attached a picture to illustrate part of the issue. In the picture which is of a simple moving average crossover (the one shipped as an example in NT) run on 1 second bars.

            In it you can see that the price is not changing. The ASK is at 946.75 and the BID is at 947.50 (2 tick spread in this case) and the Trade/Last price is bouncing between them as traders hit either side.

            But NT has filled both longs and shorts at the ASK in this case. In reality this series of trades would have cost at least 6 ticks ($75) to execute as market orders, but NT backtest will put them through at no cost because it does not do anything about the spread.

            I am not suggesting to trade at 1 second speed, just using this example to illustrate the issue.

            In a previous discussion it was established that NT essentially fills order with a 1 tick (timewise) delay between sample and fill and it was suggested somewhere that this may alleviate the need to worry about the spread. I am not convinced about that.

            One way to deal with this may be to wait for an uptick before filling a BUY and wait for a down tick before filling a SELL.

            In this case people may need to have at least 1 Second data to accurately backtest systems based on 1 Minute bar indicators.
            Attached Files

            Comment


              #7
              Hello AlgoJason,

              Thank you for your response.

              NinjaTrader backtesting would only run over one series, whether that is the Last, Bid, or Ask. This can be selected in the Data Series settings of the Chart or Strategy Analyzer under the 'Price Based On' option.

              You can run with Tick Replay to have the bars build based on the tick by tick information. Please visit the following links on Tick Replay:

              Please let me know if you have any questions.

              Comment


                #8
                Originally posted by NinjaTrader_PatrickH View Post
                Hello AlgoJason,

                Thank you for your response.

                NinjaTrader backtesting would only run over one series, whether that is the Last, Bid, or Ask. This can be selected in the Data Series settings of the Chart or Strategy Analyzer under the 'Price Based On' option.

                You can run with Tick Replay to have the bars build based on the tick by tick information. Please visit the following links on Tick Replay:

                Please let me know if you have any questions.
                I agree that NT only runs over a single data series. But if you have Trade/last data then that series inherently contains embedded within it some bid and some ask data.

                Trade/Last data flicks between the bid and the ask rapidly. The image I posted illustrates this and that NT sometimes (probably 50% of the time) fills longs at the bid and sells at the ask which leads to unrealistic backtest results in some cases, especially with faster systems.

                I think we are discussing this in this thread now...

                Comment


                  #9
                  Originally posted by AlgoJason View Post
                  I think we are discussing this in this thread now...
                  https://ninjatrader.com/support/foru...d.php?t=107827
                  Agreed, I will follow up with you there.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by jclose, Today, 09:37 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post jclose
                  by jclose
                   
                  Started by WeyldFalcon, 08-07-2020, 06:13 AM
                  10 responses
                  1,413 views
                  0 likes
                  Last Post Traderontheroad  
                  Started by firefoxforum12, Today, 08:53 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post firefoxforum12  
                  Started by stafe, Today, 08:34 PM
                  0 responses
                  10 views
                  0 likes
                  Last Post stafe
                  by stafe
                   
                  Started by sastrades, 01-31-2024, 10:19 PM
                  11 responses
                  169 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X