## Applying Turtle rules in a mechanical trading system

Discussions about the testing and simulation of mechanical trading systems using historical data and other methods. Trading Blox Customers should post Trading Blox specific questions in the Customer Support forum.
Nabus
Contributor
Posts: 1
Joined: Tue Feb 22, 2005 7:20 am

### Applying Turtle rules in a mechanical trading system

I applied the turtle rules to a program that I wrote in VB.

Below is the simple programming code. But I ran into problems because in the Turtle book it says that the total amount invested as according to the N calculations would be 1 % of the acount, but mathematically roughly 25% of the account was being invested.

We used data from a random day, for the exchange rate and calculated the initial N through the true range for the past 19 days.

txtN.Text = ((Val(txtSMA.Text) * 19) + Abs(Val(txtHIGH.Text) - Val(txtLOW.Text))) / 20

txtDlrPipForAcct.Text = (Val(txtAcctSize.Text) / (Val(txtRATE.Text)) / 10000)
txtVOLATILITY.Text = Val(txtN.Text) * Val(txtDlrPipForAcct.Text)
txtUNIT.Text = (0.01 * Val(txtAcctSize.Text)) / (Val(txtVOLATILITY.Text))
txtCostOfUnit.Text = Val(txtUNIT.Text) * Val(txtRATE.Text)

Initial values were:

txtSMA : 0.009965
txtPIP : 0.0001
txtRATE : 1.1643
txtHIGH : 1.1688
xtLOW : 1.1572
txtAcctSize : 50000

using this program and data, I got dollars per pip = 4.29****

ONE unit : 11588.822**** contracts

Cost of Unit: 13492.86 dollars. ----> this is not 1% of the account. While the turtle book says that using this formula we should get 1% of the account.