{ tanh function. Return an approximation to the hyperbolic tangent function. The approximation is given on p. 219 of CRC Standard Mathematical Tables, 26th edition. Mike Bryant Breakout Futures www.BreakoutFutures.com Copyright 2003 } Input: x (NumericSimple), { input to function } NTerms (NumericSimple); { # terms in series } Var: pi (3.1415926536), Sum (0), ii (0); Sum = 0.; For ii = 0 to NTerms Begin Sum = Sum + 1./(Power(((ii + 0.5)*pi), 2) + Power(x, 2)); End; tanh = Sum * 2 * x; { NN Inspired This system uses a neural network-like function to trigger entry. The "weights" of the network are determined by optimization within TradeStation. Mike Bryant Breakout Futures www.BreakoutFutures.com mrb@BreakoutFutures.com Copyright 2003 Breakout Futures } Inputs: w11 (0), { weights } w12 (0), w13 (0), w21 (0), w22 (0), w23 (0), c1 (0), c2 (0), c3 (0); Var: I1 (0), { input 1 } I2 (0), { input 2 } H1 (0), { hidden node 1 } H2 (0), { hidden node 2 } H3 (0), { hidden node 3 } NNOut (0); { function output } { Define inputs: 2 and 10-day momentum, scaled } I1 = (C - C[2])/33; I2 = (C - C[10])/64; { Define "neural net" function } H1 = tanh(w11*I1 + w21*I2, 50); H2 = tanh(w12*I1 + w22*I2, 50); H3 = tanh(w13*I1 + w23*I2, 50); NNOut = tanh(c1*H1 + c2*H2 + c3*H3, 50); {Print("date: ", date:8:0, " NN Output: ", NNOut:6:3);} { Place trades based on function output } If NNOut >= 0.5 then Buy next bar at High stop; If NNOut <= -0.5 then Sell short next bar at low stop; If BarsSinceEntry = 2 then Begin Sell this bar on close; Buy to cover this bar on close; End;