Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

newbie looking for hints on developing a backtesting strategy

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

    newbie looking for hints on developing a backtesting strategy

    Hi,

    I'm looking to learn a bit about developing a strategy for backtesting.

    To keep it simple I am looking to write a piece of strategy code that is based on a ninja 0 centred oscillator (can be any as its only a test) and will:

    * be using daily historic data for each instrument (shares)

    * if current day close oscillator is positive AND previous days close oscillator is negative then :

    1. close any previous SELL trade running

    2. IF there is NOT a BUY trade already running this triggers a BUY trade for a set
    value of shares (set value divided by share price gives number of shares)

    IF NEW BUY trade entered set a stop a set %ge away from the buy price

    * if current day close oscillator is negative AND previous days close oscillator is positive then :

    1. close any previous BUY trade running


    2. IF there is NOT a SELL trade already running this triggers a SELL trade for a set
    value of shares (set value divided by share price gives number of shares)


    3. IF NEW SELL trade entered set a stop a set %ge away from the SELL price


    My questions are

    1. am i right in thinking that i can then "backtest" using this strategy instrument by instrument and that these "trades" will just be dummy trades and in effect just give me a nice analysis of trade profit and losses acrioss the period

    2. i guess as this is pretty basic stuff do you know of any ninja strategy code i can crib, particularly for placing/closing the dummy buy/sell orders, checking any orders are existing and setting stops


    thx

    ian

    #2
    Ian,

    It would be possible to make a strategy as you outlined. Most of the items you mentioned can be done without programming them in the Strategy Wizard. I would recommend you check out the following links, as there is a wealth of information in them.

    Help guide : http://www.ninjatrader.com/support/h...strategies.htm

    Tutorial video (Strategy Analyzer) : http://www.ninjatrader.com/support/m...A-Strategy.htm

    NinjaScript Reference samples : http://www.ninjatrader.com/support/f...splay.php?f=30

    Webinars : http://www.ninjatrader.com/webinars

    As far as answers to your questions,

    1. Yes, you are correct. You can use the "Strategy analyzer" to backtest your strategies by doing mock trading based on historical price information. It will then generate a report with various performance statistics.

    2. The reference samples I posted above is a great place to find code you can learn from as well as copy/paste from into your own strategies.

    Should you require the aid of a programmer to implement your strategies, please check out our NinjaScript certified consultants at the following link.

    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hi Adam,

      Spent a couple of nights on it and I am just doing some final hand calculation testing of the stops and it seems to be working perfectly :-) ..

      I have a rudimentary knowledge of c which makes it a bit easier, the hardest part was trying to work out which ninja procedures to use and how to use them as the scant info available is written from an "technical and trading experts" point of view which makes it very difficult for newbies to dive in and get to grips with.

      For other newbies, by far the easiest way to grapple with this is to google the forums and look for bits of code posted which you can crib ... ;-)



      rgds

      ian

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by geddyisodin, 04-25-2024, 05:20 AM
      8 responses
      58 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      4 responses
      3,285 views
      1 like
      Last Post jgualdronc  
      Started by Option Whisperer, Today, 09:55 AM
      0 responses
      5 views
      0 likes
      Last Post Option Whisperer  
      Started by halgo_boulder, 04-20-2024, 08:44 AM
      2 responses
      22 views
      0 likes
      Last Post halgo_boulder  
      Started by mishhh, 05-25-2010, 08:54 AM
      19 responses
      6,189 views
      0 likes
      Last Post rene69851  
      Working...
      X