v4
Updated:
getQty(entry, stop, riskAmount, riskType)
calculate qty and leverage based on entry and stop price for given risk percentage.
Parameters:
entry: Entry Price
stop: Stop Price
riskAmount: risk percentage per trade or risk cash per trade
riskType: Can be either trategy.percent_of_equity or strategy.cash
Returns: [quantity, leverage] - Quantity based on the risk and calculated leverage on position including existing positions
bracketOrder(id, entry, stop, target, maxLeverage, isLimitOrder, riskAmount, riskType)
Calculates position size based on risk and creates bracket orders for given entry/stop/target
Parameters:
id
entry: Entry Price
stop: Stop Price
target: Target Price
maxLeverage: Maximum leverage allowed
isLimitOrder: if true, places limit order for entry, else places stop order.
riskAmount: risk percentage per trade or risk cash per trade
riskType: Can be either trategy.percent_of_equity or strategy.cash
Returns: orderPlaced - true if orders successfully placed, false otherwise.
order(id, entry, stop, maxLeverage, isLimitOrder, riskAmount, riskType)
Calculates position size based on risk and creates order for given entry/stop
Parameters:
id
entry: Entry Price
stop: Stop Price
maxLeverage: Maximum leverage allowed
isLimitOrder: if true, places limit order for entry, else places stop order.
riskAmount: risk percentage per trade or risk cash per trade
riskType: Can be either trategy.percent_of_equity or strategy.cash
Returns: orderPlaced - true if orders successfully placed, false otherwise.