v3
Added:
getEquilibriumPeriods(scheme) gets a suitable combination of equilibrium periods for the specified scheme.
Parameters:
scheme: string, the name of the scheme.
Returns: 4 float values, a best suited combination of equilibrium periods.
computeExitGains(entry, exit, qty, remainingQty, direction) calculates the gains after a position is scaled down.
Parameters:
entry: float, the entry price of the short/long position.
exit: float, the exit price of the short/long position.
qty: float, the quantity by which a position is to be scaled down.
remainingQty: float, the remaining quantity before the scale down.
direction: int, its -1 for a short position and +1 for a long position.
Returns: _gains float, the profit & loss after the scale down.
Updated:
positionRelativeToRange(point, fromLevel, toLevel) determines the placement of price w.r.t a range (i.e. a dynamic resistance band).
Parameters:
point: float, the price.
fromLevel: float, the from-range which is typically a fast moving line.
toLevel: float, the to-range which is typically a slow moving line.
Returns: string, the above/below/within range.