April 24, 2024

TSLab company blog | Modified the module, added more automation and position sizing

We have added position sizing, now only for shorts.
You can talk as much as you like about what reallyquite simply on your own, with the help of blocks, to collect algorithms (well, or to code, to whom what), but I would like to return a little to reality.
TSLab company blog | Modified the module, added more automation and position sizing

The blue frame shows the scale of the latest changes.Yes - it’s not difficult, mostly routine. For those who have not opened tslab, perhaps this does not give anything, but for those who have already used it, in this example there will be many useful solutions for working with position changes, about the rules for placing simultaneous orders (spoiler - this cannot be done. Therefore, the restriction should be stated explicitly form). It is impossible to explain in a nutshell the meaning of the restrictions - perhaps in a separate article we will look at why it was done this way, and why it needs to be done in this particular form. (also a spoiler, there is no such limitation in the code)

TSLab company blog | Modified the module, added more automation and position sizing

What was finally done.
1 added the maximum position size. — that is, we indicate, for example, 100, the robot will increase the position until it becomes equal to 100.
Step 2 of the increase - that is, through what percentage of the price movement we will increase. this is a kind of ladder, for example in increments of 1% of the entry price
Reset step 3 - similarly, we will reset the position as a percentage of the last output. In this case, the initial exit will be from the manually specified “first take” level

The initial entry is still “manual”. we indicate the price/level from which we would like to start - and then the algorithm will “start collecting” the position.

The script is available here