Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2018-12 | The V-Trade Part 3 (Vervoort)

RSS

Traders' Tip text

The code for Wealth-Lab for the SvePivots by author Sylvain Vervoort is presented. Included Strategy demonstrates how to calculate all the traditional and the new pivot series using data compressed in the Daily scale and then save the information in the Intraday scale so that it can be charted.

Image

Figure 1 illustrates the usual “floor trader” pivots as well as the new “SvePivots”

Code

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies { public class SvePivots : WealthScript { private StrategyParameter paramSwitch; public SvePivots() { paramSwitch = CreateParameter("Show SvePivots?", 1, 0, 1, 1 ); } protected override void Execute() { if(!Bars.IsIntraday) { DrawLabel( PricePane, "Requires intraday data"); Abort(); }

SetScaleDaily(); DataSeries hPivot = AveragePriceC.Series(Bars); DataSeries hDayHigh = High; DataSeries hDayClose = Close; DataSeries hDayLow = Low; RestoreScale(); hPivot = Synchronize( hPivot ) >> 1; hDayHigh = Synchronize( hDayHigh ) >> 1; hDayClose = Synchronize( hDayClose ) >> 1; hDayLow = Synchronize( hDayLow ) >> 1; var hR1 = ( 2 * hPivot - hDayLow ); var hS1 = ( 2 * hPivot - hDayHigh ); var hR2 = ( hPivot - ( hS1 - hR1 ) ); var hS2 = ( hPivot - ( hR1 - hS1 ) ); var hR3 = 2 * hPivot + (hDayHigh - (hDayLow * 2)); var hS3 = 2 * hPivot - ((hDayHigh * 2) - hDayLow);

var hRM1 = (hR1 - hPivot)/2 + hPivot; var hSM1 = (hPivot - hS1)/2 + hS1; var hRM2 = (hR2 - hR1)/2 + hR1; var hSM2 = (hS1 - hS2)/2 + hS2; var hRM3 = (hR3 - hR2)/2 + hR2; var hSM3 = (hS2 - hS3)/2 + hS3; hPivot.Description = "Pivot"; hR1.Description = "R1"; hRM1.Description = "Resistance Mean value 1"; hS1.Description = "S1"; hSM1.Description = "Support Mean value 1"; hR2.Description = "R2"; hRM2.Description = "Resistance Mean value 2"; hS2.Description = "S2"; hSM2.Description = "Support Mean value 2"; hR3.Description = "R3"; hRM3.Description = "Resistance Mean value 3"; hS3.Description = "S3"; hSM3.Description = "Support Mean value 3"; HideVolume(); PlotSeries( PricePane, hR2, Color.Maroon, LineStyle.Dotted, 1); PlotSeries( PricePane, hR1, Color.Olive, LineStyle.Solid, 1 ); PlotSeries( PricePane, hPivot, Color.Blue, LineStyle.Solid, 1 ); PlotSeries( PricePane, hS1, Color.Fuchsia, LineStyle.Dotted, 1 ); PlotSeries( PricePane, hS2, Color.Red, LineStyle.Solid, 1 );

bool showSvePivots = paramSwitch.Value == 1; if(showSvePivots) { PlotSeries( PricePane, hR3, Color.Maroon, LineStyle.Dotted, 1); PlotSeries( PricePane, hS3, Color.Red, LineStyle.Dotted, 1 );

PlotSeries( PricePane, hRM1, Color.Maroon, LineStyle.Dashed, 1); PlotSeries( PricePane, hSM1, Color.Olive, LineStyle.Dashed, 1 ); PlotSeries( PricePane, hRM2, Color.Blue, LineStyle.Dashed, 1 ); PlotSeries( PricePane, hSM2, Color.Fuchsia, LineStyle.Dashed, 1 ); PlotSeries( PricePane, hRM3, Color.Red, LineStyle.Dashed, 1 ); PlotSeries( PricePane, hSM3, Color.Red, LineStyle.Dashed, 1 ); } } } }

Eugene (Gene Geren)
Wealth-Lab team
www.wealth-lab.com

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.


ScrewTurn Wiki. Some of the icons created by FamFamFam.