NumUnits (Function)

image\trumpet2.gif Disclaimer

The NumUnits function returns the number of shares/contracts for a dollar investment.

Syntax

NumUnits(Amnt, MinLot)

Returns (Integer)

A number of shares/contracts based on the Amnt and MinLot values specified.

Parameters

Name

Type

Description

Amnt

Numeric

Sets the investment amount, in dollars, per trade

MinLot

Numeric

Sets the minimum lot size desired per transaction

Remarks

NumUnits determines the equivalent number of shares/contracts represented by the dollar amount and current price, given a minimum lot size. This allows for determining how many shares/contracts can be traded with a set amount of dollars.

Example

Returns on a $65 stock, if you wanted to invest $15,500 in 100 share lots, you would be able to trade 200 shares:

Value1 = NumUnits(15500, 100);

Additional Example

In order to base the number of shares purchased on a dollar/lot amount entered as an Input in a Moving Average Crossover entry, you could use the following syntax:

Inputs: Amnt(10000), MinLot(50);

Value1
= NumUnits(Amnt, MinLot);

If Close Crosses Above
Average(Close, 18) Then
 Buy Value1 Shares This Bar on Close;