OPEN-SOURCE SCRIPT
已更新 ﴾҂﴿ Open Positions

OVERVIEW
If you follow the options trading approach similar to Markus Heitkoetter, then
you would usually have a fixed/max number of positions, and for some of those positions, you will have assigned stocks. If you flew any
rescue missions, you might even have more stock positions assigned at different strike prices.
This indicator visualizes for you the different positions that was assigned, your current average price, a possible place for the next
rescue mission and current open trades.
A note on Trading View and indicators and databases. What is not possible (today), is that an indicator can have different values
as you click through the charts. It is also not possible to have a database from where we can read the current positions (although
this would be a nice thing as feature). So, the way to solve the problem today is simply to have the fixed number of
positions as indicator parameters in a nice and easy format. The parameters are parsed and the if the underlying chart
has existing positions, they are visualized.
The down side of this above (supported) approach is that once the indicator is removed and placed back on the chart, all data stored
as parameters are lost :(.
The "simple" workaround is that we "store" our data inside "code" --> let us make you a programmer in 3 simple steps!
1. If you have read up to this point, then you already have the code open in Pine Editor. The first step is to make a copy of the code. Look at
the right of the screen for "○○○" button and then select the option "Make a copy...". Give it a new name, recommended "[YourName] Open Positions".
2. Although it looks like nothing has changed, actually you are now reading the same text, but in your copy of the indicator. See towards the left of
the screen where the name is shown. So let us switch the indicator on the chart from the original to this copy.
(A) Remove the original indicator from the chart with "X"
(B) Towards the right of the screen is "Add to Chart" option to add this indicator to the chart.
3. Last step is to add all your positions in the code. Simply scroll down a few lines and ONLY modify between "↓↓↓" and "↑↑↑". There are very detailed
instructions on exactly what you may do and should do. Don't do anything else :). Each time after you are finished, simply press "Save" on the
right of the screen. You can close the Pine Editor with the "__" button on the right.
*. If one day you have more positions to update, simply use the "{}" option next to your indicator to land again here in the source code, and repeat
step #3 as many times as you wish.
If you follow the options trading approach similar to Markus Heitkoetter, then
you would usually have a fixed/max number of positions, and for some of those positions, you will have assigned stocks. If you flew any
rescue missions, you might even have more stock positions assigned at different strike prices.
This indicator visualizes for you the different positions that was assigned, your current average price, a possible place for the next
rescue mission and current open trades.
A note on Trading View and indicators and databases. What is not possible (today), is that an indicator can have different values
as you click through the charts. It is also not possible to have a database from where we can read the current positions (although
this would be a nice thing as feature). So, the way to solve the problem today is simply to have the fixed number of
positions as indicator parameters in a nice and easy format. The parameters are parsed and the if the underlying chart
has existing positions, they are visualized.
The down side of this above (supported) approach is that once the indicator is removed and placed back on the chart, all data stored
as parameters are lost :(.
The "simple" workaround is that we "store" our data inside "code" --> let us make you a programmer in 3 simple steps!
1. If you have read up to this point, then you already have the code open in Pine Editor. The first step is to make a copy of the code. Look at
the right of the screen for "○○○" button and then select the option "Make a copy...". Give it a new name, recommended "[YourName] Open Positions".
2. Although it looks like nothing has changed, actually you are now reading the same text, but in your copy of the indicator. See towards the left of
the screen where the name is shown. So let us switch the indicator on the chart from the original to this copy.
(A) Remove the original indicator from the chart with "X"
(B) Towards the right of the screen is "Add to Chart" option to add this indicator to the chart.
3. Last step is to add all your positions in the code. Simply scroll down a few lines and ONLY modify between "↓↓↓" and "↑↑↑". There are very detailed
instructions on exactly what you may do and should do. Don't do anything else :). Each time after you are finished, simply press "Save" on the
right of the screen. You can close the Pine Editor with the "__" button on the right.
*. If one day you have more positions to update, simply use the "{}" option next to your indicator to land again here in the source code, and repeat
step #3 as many times as you wish.
版本注释
UPDATES v2- Added the multi-position line concept to paste open trades directly from Excel. --> Please read the text at the top of the code for detail information.
版本注释
UPDATES v3- Fixed a stupid typing mistake! :(
版本注释
UPDATES v4- Fixed small indexing mistake.
版本注释
UPDATES v5- Slightly changed rescue point from 33% to 30%
- Rescue point is only visualized if price is down more than 10% from lowest strike (to reduce clutter on the chart, only show when it becomes a factor)
- Do NOT show the "average cost basis" when only one trade!
- Stripped the -PUT/-CALL syntax (which only Brian likes) from documentation in favour of the standardized CSP/CC and/or SC/SP syntax
- Add a quantity parsing for contracts, for example 2*CSP@130, which would translate to a possible added 200 stocks
- Based on the extra short PUT positions compute a possible new "cost basis" on assignment
- In cases where multiple trades at same strike, merge trades into one label
- Change date string separater to ">", but still keep backwards compatible the "[]" sequence for this release
版本注释
UPDATES v6- Added P&L Label
版本注释
UPDATES v7- Cosmetic changes....
版本注释
UPDATES v8- Stripped out the code modify option. Basically nothing really changed.
- Added a few more slots for people with slightly larger dry docks :)
版本注释
UPDATES v9- Added support for CASH|Premium|Credit
- Changed slightly sequence of code so that the more "important" labels are on-top if there is an overlap.
- Removed "Show Compact Labels" as it did not seem to work -- email me if required back!
版本注释
UPDATES v10- Small cosmetic change in one label.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。