code for pivots

could anyone help me with programming code for calculating weekly pivots in tradestation? I have EOD OHLC data and i cant get tradestation to calculate weekly pivots in my backttesting.


thannks
 
Here is the code for the intra-day pivot point system which ships with TradersStudio. The current version of TradersStudio can backtest intra-day data down to 1 min bars.



' TradersStudio(r) (C) 2004-2007 All Rights Reserved
Sub IntraDayPivotSys()
Dim YestOpen As BarArray
Dim YestHigh As BarArray
Dim YestLow As BarArray
Dim YestClose As BarArray
Dim S1 As BarArray
Dim S2 As BarArray
Dim R1 As BarArray
Dim R2 As BarArray
Dim MidPoint As BarArray
YestOpen=OpenD
YestHigh=HighD
YestLow=LowD
YestClose=CloseD
MidPoint=(YestHigh+YestLow+YestClose)/3
R1=(2*MidPoint)-YestLow
S1=(2*MidPoint)-YestHigh
R2=MidPoint+R1-S1
S2=MidPoint+S1-R1
If Time<TimeSerial(15,0, 0) And TradesToday()<2 Then Buy("R2BuyBreak",1,R2+getactiveminmove,Stop,Day)
If Time<TimeSerial(15,0, 0) And TradesToday()<2 Then Sell("S2SellBreak",1,S2-getactiveminmove,Stop,Day)
If MarketPosition=1 And TradesToday()<2 Then Sell("FailSell",1,R1-getactiveminmove(),Stop,Day)
If MarketPosition=-1 And TradesToday()<2 Then Buy("FailBuy",1,S1+getactiveminmove(),Stop,Day)
ExitEOD("EndOfDay","",999)
End Sub
 
Back
Top