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
Comment