Managing Positions

Position management

Positions in HaasScript are components which you can use to define whether a bot is "bought/long", "sold/short" or in "no position". They also store lots of information which you and your bots can use to monitor performance or even plan ahead.

Creating positions

Positions can be created simply by calling CreatePosition or doing a trade. You can define the position ID when placing orders and creating position, or you can leave it empty which will auto-generate it. You can also have multiple positions within one script (multi-market trading).

The ID can be used to check on information like last trade prices, (average) entry/exit price and position size, market, profit and much more.

CreatePosition

Doing a trade

Example #1: Auto-generated ID

Example #2: User-defined ID

Position information

PositionContainer

PositionContainer is a collection of all possible information about your bot's position.

Separate information commands

You are also able to extract specific information about bot's position by using LongAmount, ShortAmount, GetPositionMarket, GetPositionDirection, GetPositionEnterPrice, GetPositionAmount, GetPositionProfit and GetPositionROI.

Position prices

To extract last trade prices, we use AverageEnterPrice, AverageExitPrice, LastExitLongPrice, LastExitShortPrice, LastLongPrice, LastShortPrice and LastNoPositionPrice.

Last updated