berodney
New member
Hello all,
I'm trying to define a trade size for a strategy. If the price of the stock I'm looking (on a chart) is greater or equal to 15 then I want the trade size to be 100. If it is less than 15 then I want it to be 1,000.
Thank you,
Nick
I'm trying to define a trade size for a strategy. If the price of the stock I'm looking (on a chart) is greater or equal to 15 then I want the trade size to be 100. If it is less than 15 then I want it to be 1,000.
Code:
#Symbol
def symbol = getsymbol();
def price = priceType.LAST(symbol);
def trade = if price >= 15 then 100 else 1000;
#TradeSize
input tradesize = trade;
Thank you,
Nick
Last edited: