Horace Goes Skiing (free Forex strategy with Ninjascript)

rnicoll

Established member
Messages
500
Likes
14
Here's one from my discard pile that people looking to start on strategies might be interested in. This is an idea I had for trading EUR/CHF, and coded up this morning. The results are mixed; it might make money as an autotrader, but it's too unstable for my tastes. The fact that it gets trades 20-30% right and relies on the profits being much bigger than the losses doesn't help this.

Full source code to the strategy ready to run in Ninjatrader is attached, released under BSD license ( Open Source Initiative OSI - The BSD License:Licensing | Open Source Initiative ). Basic idea is that it creates two "ski slopes" from a Bollinger band pairs, and when the market moves from between the two slopes and into either, it open a trade in the direction of the slope. It closes out when the market leaves the slope. Price data is smoothed using an SMA of 5 periods to reduce hard swerves messsing with the system.

The parameters as supplied work well for GBP/USD over the last 7 months, but it's not designed to last that long un-optimised. I'd suggest a walk-forward optimisation, optimising on 21 days data every 7 days. Oh, and I use minute bars as my data source.

Tested only with Forex, but I'd love to know how it works for anything else.

Hope you find it interesting.

P.S. Hopefully this is obvious, but it's explicitely designed for a trending market.
 

Attachments

  • HoraceGoesSkiing.zip
    6.5 KB · Views: 380
Intruigingly, the script doesn't actually do what I meant. Implemented correctly, it's one of the most interesting ways of losing money I've seen in a long time. As it stands, though, it doesn't actually use the outer band at all...
 
I first learnt to write code on a ZX80. :cool:

Loved those spectrum games though - wasted half my early teenage years playing them.
 
I first learnt to write code on a ZX80. :cool:

Loved those spectrum games though - wasted half my early teenage years playing them.

ZX80? Yikes, and I thought my learning on a BBC B was archaic stuff :)

Y'know, I should probably at some point figure out why the "broken" version of this seems to actually work...
 
My dad was into electronics and built it for us in kit form. You had to write the programs in from magazines basically. It was a great time.(what a sad life I lead)
 
Last edited:
My dad was into electronics and built it for us in kit form. You had to write the programs in from magazines basically. It was a great time.(what a sad life I lead)

My dad was... yeah, lets not have him anywhere near a screwdriver, for the best really..
 
Aaah - I remember spending fkin hours typing in those programs - all that hex code.

Most of the time, they never worked...

I remember typing in Donkey Kong for 2 days straight.... Should have been out playing football instead.
 
Top