Home / Pivot Point System

# First Attempt at Pivot-Based System

Carsten’s post about a simple pivot-based trading system was intriguing to me mainly because I have never tried to code such a system. I guessed that coding a proof-of-concept of the system would be pretty easy, and it was.

Here is the code for Tradestation:

inputs:
ATRLength( 10 ), // I used Average True Range as a substitute for Carsten’s “volatility.”
Length( 10 );

variables:
ATR( 0 ),
S1( 0 ),
R1( 0 ),
PP ( 0 );

ATR = AvgTrueRange( ATRLength ) ;
PP = close[1];
S1 = PP – ATR;
R1 = PP + ATR;
If close <= S1 then buy next bar at market;
If close >= R1 then sell short next bar at market;

If currentbar > 1 and marketposition = 1 and close = highest(close, 3) then sell (“LX”) next bar at market;
If currentbar > 1 and marketposition = -1 and close = lowest(close, 3) then buytocover (“SX”) next bar at market;

Here are the results and the equity curve. I assumed 10K starting equity, purchasing only one contract per trade, with no compounding of gains.

Not bad for a first pass. The equity curve is not nearly as nice as Carsten’s version, but again, this was more for practice than anything else.