FormatPriceMarker()

View as Markdown

Definition

Used to override the default string format of a NinjaScript’s price marker values.

Method Return Value

A virtual string which is overridden from the default price marker value.

Syntax

You must override the method in your indicator with the following syntax:

public override string FormatPriceMarker(double price)

Parameters

ParameterDescription
priceA double value representing the value to be overridden.

Tip

Tip: Standard Numeric Format Strings examples can be found on Microsoft’s Developer Network (MSDN article).

Examples

1// FormatPriceMarker method of a custom indicator
2public override string FormatPriceMarker(double price)
3{
4 // Formats price marker values to 4 decimal places
5 return price.ToString("N4");
6}
7
8protected override void OnBarUpdate()
9{
10 // overriding FormatPriceMarker will ensure display of 4 decimal places
11 MyPlot[0] = (Close[0] + Open[0] * .0025);
12}