RoundToNickel

Modified on 2016/11/30 11:42 by Eugene — Categorized as: Community Components

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)); } } }