ToolsPos

Library for general purpose position helpers
new_pos(state, price, when, index)
Returns new PosInfo object
Parameters:
state (series PosState): <PosState> Position state
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
index (int): int Entry bar index. Default: bar_index
Returns: PosInfo
new_tp(pos, price, when, index, info)
Returns PosInfo object with new take profit info object
Parameters:
pos (PosInfo): PosInfo object
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
index (int): int Entry bar index. Default: bar_index
info (Info type from aybarsm/Tools/14): <Info> Info holder object. Default: na
Returns: PosInfo
new_re(pos, price, when, index, info)
Returns PosInfo object with new re-entry info object
Parameters:
pos (PosInfo): PosInfo object
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
index (int): int Entry bar index. Default: bar_index
info (Info type from aybarsm/Tools/14): <Info> Info holder object. Default: na
Returns: PosInfo
PosTPInfo
PosTPInfo - Position Take Profit info object
Fields:
price (series float): float Take profit price
when (series int): int Take profit bar time UNIX. Default: time
index (series int): int Take profit bar index. Default: bar_index
info (Info type from aybarsm/Tools/14): <Info> Info holder object
PosREInfo
PosREInfo - Position Re-Entry info object
Fields:
price (series float): float Re-entry price
when (series int): int Re-entry bar time UNIX. Default: time
index (series int): int Take profit bar index. Default: bar_index
info (Info type from aybarsm/Tools/14): <Info> Info holder object
PosInfo
PosInfo - Position info object
Fields:
state (series PosState): <PosState> Position state
price (series float): float Entry price
when (series int): int Entry bar time UNIX. Default: time
index (series int): int Entry bar index. Default: bar_index
tp (array<PosTPInfo>): PosTPInfo[] Take profit info. Default: na
re (array<PosREInfo>): PosREInfo[] Re-entry info. Default: na
info (Info type from aybarsm/Tools/14): <Info> Info holder object
Added:
method enter(this, state, price, when, index, info)
modifies PosInfo object for new position entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
state (series PosState): <PosState> Position state
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
index (int): int Entry bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/3): <Fluent> Info holder fluent object. Default: na
method action(this, type, price, when, index, info)
modifies PosInfo object for action take-profit/re-entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
type (series PosActionType): <PosActionType> Pos ActionType
price (float): float Action price
when (int): int Action bar time UNIX. Default: time
index (int): int Action bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/3): <Fluent> Info holder fluent object. Default: na
PosAction
PosTPInfo - Position Take Profit info object
Fields:
type (series PosActionType)
price (series float): float Take profit price
when (series int): int Take profit bar time UNIX. Default: time
index (series int): int Take profit bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/3)
Updated:
PosInfo
PosInfo - Position info object
Fields:
state (series PosState): <PosState> Position state
price (series float): float Entry price
when (series int): int Entry bar time UNIX. Default: time
index (series int): int Entry bar index. Default: bar_index
tp (array<PosAction>): PosAction[] Take profit info. Default: na
re (array<PosAction>): PosAction[] Re-entry info. Default: na
info (Fluent type from aybarsm/ToolsFluent/3): <Fluent> Info holder fluent object. Default: na
Removed:
new_pos(state, price, when, index)
Returns new PosInfo object
new_tp(pos, price, when, index, info)
Returns PosInfo object with new take profit info object
new_re(pos, price, when, index, info)
Returns PosInfo object with new re-entry info object
PosTPInfo
PosTPInfo - Position Take Profit info object
PosREInfo
PosREInfo - Position Re-Entry info object
Updated:
method action(this, actionType, price, when, index, info)
modifies PosInfo object for action take-profit/re-entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
actionType (series PosActionType)
price (float): float Action price
when (int): int Action bar time UNIX. Default: time
index (int): int Action bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/3): <Fluent> Info holder fluent object. Default: na
Updated:
PosInfo
PosInfo - Position info object
Fields:
state (series PosState): <PosState> Position state. Default: na
price (series float): float Entry price. Default: na
when (series int): int Entry bar time UNIX. Default: time
index (series int): int Entry bar index. Default: bar_index
tp (array<PosAction>): PosAction[] Take profit info. Default: na
re (array<PosAction>): PosAction[] Re-entry info. Default: na
info (Fluent type from aybarsm/ToolsFluent/3): <Fluent> Info holder fluent object. Default: na
Updated:
method enter(this, state, price, when, index, info)
modifies PosInfo object for new position entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
state (series PosState): <PosState> Position state
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
index (int): int Entry bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/4): <Fluent> Info holder fluent object. Default: na
method action(this, actionType, price, when, index, info)
modifies PosInfo object for action take-profit/re-entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
actionType (series PosActionType)
price (float): float Action price
when (int): int Action bar time UNIX. Default: time
index (int): int Action bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/4): <Fluent> Info holder fluent object. Default: na
PosAction
PosTPInfo - Position Take Profit info object
Fields:
type (series PosActionType)
price (series float): float Take profit price
when (series int): int Take profit bar time UNIX. Default: time
index (series int): int Take profit bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/4)
PosInfo
PosInfo - Position info object
Fields:
state (series PosState): <PosState> Position state. Default: na
price (series float): float Entry price. Default: na
when (series int): int Entry bar time UNIX. Default: time
index (series int): int Entry bar index. Default: bar_index
tp (array<PosAction>): PosAction[] Take profit info. Default: na
re (array<PosAction>): PosAction[] Re-entry info. Default: na
info (Fluent type from aybarsm/ToolsFluent/4): <Fluent> Info holder fluent object. Default: na
Updated:
method enter(this, state, price, when, index, info)
modifies PosInfo object for new position entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
state (series PosState): <PosState> Position state
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
index (int): int Entry bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/6): <Fluent> Info holder fluent object. Default: na
method action(this, actionType, price, when, index, info)
modifies PosInfo object for action take-profit/re-entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
actionType (series PosActionType)
price (float): float Action price
when (int): int Action bar time UNIX. Default: time
index (int): int Action bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/6): <Fluent> Info holder fluent object. Default: na
PosAction
PosTPInfo - Position Take Profit info object
Fields:
type (series PosActionType)
price (series float): float Take profit price
when (series int): int Take profit bar time UNIX. Default: time
index (series int): int Take profit bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/6)
PosInfo
PosInfo - Position info object
Fields:
state (series PosState): <PosState> Position state. Default: na
price (series float): float Entry price. Default: na
when (series int): int Entry bar time UNIX. Default: time
index (series int): int Entry bar index. Default: bar_index
tp (array<PosAction>): PosAction[] Take profit info. Default: na
re (array<PosAction>): PosAction[] Re-entry info. Default: na
info (Fluent type from aybarsm/ToolsFluent/6): <Fluent> Info holder fluent object. Default: na
Updated:
PosAction
PosTPInfo - Position Take Profit info object
Fields:
actionType (series PosActionType)
price (series float): float Take profit price
when (series int): int Take profit bar time UNIX. Default: time
index (series int): int Take profit bar index. Default: bar_index
info (Fluent type from aybarsm/ToolsFluent/6)
Updated:
method enter(this, state, price, when, index, markPrice, markWhen, markIndex)
modifies PosInfo object for new position entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
state (series PosState): <PosState> Position state
price (float): float Entry price
when (int): int Entry bar time UNIX. Default: time
index (int): int Entry bar index. Default: bar_index
markPrice (float): float Mark price. Default: na
markWhen (int): int Mark bar time UNIX. Default: na
markIndex (int): int Mark bar index. Default: na
method action(this, actionType, price, when, index, markPrice, markWhen, markIndex)
modifies PosInfo object for action take-profit/re-entry
Namespace types: PosInfo
Parameters:
this (PosInfo)
actionType (series PosActionType)
price (float): float Action price
when (int): int Action bar time UNIX. Default: time
index (int): int Action bar index. Default: bar_index
markPrice (float): float Mark price. Default: na
markWhen (int): int Mark bar time UNIX. Default: na
markIndex (int): int Mark bar index. Default: na
PosAction
PosTPInfo - Position Action info object
Fields:
actionType (series PosActionType)
price (series float): float Action price
when (series int): int Action bar time UNIX. Default: time
index (series int): int Action bar index. Default: bar_index
markPrice (series float): float Action mark price. Default: na
markWhen (series int): int Action mark bar time UNIX. Default: na
markIndex (series int): int Action mark bar index. Default: na
PosInfo
PosInfo - Position info object
Fields:
state (series PosState): <PosState> Position state. Default: na
price (series float): float Entry price. Default: na
when (series int): int Entry bar time UNIX. Default: time
index (series int): int Entry bar index. Default: bar_index
tp (array<PosAction>): PosAction[] Take profit info. Default: na
re (array<PosAction>): PosAction[] Re-entry info. Default: na
markPrice (series float): float Mark price. Default: na
markWhen (series int): int Mark bar time UNIX. Default: na
markIndex (series int): int Mark bar index. Default: na
Added:
method reset(this)
resets PosInfo object exit
Namespace types: PosInfo
Parameters:
this (PosInfo)
method exit(this)
resets PosInfo object exit
Namespace types: PosInfo
Parameters:
this (PosInfo)
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.
Declinazione di responsabilità
Libreria Pine
In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Complimenti all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.