TSLab API Docs  1
TSLab.Script.IPosition Interface Reference

Trade position More...

Inheritance diagram for TSLab.Script.IPosition:
TSLab.Script.IPositionInfo TSLab.Script.Realtime.IPositionRt

Public Member Functions

double GetAccumulatedProfit (int bar)
 The current accumulated profit for the position. bar number
 
double Profit ()
 The position profit (only for closed positions). The position profit.
 
double ProfitPct ()
 The position profit by percents (only for closed positions). The position profit by percents.
 
double CurrentProfit (int bar)
 The current position profit. The position profit.
 
double CurrentProfitByOpenPrice (int bar)
 The current position profit by the bar open price. Position profit by bar open price.
 
double CurrentProfitPct (int bar)
 The current position profit by percents. The position profit by percents.
 
double OpenProfit (int bar)
 Unrealized position profit for the selected bar (for the one share/contract only). The selected bar number. The position profit.
 
double OpenProfitPct (int bar)
 The position profit by percents for the selected bar. The selected bar number. The position profit in the percents
 
double OpenMFEPct (int bar)
 The position MFE by percents for selected bar. The selected bar number. The position MFE by percents.
 
double OpenMAEPct (int bar)
 The position MAE by percents. The selected bar number. The position MAE by percents.
 
double MFEPct ()
 The position MFE by percents. The position MFE by percents.
 
double MAEPct ()
 The position MAE by percents. The position MAE by percents.
 
double OpenMFE (int bar)
 The position MFE (for the one share/contract only). The selected bar number. The position MFE.
 
double OpenMAE (int bar)
 The position MAE (for the one share/contract only). The selected bar number. The position MAE.
 
double MFE ()
 The position MFE (for the one share/contract only). The position MFE.
 
double MAE ()
 The position MAE (for the one share/contract only). The position MAE.
 
DateTime MAEDate ()
 The position MAE date. Position MAE date.
 
int FindHighBar (int bar)
 Find bar with the highest value from the entry bar to the selected bar. The selected bar number. returns the bar number with highest value.
 
int FindLowBar (int bar)
 Find bar with the lowest value from the entry bar to the selected bar. The selected bar number. returns the bar number with lowest value.
 
bool IsActiveForBar (int bar)
 Is position active at the bar? bar number
 
double GetBalancePrice (int bar)
 Balance price for the bar. bar number
 
double GetShares (int bar)
 The position shares count for bar by number. bar number
 
double GetStop (int bar)
 Get the position stop-loss value for bar number. The selected bar number. the stop-loss value, 0 if it wasn't setted.
 
IEnumerable< double > GetStops (int firstIndex, int lastIndex)
 
double GetTakeProfit (int bar)
 Get the position take-profit value for bar number. The selected bar number. the take-profit value, 0 if it wasn't setted
 
IEnumerable< double > GetTakeProfits (int firstIndex, int lastIndex)
 
void ChangeAtMarket (int barNum, double newShares, string signalName, string notes=null)
 Change the position size by the current market price. The bar number. New postion size. The signal name. the signal notes
 
void ChangeAtPrice (int barNum, double price, double newShares, string signalName, string notes=null)
 Change the position size by selected price. The bar number. The take-profit price. New postion size. The signal name. the signal notes
 
void ChangeAtProfit (int barNum, double price, double newShares, string signalName, string notes=null)
 Set take-profit price to change the position size. The bar number. The take-profit price. New postion size. The signal name. the signal notes
 
void ChangeAtProfit (int barNum, double price, double?slippage, double newShares, string signalName, string notes=null)
 Set take-profit price to change the position size. The bar number. The take-profit price. The slippage. New postion size. The signal name. the signal notes
 
void ChangeAtStop (int barNum, double price, double newShares, string signalName, string notes=null)
 Set stop-loss price to change the position size. The bar number. The stop price. New postion size. The signal name. the signal notes
 
void ChangeAtStop (int barNum, double price, double?slippage, double newShares, string signalName, string notes=null)
 Set stop-loss price to change the position size. The bar number. The stop price. The slippage. New postion size. The signal name. the signal notes
 
void VirtualChange (int barNum, double price, double newShares, string signalName, string notes=null)
 Virtual change the position size by selected price. The bar number. The take-profit price. New postion size. The signal name. the signal notes
 
void CloseAtMarket (int barNum, string signalName, string notes=null)
 Close the position by the current market price. The bar number. The signal name. the signal notes
 
void CloseAtStop (int barNum, double price, string signalName, string notes=null)
 Set stop-loss price to close position. The bar number. The stop price. The signal name. the signal notes
 
void CloseAtStop (int barNum, double price, double?slippage, string signalName, string notes=null)
 Set stop-loss price to close the position. The bar number. The stop price. The slippage. The signal name. the signal notes
 
void CloseAtProfit (int barNum, double price, string signalName, string notes=null)
 Set take-profit price to close the position. The bar number. The take-profit price. The signal name. the signal notes
 
void CloseAtProfit (int barNum, double price, double?slippage, string signalName, string notes=null)
 Set take-profit price to close the position. The bar number. The take-profit price. The slippage. The signal name. the signal notes
 
void CloseAtPrice (int barNum, double price, string signalName, string notes=null)
 Close the position by selected price. The bar number. The take-profit price. The signal name. the signal notes
 

Properties

IPositionsList ParentList [get]
 The position's parent list.
 
ISecurity Security [get]
 The position's security.
 
IReadOnlyList< IPositionInfoChangeInfos [get]
 The position's change infos.
 
bool IsVirtual [get]
 Is position virtual? (calculated only).
 
bool IsVirtualClosed [get]
 Was position virtually closed? (calculated only).
 
PositionState PositionState [get]
 The position state.
 
double FullEntryCommission [get]
 The position entry commission.
 
double FullExitCommission [get]
 The position exit commission.
 
int BarsHeld [get]
 The position bars held.
 
double ProfitPerTrade [get]
 
bool IsLong [get]
 Is position long?
 
bool IsShort [get]
 Is position short?
 
bool IsActive [get]
 Is position active?
 
double SharesOrigin [get]
 The original position shares in lots.
 
double MaxShares [get]
 The position shares maximum in lots.
 
- Properties inherited from TSLab.Script.IPositionInfo
string EntrySignalName [get]
 The position entry signal name.
 
string EntryNotes [get]
 The position entry notes More...
 
string ExitSignalName [get]
 The position exit signal name.
 
string ExitNotes [get]
 The position exit notes More...
 
double EntryPrice [get]
 The position entry price.
 
double EntryCommission [get]
 The position entry commission.
 
double AverageEntryPrice [get]
 The position average entry price.
 
double ExitPrice [get]
 The position exit price.
 
double ExitCommission [get]
 The position exit commission.
 
double Shares [get]
 The position shares in lots.
 
double SignedShares [get]
 
double SharesChange [get]
 The position shares change.
 
int EntryBarNum [get]
 The position entry candle number.
 
int ExitBarNum [get]
 The position exit candle number. (Bars.Count if position is active)
 
IDataBar EntryBar [get]
 The position entry candle.
 
IDataBar ExitBar [get]
 The position exit candle.
 

Detailed Description

Trade position