Log in to see Cloud of Tags

Wealth-Lab Wiki

RoundToNickel

RSS

Syntax

public static double RoundToNickel(this double price)
public static double RoundToNickel(this double price, bool ceiling)

Parameter Description

pricePrice to round
ceilingCeil (true) or floor (false)

Description

This method facilitates AtLimit/AtStop order generation for the stocks participating in the SEC pilot program and which now trade with a tick value larger than $0.01 (1 cent), usually $0.05 (5 cents).

Example

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
/*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions, 2016.12 or later***/

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { ClearDebug(); double d = 11.21; PrintDebug("Testing: " + d); PrintDebug("Nickle Rounded: " + d.RoundToNickel()); PrintDebug("Nickle Ceiling: " + d.RoundToNickel(true)); PrintDebug("Nickle Floored: " + d.RoundToNickel(false)); } } }

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.