Definition: In ProBuilder programming language, SHARES is a keyword used to specify the number of shares involved in a trading order. This keyword is crucial in defining the scale of a transaction, whether buying or selling, in a trading strategy script.
[BUY|SELLSHORT] quantity SHARES [AT MARKET|AT price LIMIT|AT price STOP]
The following example demonstrates how to use the SHARES keyword in a short selling scenario based on the MACD indicator crossing below zero:
myMACD = MACD[12,26,9](close)
shortCondition = myMACD crosses under 0
IF NOT ShortOnMarket AND shortCondition THEN
SELLSHORT 1 SHARES AT MARKET
ENDIF
This script calculates the MACD value using the specified parameters (12, 26, and 9) and checks if the MACD line crosses below zero, which is a common trading signal for a potential downtrend. If the market conditions meet the criteria and there is no existing short position, it initiates a sell short order for 1 share at the market price.
This example illustrates the use of the SHARES keyword in a practical trading strategy, emphasizing its role in specifying the transaction volume in trading commands.