SHORTONMARKET is a built-in function in the ProBuilder language used to determine if there are any short positions currently open in the trading system. This function is crucial for strategies that need to avoid opening multiple short positions simultaneously or to check the status before closing existing positions.
ShortOnMarket
Consider a scenario where you want to initiate a short trade based on the MACD indicator, but only if there is not already a short position open. The following code demonstrates how to use SHORTONMARKET in this context:
myMACD = MACD[12,26,9](close)
short = myMACD crosses under 0
IF NOT ShortOnMarket AND short THEN
SELLSHORT 1 CONTRACTS AT MARKET
ENDIF
This function helps in managing trading actions by ensuring that the trading strategy does not open multiple short positions, which can be part of risk management and strategy effectiveness.