I have not tested this. But what you would need to do is to take the dollar amount and divide by the current price to arrive at a number of shares that equal that dollar amount. What I am saying is that the dollar amount must be converted to a number of shares or contracts. And this must be a whole number so we must round the value to the nearest whole number.
The AddOrder() statement is the place where this computation is required. Below is a very simplistic example of how you could generate a buy signal using $5,000 as the input, which is then converted to a number of shares in the AddOrder() statement:
input tradeDollars = 5000;
def buySignal = yes;
AddOrder(OrderType.BUY_TO_OPEN, buySignal[-1], close[-1], Round(tradeDollars * close, 0), Color.CYAN, Color.CYAN, "Long Entry");