| Trading Indicators Post your custom trading indicators. If you download, remember to click INSTALL. |
![]() | | Tweet | |
Floor Trader Pivots @session Times Details »» | |||||||||||||||||||||||||||
Hi all, I'm posting this Floor Trader Pivots indicator because it's been modified for use with session times rather than a 'new day' crossover. For FTPs to work properly with futures or forex they must be based on the session times. eg. ES 330pm -315pm CT and forex 5pm-5pm ET (although some use other times for forex) not to mention weekend times being different from weekday times as well. I found the standard TS FTP indicator does not use session times, so after a frustrating weeks search I was nearly ready to buy (hit me now!) a commercial FTP indicator. The answer to my problem was from the tradestation forum: I simply had to use : Code: if currentsession(0)<>currentsession(0)[1] Code: if date<>date[1] Here is the complete code: Code: {Floor Trader Pivots with session time use}
inputs:
Plot_5or7( 5), { if 7, adds plots for S3 and R3 to other 5 lines }
PlotDailyPivots ( true),
PlotWeeklyPivots (true),
PlotMonthlyPivots (true),
PlotDailyMidPts( true),
PlotWeeklyMidPts( true),
PlotMonthlyMidPts( true);
variables:
S1( 0 ), WeekS1( 0 ), MonthS1( 0 ),
S2( 0 ), WeekS2( 0 ), MonthS2( 0 ),
S3( 0 ), WeekS3( 0 ), MonthS3( 0 ),
R1( 0 ), WeekR1( 0 ), MonthR1( 0 ),
R2( 0 ), WeekR2( 0 ), MonthR2( 0 ),
R3( 0 ), WeekR3( 0 ), MonthR3( 0 ),
PP( 0 ), WeekPP( 0 ), MonthPP( 0 ),
YestHigh( 0 ), LastWeekHigh( 0 ), LastMonthHigh( 0 ),
YestLow( 0 ), LastWeekLow( 0 ), LastMonthLow( 0 ),
YestClose( 0 ), LastWeekClose( 0 ), LastMonthClose( 0 ),
Counter( 0 ) ;
if currentsession(0) <> currentsession(0)[1] then //session times
//if Date <> Date[1] then //midnight open/close
begin
{ increment Counter to be sure enough data is processed - see comment below }
Counter = Counter + 1 ;
YestHigh = HighD( 1 ) ;
YestLow = LowD( 1 ) ;
YestClose = CloseD( 1 ) ;
PP = ( YestHigh + YestLow + YestClose ) / 3 ;
R1 = PP * 2 - YestLow ;
R2 = PP + YestHigh - YestLow ;
R3 = R2 + YestHigh - YestLow ;
S1 = PP * 2 - YestHigh ;
S2 = PP - YestHigh + YestLow ;
S3 = S2 - YestHigh + YestLow ;
end ;
if DayofWeek( Date ) < DayofWeek( Date[1] ) then
begin
LastWeekHigh = HighW( 1 ) ;
LastWeekLow = LowW( 1 ) ;
LastWeekClose = CloseW( 1 ) ;
WeekPP = ( LastWeekHigh + LastWeekLow + LastWeekClose ) / 3 ;
WeekR1 = WeekPP * 2 - LastWeekLow ;
WeekR2 = WeekPP + LastWeekHigh - LastWeekLow ;
WeekR3 = WeekR2 + LastWeekHigh - LastWeekLow ;
WeekS1 = WeekPP * 2 - LastWeekHigh ;
WeekS2 = WeekPP - LastWeekHigh + LastWeekLow ;
WeekS3 = WeekS2 - LastWeekHigh + LastWeekLow ;
end ;
if Month( Date ) <> Month( Date[1] ) then // detected a new month
begin
LastMonthHigh = HighM( 1 ) ;
LastMonthLow = LowM( 1 ) ;
LastMonthClose = CloseM( 1 ) ;
MonthPP = ( LastMonthHigh + LastMonthLow + LastMonthClose ) / 3 ;
MonthR1 = MonthPP * 2 - LastMonthLow ;
MonthR2 = MonthPP + LastMonthHigh - LastMonthLow ;
MonthR3 = MonthR2 + LastMonthHigh - LastMonthLow ;
MonthS1 = MonthPP * 2 - LastMonthHigh ;
MonthS2 = MonthPP - LastMonthHigh + LastMonthLow ;
MonthS3 = MonthS2 - LastMonthHigh + LastMonthLow ;
end ;
if Counter >= 2 then { if at least one full day's data has been
processed}
begin
if bartype=0 then //tick chart only
begin
if PlotDailyPivots = true then
begin
if Plot_5or7 = 7 then
Plot1( R3, "R3" ) ;
Plot2( R2, "R2" ) ;
Plot3( R1, "R1" ) ;
Plot4( PP, "PP" ) ;
Plot5( S1, "S1" ) ;
Plot6( S2, "S2" ) ;
if Plot_5or7 = 7 then
Plot7( S3, "S3" ) ;
end;
if PlotDailyMidPts then
begin
Plot22((PP+S1)/2,"PPmidS1");
Plot23((S1+S2)/2,"S1midS2");
Plot24((S2+S3)/2,"S2midS3");
Plot25((PP+R1)/2,"PPmidR1");
Plot26((R1+R2)/2,"R1midR2");
Plot27((R2+R3)/2,"R2midR3");
end;
end;
if bartype<=1 then //tick and intraday chart only
begin
if PlotWeeklyPivots = true then
begin
if Plot_5or7 = 7 then
Plot8( WeekR3, "WeekR3" ) ;
Plot9( WeekR2, "WeekR2" ) ;
Plot10( WeekR1, "WeekR1" ) ;
Plot11( WeekPP, "WeekPP" ) ;
Plot12( WeekS1, "WeekS1" ) ;
Plot13( WeekS2, "WeekS2" ) ;
if Plot_5or7 = 7 then
Plot14( WeekS3, "WeekS3" ) ;
end;
if PlotWeeklyMidPts then
begin
Plot28((WeekPP+WeekS1)/2,"WPPmidWS1");
Plot29((WeekS1+WeekS2)/2,"WS1midWS2");
Plot30((WeekS2+WeekS3)/2,"WS2midWS3");
Plot31((WeekPP+WeekR1)/2,"WPPmidWR1");
Plot32((WeekR1+WeekR2)/2,"WR1midWR2");
Plot33((WeekR2+WeekR3)/2,"WR2midWR3");
end;
end;
if bartype<=2 then //tick, intraday or daily chart only
begin
if PlotMonthlyPivots = True then
begin
if Plot_5or7 = 7 then
Plot15( MonthR3, "MonthR3" ) ;
Plot16( MonthR2, "MonthR2" ) ;
Plot17( MonthR1, "MonthR1" ) ;
Plot18( MonthPP, "MonthPP" ) ;
Plot19( MonthS1, "MonthS1" ) ;
Plot20( MonthS2, "MonthS2" ) ;
if Plot_5or7 = 7 then
Plot21( MonthS3, "MonthS3" ) ;
end;
if PlotMonthlyMidPts then
begin
Plot34((MonthPP+MonthS1)/2,"MPPmidMS1");
Plot35((MonthS1+MonthS2)/2,"MS1midMS2");
Plot36((MonthS2+MonthS3)/2,"MS2midMS3");
Plot37((MonthPP+MonthR1)/2,"MPPmidMR1");
Plot38((MonthR1+MonthR2)/2,"MR1midMR2");
Plot39((MonthR2+MonthR3)/2,"MR2midMR3");
end;
end;
end; Bear in mind I have hard coded the FTPs to appear a certain way based on my chart type. eg. daily pivots will not appear on anything but a tick chart, weekly will not appear on daily chart, simply because it gets too cluttered and I was tired of having to change the inputs tab everytime I changed the timeframe. Since I use multiple time frame charts next to each other I can see them all together. I personally like to see the FTPs as lines, but you can eliminate the 'joining lines' as the FTPs change by using left ticks or dots. Some issues: 1) Tick chart FTPs may be slightly different from correct daily, weekly etc.. This I believe is because of the 'lack of time factor'. I don't know of a solution for this other than keeping an intraday pivot chart next to your tick chart. The Data2 solution (below) does not work with tick charts either. Any ideas? 2) This indicator WILL NOT WORK on a futures day session chart eg. ES.D in its current format above as it does not take into account the highs and the lows of the overnight session. However you could add a hidden Data2 (plot DAILY Globex) and change the code regarding yesterday's H,L and C. Code: YestHigh = HighD( 1, data2) ; YestLow = LowD( 1 , data2) ; YestClose = CloseD( 1, data2) ; Make sure when you have plotted the indicator that you check a reliable Pivot website and crosscheck your data. I find I need to set up a custom session (I call Globex) set with the exact Globex futures times for the FTPs to be accurate. BTW does anyone know how to code to plot differently for different minute or tick timeframes eg. 5min compared to 240min etc.? I find the 'bartype' reserved word a little to inflexible. Enjoy. Download Now
Screenshots Show Your Support
| |||||||||||||||||||||||||||
| Comments |
![]() |
| Thread Tools | |
| Help Others By Rating This Thread | |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Floor Pivots Monthly | Robert2617 | Trading Indicators | 7 | 07-20-2009 08:30 PM |
| Custom Columns & Session Times | Pepperdog | Linnsoft | 1 | 05-26-2009 03:14 PM |
| Floor Pivots Daily | Robert2617 | Trading Indicators | 16 | 01-30-2008 07:43 PM |
| Floor Trader Pivot Code Help.... | jmi88 | Coding Forum | 1 | 05-22-2007 10:13 PM |
| Floor Pivots Weekly | Robert2617 | Trading Indicators | 0 | 02-19-2007 02:17 PM |