TRADERS’ TIPS
For this month’s Traders’ Tips, the focus is mainly Sylvain Vervoort’s article in this issue issue, “Price Projections” which is part 5 of his Exploring Charting Techniques series. Here we present the November 2014 Traders’ Tips code with possible implementations in various software.
Code for NinjaTrader was already provided with Vervoort’s article by the author. S&C subscribers will find that code at the Subscriber Area of our website here. (Click on “S&C Article Code” from the homepage.) Presented here is an overview of some possible implementations for other software as well.
Traders’ Tips code is provided to help the reader implement a selected technique from an article in this issue or another recent issue. The entries here are contributed by various software developers or programmers for software that is capable of customization.
In “Price Projections” in this issue, which is part 5 of an ongoing series titled Exploring Charting Techniques, author Sylvain Vervoort introduces several methods he uses for defining possible support & resistance levels. In the article, Vervoort provides code for his version of a daily pivot indicator that calculates support & resistance based on the prior day’s high, low, and closing prices. We are providing TradeStation EasyLanguage code for a daily pivot indicator based on the calculations given in Vervoort’s article.
To download the EasyLanguage code, please visit our TradeStation and EasyLanguage support forum. The code can be found at https://www.tradestation.com/TASC-2014. The ELD filename is "_TASC_SVEPivots.ELD."
The code is also shown below.
_TASC_SVEPivots (Indicator) {Reference: Technical Analysis of Stocks & Commodities, Nov. 2014. Article: Price Projections Indicator Name: _TASC_SVEPivots} inputs: UseSessionBreak( True ), DrawTrendlines( True ), DrawPlots( False ), DrawTextBoxes( True ), PivotThickness( 2 ), PivotColor( RGB( 254, 204, 176 ) ), R1Color( RGB( 238, 92, 66 ) ), R2Color( RGB( 238, 44, 44 ) ), R3Color( RGB( 255, 0, 0 ) ), S1Color( RGB( 124, 205, 124 ) ), S2Color( RGB( 118, 238, 0 ) ), S3Color( RGB( 0, 255, 0 ) ), ShowR3( True ), ShowR2( True ), ShowR1( True ), ShowPP( True ), ShowS1( True ), ShowS2( True ), ShowS3( True ) ; variables: MyPIP( 0 ), NumDecimals( 0 ), CS( 0 ), S1( 0 ), S2( 0 ), S3( 0 ), R1( 0 ), R2( 0 ), R3( 0 ), PP( 0 ), S1_ID( 0 ), S2_ID( 0 ), S3_ID( 0 ), R1_ID( 0 ), R2_ID( 0 ), R3_ID( 0 ), PP_ID( 0 ), S1_TextID( 0 ), S2_TextID( 0 ), S3_TextID( 0 ), R1_TextID( 0 ), R2_TextID( 0 ), R3_TextID( 0 ), PP_TextID( 0 ), TodaysHigh( 0 ), YestHigh( 0 ), TodaysLow( 0 ), YestLow( 0 ), TodaysClose( 0 ), YestClose( 0 ), CalcTrigger( false ), Counter( 0 ) ; if CurrentBar = 1 then begin MyPIP = MinMove / PriceScale * 10 ; if Category = 12 then NumDecimals = Log( PriceScale ) / Log( 10 ) - 1 else NumDecimals = Log( PriceScale ) / Log( 10 ) ; end ; CS = CurrentSession( 0 ) ; if UseSessionBreak then CalcTrigger = CS <> CS[1] else CalcTrigger = Date <> Date[1] ; if CalcTrigger then begin Counter = Counter + 1 ; YestHigh = TodaysHigh ; YestLow = TodaysLow ; YestClose = Close[1] ; TodaysHigh = High ; TodaysLow = Low ; PP = ( YestHigh + YestLow + YestClose ) / 3 ; R1 = PP * 2 - YestLow ; R2 = PP + YestHigh - YestLow ; R3 = ( 2*PP ) + ( YestHigh -( 2 * YestLow ) ) ; S1 = PP * 2 - YestHigh ; S2 = PP - YestHigh + YestLow ; S3 = ( 2 * PP ) - ( ( 2 * YestHigh ) - YestLow ) ; if DrawTrendlines then begin if ShowS1 then begin S1_ID = TL_New( Date, Time, S1, Date, Time, S1 ) ; TL_SetColor( S1_ID, S1Color ) ; end ; if ShowS2 then begin S2_ID = TL_New( Date, Time, S2, Date, Time, S2 ) ; TL_SetColor( S2_ID, S2Color ) ; end ; if ShowS3 then begin S3_ID = TL_New( Date, Time, S3, Date, Time, S3 ) ; TL_SetColor( S3_ID, S3Color ) ; TL_SetSize( S3_ID, 1 ) ; end ; if ShowR1 then begin R1_ID = TL_New( Date, Time, R1, Date, Time, R1 ) ; TL_SetColor( R1_ID, R1Color ) ; end ; if ShowR2 then begin R2_ID = TL_New( Date, Time, R2, Date, Time, R2 ) ; TL_SetColor( R2_ID, R2Color ) ; end ; if ShowR3 then begin R3_ID = TL_New( Date, Time, R3, Date, Time, R3 ) ; TL_SetColor( R3_ID, R3Color ) ; TL_SetSize( R3_ID, 1 ) ; end ; if ShowPP then begin PP_ID = TL_New( Date, Time, PP, Date, Time, PP ) ; TL_SetColor( PP_ID, PivotColor ) ; TL_SetSize( PP_ID, PivotThickness ) ; end ; end ; if DrawTextBoxes then begin if ShowS1 then S1_TextID = Text_New( Date, Time, S1, "S1: " + NumToStr( S1, NumDecimals ) ) ; if ShowS2 then S2_TextID = Text_New( Date, Time, S2, "S2: " + NumToStr( S2, NumDecimals ) ) ; if ShowS3 then S3_TextID = Text_New( Date, Time, S3, "S3: " + NumToStr( S3, NumDecimals ) ) ; if ShowR1 then R1_TextID = Text_New( Date, Time, R1, "R1: " + NumToStr( R1, NumDecimals ) ) ; if ShowR2 then R2_TextID = Text_New( Date, Time, R2, "R2: " + NumToStr( R2, NumDecimals ) ) ; if ShowR3 then R3_TextID = Text_New( Date, Time, R3, "R3: " + NumToStr( R3, NumDecimals ) ) ; if ShowPP then PP_TextID = Text_New( Date, Time, PP, "PP: " + NumToStr( PP, NumDecimals ) ) ; if ShowS1 then Text_SetStyle( S1_TextID, 0, 0 ) ; if ShowS2 then Text_SetStyle( S2_TextID, 0, 0 ) ; if ShowS3 then Text_SetStyle( S3_TextID, 0, 0 ) ; if ShowPP then Text_SetStyle( PP_TextID, 0, 0 ) ; if ShowR1 then Text_SetStyle( R1_TextID, 0, 1 ) ; if ShowR2 then Text_SetStyle( R2_TextID, 0, 1 ) ; if ShowR3 then Text_SetStyle( R3_TextID, 0, 1 ) ; end ; end else begin if High > TodaysHigh then TodaysHigh = High ; if Low < TodaysLow then TodaysLow = Low ; if DrawTrendlines then begin if S1_ID > 0 and ShowS1 and OneAlert( True ) then TL_SetEnd( S1_ID, Date, Time, S1 ) ; if S2_ID > 0 and ShowS2 and OneAlert( True ) then TL_SetEnd( S2_ID, Date, Time, S2 ) ; if S3_ID > 0 and ShowS3 and OneAlert( True ) then TL_SetEnd( S3_ID, Date, Time, S3 ) ; if R1_ID > 0 and ShowR1 and OneAlert( True ) then TL_SetEnd( R1_ID, Date, Time, R1 ) ; if R2_ID > 0 and ShowR2 and OneAlert( True ) then TL_SetEnd( R2_ID, Date, Time, R2 ) ; if R3_ID > 0 and ShowR3 and OneAlert( True ) then TL_SetEnd( R3_ID, Date, Time, R3 ) ; if PP_ID > 0 and ShowPP and OneAlert( True ) then TL_SetEnd( PP_ID, Date, Time, PP ) ; end ; end ; if DrawPlots then begin if Counter >= 2 and BarType < 3 then begin if ShowR3 then Plot1( R3, "R3" ) ; if ShowR2 then Plot2( R2, "R2" ) ; if ShowR1 then Plot3( R1, "R1" ) ; if ShowPP then Plot4( PP, "PP" ) ; if ShowS1 then Plot5( S1, "S1" ) ; if ShowS2 then Plot6( S2, "S2" ) ; if ShowS3 then Plot7( S3, "S3" ) ; end ; end ;
For more information about EasyLanguage in general, please see https://www.tradestation.com/EL-FAQ.
A sample chart implementing the indicator is shown in Figure 1.
FIGURE 1: TRADESTATION. Here is a sample 30-minute chart of the SPY with the daily pivot indicator applied.
This article is for informational purposes. No type of trading or investment recommendation, advice, or strategy is being made, given, or in any manner provided by TradeStation Securities or its affiliates.
For this month’s Traders’ Tip, we’ve provided the formula SVEPivotsUtcRt.efs based on the formula described in Sylvain Vervoort’s article in this issue, “Price Projections” in his ongoing Exploring Charting Techniques series.
The study contains formula parameters that may be configured through the edit chart window (right-click on the chart and select “edit chart”). A sample chart implementing the study is shown in Figure 2.
FIGURE 2: eSIGNAL. Here is an example of the study implemented on a 30-minute chart of the Euro Composite.
To discuss this study or download a complete copy of the formula code, please visit the EFS Library Discussion Board forum under the forums link from the support menu at www.esignal.com, or visit our EFS KnowledgeBase at https://www.esignal.com/support/kb/efs/. The eSignal formula script (EFS) is also available for copying & pasting below.
/********************************* Provided By: Interactive Data Corporation (Copyright © 2014) All rights reserved. This sample eSignal Formula Script (EFS) is for educational purposes only. Interactive Data Corporation reserves the right to modify and overwrite this EFS file with each new release. Description: Price Projections by Sylvain Vervoort Version: 1.00 09/04/2014 Notes: The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com. **********************************/ function preMain(){ setPriceStudy(true); setStudyTitle("SVEPivotsUtcRt"); setCursorLabelName("PH", 0); setCursorLabelName("PL", 1); setCursorLabelName("PP", 2); setCursorLabelName("R1", 3); setCursorLabelName("R2", 4); setCursorLabelName("R3", 5); setCursorLabelName("S1", 6); setCursorLabelName("S2", 7); setCursorLabelName("S3", 8); setDefaultBarFgColor(Color.RGB(0x4B,0x9B,0x4B), 0); setDefaultBarFgColor(Color.RGB(0x9B,0x4B,0xFF), 1); setDefaultBarFgColor(Color.RGB(0x9B,0x9B,0x9B), 2); setDefaultBarFgColor(Color.RGB(0x00,0x00,0xFF), 3); setDefaultBarFgColor(Color.RGB(0x32,0x7D,0xFF), 4); setDefaultBarFgColor(Color.RGB(0x00,0xFF,0xFF), 5); setDefaultBarFgColor(Color.RGB(0xFF,0x65,0x00), 6); setDefaultBarFgColor(Color.RGB(0xFF,0x94,0x00), 7); setDefaultBarFgColor(Color.RGB(0xFF,0xC8,0x00), 8); setDefaultBarStyle(PS_SOLID, 0); setDefaultBarStyle(PS_SOLID, 1); setDefaultBarStyle(PS_DASH, 2); setDefaultBarStyle(PS_DASH, 3); setDefaultBarStyle(PS_DASH, 4); setDefaultBarStyle(PS_DASH, 5); setDefaultBarStyle(PS_DASH, 6); setDefaultBarStyle(PS_DASH, 7); setDefaultBarStyle(PS_DASH, 8); } var bInit = false; var bVersion = null; var xHigh = null; var xLow = null; var xClose = null; function main(){ if (bVersion == null) bVersion = verify(); if (bVersion == false) return; if(isMonthly() || isWeekly()) return; if(bInit == false){ xHigh = high(inv("D")); xLow = low(inv("D")); xClose = close(inv("D")); bInit = true; } var vHigh = xHigh.getValue(-1); var vLow = xLow.getValue(-1); var vClose = xClose.getValue(-1); if(vHigh == null || vLow == null || vClose == null) return; var vPP = (vHigh + vLow + vClose) / 3; var vR1 = 2*vPP - vLow; var vS1 = 2*vPP - vHigh; var vR2 = vPP + (vHigh - vLow); var vS2 = vPP - (vHigh - vLow); var vR3 = 2*vPP + (vHigh - 2*vLow); var vS3 = 2*vPP - (2*vHigh - vLow); return [vHigh, vLow, vPP, vR1, vR2, vR3, vS1, vS2, vS3]; } function verify(){ var b = false; if (getBuildNumber() < 779){ drawTextAbsolute(5, 35, "This study requires version 8.0 or later.", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "error"); drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=https://www.esignal.com/download/default.asp", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "upgrade"); return b; } else b = true; return b; }
In his article in this issue, “Price Projections,” which is part 5 of his ongoing series on exploring charting techniques, author Sylvain Vervoort introduces his SVEPivotsUtcRt indicator as a way of drawing daily pivots on the chart. In today’s trading platforms, the ability draw pivots is commonplace, and Wealth-Lab is no exception. Thus, we don’t need to provide any custom code.
After you download all the available strategies using the download button in the open strategy dialog, look for the strategy named “floor trader pivots.” Likewise, the other techniques mentioned by Vervoort — namely, the step candle pattern and 1-2-3 wave count — are also ready to be explored as downloadable strategies in Wealth-Lab.
A sample chart showing some floor trader pivots is in Figure 3.
FIGURE 3: WEALTH-LAB, PIVOTS. Here is a sample Wealth-Lab 6 chart illustrating the application of the floor trader pivots trading system on a five-minute chart of Twitter (TWTR).
In “Price Projections” in this issue, author Sylvain Vervoort discusses more elements of charting in his ongoing series on exploring charting techniques, including measured moves, Fibonacci projections & retracements, and daily pivots. Here, we’ll take a look at how some of the charting techniques he describes can be invoked in NeuroShell Trader.
Price levels and projections can be easily implemented in NeuroShell Trader using the following methods:
Pivot Point PP: Avg3(DayHigh(High,1), DayLow(Low,1), DayClose(Close,1)) Resistance R1: Subtract(Add2(PP, PP), DayLow(Low,1)) Resistance R2: Add2(PP, DayRange(High,Low1)) Resistance R3: Add2(R1, DayRange(High,Low1)) Support S1: Subtract(Add2(PP, PP), DayHigh(High,1)) Support S2: Subtract(PP, DayRange(High,Low1)) Support S3: Subtract(S1, DayRange(High,Low1))
Users of NeuroShell Trader can go to the STOCKS & COMMODITIES section of the NeuroShell Trader free technical support website to download a copy of this or any previous Traders’ Tips.
A sample chart is shown in Figure 4.
FIGURE 4: NEUROSHELL TRADER. This sample NeuroShell Trader chart displays a few of the turning point add-on indicators.
Sylvain Vervoort’s article in this issue, “Price Projections,” includes his version of daily pivots. The following MetaStock formula is designed to change “days” when the Coordinated Universal Time (UTC or GMT) shows midnight. The formula prompts the user to enter his time zones UTC adjustment. If the indicator is being plotted on a daily or higher interval, the UTC adjustment is not used.
rollmod:= Input("Coordinated Universal Time (or UTC) adjustment", -12, 13, -5); rolltime:= If(rollmod >= 0, rollmod, 24-rollmod); roll:= If(rolltime = 0, Hour() < Ref(Hour(),-1), Hour() < rolltime AND Hour() >= rolltime); intraday:= LastValue(Max(Cum(Hour())<>0, Cum(Minute())<>0) >0); new:=If(intraday, roll, ROC(DayOfWeek(),1,$)<>0); yh:=ValueWhen(1,new, Ref(HighestSince(1,new,H),-1)); yl:=ValueWhen(1,new, Ref(LowestSince(1,new,L),-1)); yc:=ValueWhen(1,new, Ref(C,-1)); pp:=(yc+yh+yl)/3; r1:=(pp*2)-yl; s1:=(pp*2)-yh; r2:= pp+r1-s1; s2:= pp-r1+s1; r3:= pp+r2-s2; s3:= pp-r2+s2; r3; r2; r1; pp; s1; s2; s3;
In “Price Projections” in this issue, author Sylvain Vervoort continues his article series on charting techniques, including using daily pivot points to estimate future price levels.
A ready-to-use AmiBroker formula for daily pivots is presented here. A sample chart is shown in Figure 5.
LISTING 1. ph = TimeFrameGetPrice("H", inDaily, -1 ); pl = TimeFrameGetPrice("L", inDaily, -1 ); pc = TimeFrameGetPrice("C", inDaily, -1 ); PP = ( PH + PL + PC )/3; R1 = 2 * PP - PL; R2 = PP + PH - PL; R3 = R1 + PH - PL; S1 = 2 * PP - PH; S2 = 2 * PP - PH - PL; S3 = S1 - PH - PL; Plot( C, "Price", colorDefault, styleBar | styleThick ); Plot( PH, "PH", colorGreen, styleNoRescale ); Plot( PL, "PL", colorViolet, styleNoRescale ); Plot( PP, "PP", colorBlack, styleNoRescale ); Plot( R1, "R1", colorBlue, styleDashed | styleNoRescale ); Plot( R2, "R2", colorLightBlue, styleDashed | styleNoRescale ); Plot( R3, "R3", colorAqua, styleDashed | styleNoRescale ); Plot( S1, "S1", colorRed, styleDashed | styleNoRescale ); Plot( S2, "S2", colorOrange, styleDashed | styleNoRescale ); Plot( S3, "S3", colorDarkYellow, styleDashed | styleNoRescale );
FIGURE 5: AMIBROKER. Here is a sample EURUSD 30-minute chart with daily pivots and support/resistance levels shown.
The AIQ code for this month is based on Sylvain Vervoort’s article in this issue, “Price Projections,” which is part 5 of his ongoing series on exploring charting techniques. The AIQ code and EDS file can be downloaded from www.TradersEdgeSystems.com/traderstips.htm.
The code runs on daily bars only and computes the various support & resistance levels for the next day’s intraday trading. The levels cannot be plotted on the real-time alerts chart.
In Figure 6, I show a report that was run on the major indexes for 9/10/2014.
FIGURE 6: AIQ. Support & resistance levels are calculated based on end-of-day data as of 9/10/2014 for the major indexes. The levels are for use in intraday trading for the next day (9/11/2014).
The code is as follows:
!PRICE PROJECTIONS !Author: Sylvain Vervoort, TASC Nov 2014 !Coded by: Richard Denning 9/10/2014 !www.TradersEdgeSystems.com C is [close]. H is [high]. L is [low]. !To get next day levels we will be running the report at the end of day !so prior high will be the current H, etc. The report will give the values for !the next day but cannot be ploted on a real time chart since we are using !daily end of day data to compute the levels. !THIS CODE RUNS ON DAILY DATA: P is (H+L+C)/3. R1 is (2*P) - L. R2 is P + (H - L). R3 is (2*P) + (H - (2*L)). S1 is (2*P) - H. S2 is P - (H - L). S3 is (2*P) - ((2*H) - L). NextDayLevels if C > 0 and H > 0 and L > 0 and H - L > 0.
The TradersStudio code based on Sylvain Vervoort’s article in this issue, “Price Projections,” is provided at the following websites:
The following code files are provided in the download:
The support & resistance levels can be displayed on any historical intraday chart. The code uses the same data file compressed to daily data by setting it up as the child datastream with the type set to “daily.” Note that this cannot be used to trade intraday, as TradersStudio does not as of yet have a real-time module.
In Figure 7, I show a chart of the emini futures contract (ES) 60-minute bars with the support & resistance levels calculated from yesterday’s daily bar data.
FIGURE 7: TRADERSSTUDIO, SUPPORT & RESISTANCE. Here is a sample chart of the emini futures contract (ES) 60-minute bars with the support & resistance levels calculated from yesterday’s daily bar data.
The code is as follows:
'PRICE PROJECTIONS 'Author: Sylvain Vervoort, TASC Nov 2014 'Coded by: Richard Denning 9/10/2014 'www TradersEdgeSystems.com Function PIVOTS(PriceH as bararray,PriceL as bararray,PriceC as bararray,ByRef P,ByRef R1,ByRef R2, ByRef R3, ByRef S1, ByRef S2, ByRef S3) 'THIS CODE RUNS ON DAILY DATA AND COMPUTES THE NEXT DAYS SUPPORT AND RESISTANCE LEVELS: 'Dim P As BarArray P = (PriceH+PriceL+PriceC)/3 R1 = (2*P) - PriceL R2 = P + (PriceH - PriceL) R3 = (2*P) + (PriceH - (2*PriceL)) S1 = (2*P) - PriceH S2 = P - (PriceH - PriceL) S3 = (2*P) - ((2*PriceH) - PriceL) PIVOTS = P End Function '------------------------------------------------------------------------------------------------------------------------------------------- 'INDICATOR PLOT CODE: Sub PIVOTS_IND() Dim priceH As BarArray Dim priceL As BarArray Dim priceC As BarArray Dim P As BarArray Dim R1 As BarArray Dim R2 As BarArray Dim R3 As BarArray Dim S1 As BarArray Dim S2 As BarArray Dim S3 As BarArray priceH = H Of independent1 priceL = L Of independent1 priceC = C Of independent1 P = PIVOTS(priceH,priceL,priceC,P,R1,R2,R3,S1,S2,S3) plot1(R1[1]) plot2(R2[1]) plot3(R3[1]) plot4(S1[1]) plot5(S2[1]) plot6(S3[1]) End Sub '-------------------------------------------------------------------------------------------------------------------------------------------- sub DISPLAY_PIVOTS() Dim DailyData As BarArray DailyData = C Of independent1 If BarNumber > BarSize Then Buy("LE",1,0,Market,Day) If BarNumber = LastBar - 1 Then ExitLong("LX","",1,0,Market,Day) End Sub '-------------------------------------------------------------------
Our Traders’ Tip for this month is based on the article “Price Projections” in this issue by Sylvain Vervoort, which is the fifth part of his ongoing series, Exploring Charting Techniques.
In the article, Vervoort defines a set of pivot points, which are supposed places of support or resistance, based on ratios of the previous day’s high, low and close. These levels are then plotted over the current day’s price.
Hardcoded versions of Fibonacci levels already exist in Updata, so we don’t need to provide custom code for those.
The Updata code for Vervoort’s technique of finding pivot points has been introduced into the Updata Library. You can download the code by clicking the custom menu and then indicator library. Those who cannot access the library due to a firewall may paste the code shown here into the Updata custom editor and save it.
'Pivot Points NAME "Pivots" "" DISPLAYSTYLE 7LINES INDICATORTYPE TOOL PLOTSTYLE THICK2 RGB(0,0,255) PLOTSTYLE2 LINE RGB(150,150,150) PLOTSTYLE3 LINE RGB(150,150,150) PLOTSTYLE4 LINE RGB(150,150,150) PLOTSTYLE5 LINE RGB(150,150,150) PLOTSTYLE6 LINE RGB(150,150,150) PLOTSTYLE7 LINE RGB(150,150,150) @RUNNINGHIGH=0 @RUNNINGLOW=0 @THISDAYOPEN=0 @LASTDAYCLOSE=0 @LASTDAYHIGH=0 @LASTDAYLOW=0 @LASTDAYOPEN=0 @PivotPoint=0 @R1=0 @R2=0 @R3=0 @S1=0 @S2=0 @S3=0 FOR #CURDATE=0 TO #LASTDATE If #CURDAY!=HIST(#CURDAY,1) @LASTDAYCLOSE=HIST(CLOSE,1) @LASTDAYHIGH=HIST(@RUNNINGHIGH,1) @LASTDAYLOW=HIST(@RUNNINGLOW,1) @LASTDAYOPEN=HIST(@THISDAYOPEN,1) 'At the start of a new day, initialise OHL values @RUNNINGHIGH=HIGH @RUNNINGLOW=LOW @THISDAYOPEN=OPEN @PLOT=-10000 @PLOT2=-10000 @PLOT3=-10000 @PLOT4=-10000 @PLOT5=-10000 @PLOT6=-10000 @PLOT7=-10000 Else If HIGH>@RUNNINGHIGH @RUNNINGHIGH=HIGH ElseIf LOW<@RUNNINGLOW @RUNNINGLOW=LOW EndIf @PivotPoint=(@LASTDAYHIGH+@LASTDAYLOW+@LASTDAYCLOSE)/3 @R1=2*@PivotPoint-@LASTDAYLOW @S1=2*@PivotPoint-@LASTDAYHIGH @R2=@PivotPoint+(@LASTDAYHIGH-@LASTDAYLOW) @S2=@PivotPoint-(@LASTDAYHIGH-@LASTDAYLOW) @R3=(2*@PivotPoint)+(@LASTDAYHIGH-(2*@LASTDAYLOW)) @S3=2*@PivotPoint-((2*@LASTDAYHIGH)-@LASTDAYLOW) @PLOT=@PivotPoint @PLOT2=@S1 @PLOT3=@R1 @PLOT4=@S2 @PLOT5=@R2 @PLOT6=@S3 @PLOT7=@R3 EndIf NEXT
A sample figure is shown in Figure 8.
FIGURE 8: UPDATA, PIVOT POINTS. Here is an example of Sylvain Vervoort’s described technique for finding pivot points applied to the currency pair EUR/USD in 60-minute resolution.
Since NinjaScript code for NinjaTrader was already given in Sylvain Vervoort’s article in this issue (“Price Projections”) for his techniques in this month’s installment of his “Exploring Charting Techniques” series, we’ll focus here on another topic: the choppiness index.
The choppiness index was designed to help determine whether the market is choppy (that is, trading sideways) or not (trading with a trend in either direction). This study is not meant to predict the future market direction, but rather, it’s just a metric to be used for defining the market’s trendiness. Higher values equate to more choppiness, while lower values signify more directional trending character in price.
However, it can be hard to determine the exact trend in which the market is making with the lower values. With this in mind, we have included additional checks for when our values are falling and our closing prices start to go below or above a moving average. If the market is trending up, we will see a green study plot; if down, a red one.
This indicator is available for download at www.ninjatrader.com/SC/November2014SC.zip.
Once you have it downloaded, from within the NinjaTrader Control Center window, select the menu File → Utilities → Import NinjaScript and select the downloaded file. This file is for NinjaTrader version 7 or greater.
You can review the indicator source code by selecting the menu Tools → Edit NinjaScript → Indicator from within the NinjaTrader Control Center window and selecting the “ChopIndicator” file.
NinjaScript uses compiled DLLs that run native, not interpreted, which provides you with the highest performance possible.
A sample chart implementing the choppiness index is shown in Figure 9.
FIGURE 9: NINJATRADER, CHOPPINESS INDEX. This screenshot shows the indicator applied to a 15-minute EuroFX futures chart in NinjaTrader.