Greetings All,
Attached is a companion indicator for the Buy The Dip (BTD) indicator that calculates statistics and displays them as labels. This indicator will calculate the performance of the BTD signals for the ticker and is meant only as a rough estimate as to how the ticker has performed when a BTD signal has triggered. The reason I say rough estimate is that in order to get the stats I had to make some assumptions in order to calculate averages and thinkscript isn’t the best language for any kind of data mining.
I have been meaning to do a project like this for a minute now and have had the opportunity and time to finally do so. This is the first version so there could be some discrepancies and errors. If so, provide your feedback and I will check here periodically as time allows and attempt to correct anything. Additionally, the other coders on the site are more than welcome to make improvements/corrections as desired. Thank you and hope it helps.
Explanation of labels:
Total BTD Signals: Calculates total BTD signals on the chart. Will probably not include the most recent signal if signal fired before the user chosen “past bars” variable.
BTD Open Green: Calculates the number of times the close was green after a signal is fired. This would be good for day traders and give a hint how the signal initially responds to the BTD.
Poss Winners: Number of times a signal fired, trade entered at/near the open, the trade lasted for the specified number of bars, and trade closed in profit.
BTD Avg Run: Calculates the avg dollar amount gain for all BTD signals fired.
BTD Per Gain: Calculates avg percentage gain for all signals fired.
Poss Losers: Opposite of Possible Winners, number of times trade closed in loss.
Avg Heat Taken: The avg amount price went against you while a trade was open.
Avg Heat Percent: The avg percentage price went against you while trade was open.
Win Probability: The percentage of wins out of the total signals fired.
Loss Probability: Percentage of losses.
Score: Performance score that calculates a score based of win probability, avg amount gain, and avg amount loss.
RRR: Risk Reward Ratio.
Performance Rating: Grade given based on the score. Usually the good and excellent tickers have shown a decent amount of profit potential. Can be used initial filter if scanning for BTD signals.
BTD Stats Specific Options
Show all labels: Shows all labels on the chart. Maybe too much information if your not a stats fan.
Show min labels: Shows just four labels, Avg Heat Taken, RRR, Score, and Performance Rating
Past Bars: After a signal fired, the amount of time you want a trade to last. Initially set to 5 for a trade to be open for 5 days. Can adjust as needed.
Choose Signal: Choose the BTD signal you want to calculate stats for. Aggressive, Medium, Conservative.
Choose Strictness:
Optimistic - Will use the highest price while trade was opened as the exit price.
Realistic - Will choose the close price as the exit price when the trade was closed.
As a note, it will use the open price on the day the signal fired as price you get in. The difference between the open price and either the highest price over the trade duration or close price at the end of the trade duration calculated. These occurrences will then be averaged out to calculate the BTD Avg Run and BTD Avg Heat Taken dollar amounts.
I have added a watchlist column that you can use to quickly see the performance rating. There will be a difference in the rating the watchlist column displays and what the chart says because of the delay in updating the watchlist columns. If anything, take what you see on the chart as the most accurate rating.
Hopefully, this will help identify tickers that have responded more favorably to BTD than others. This should help you identify where to put your stops, the amount of dollar gain, and the probability of a profit being realized.
Update 31Dec20
STR All Stats
STR Stats Show Min Labels
Indicator Options
Highlight BTD Trades
Highlight STR Trades
Attached is a companion indicator for the Buy The Dip (BTD) indicator that calculates statistics and displays them as labels. This indicator will calculate the performance of the BTD signals for the ticker and is meant only as a rough estimate as to how the ticker has performed when a BTD signal has triggered. The reason I say rough estimate is that in order to get the stats I had to make some assumptions in order to calculate averages and thinkscript isn’t the best language for any kind of data mining.
I have been meaning to do a project like this for a minute now and have had the opportunity and time to finally do so. This is the first version so there could be some discrepancies and errors. If so, provide your feedback and I will check here periodically as time allows and attempt to correct anything. Additionally, the other coders on the site are more than welcome to make improvements/corrections as desired. Thank you and hope it helps.
Explanation of labels:
Total BTD Signals: Calculates total BTD signals on the chart. Will probably not include the most recent signal if signal fired before the user chosen “past bars” variable.
BTD Open Green: Calculates the number of times the close was green after a signal is fired. This would be good for day traders and give a hint how the signal initially responds to the BTD.
Poss Winners: Number of times a signal fired, trade entered at/near the open, the trade lasted for the specified number of bars, and trade closed in profit.
BTD Avg Run: Calculates the avg dollar amount gain for all BTD signals fired.
BTD Per Gain: Calculates avg percentage gain for all signals fired.
Poss Losers: Opposite of Possible Winners, number of times trade closed in loss.
Avg Heat Taken: The avg amount price went against you while a trade was open.
Avg Heat Percent: The avg percentage price went against you while trade was open.
Win Probability: The percentage of wins out of the total signals fired.
Loss Probability: Percentage of losses.
Score: Performance score that calculates a score based of win probability, avg amount gain, and avg amount loss.
RRR: Risk Reward Ratio.
Performance Rating: Grade given based on the score. Usually the good and excellent tickers have shown a decent amount of profit potential. Can be used initial filter if scanning for BTD signals.
BTD Stats Specific Options
Show all labels: Shows all labels on the chart. Maybe too much information if your not a stats fan.
Show min labels: Shows just four labels, Avg Heat Taken, RRR, Score, and Performance Rating
Past Bars: After a signal fired, the amount of time you want a trade to last. Initially set to 5 for a trade to be open for 5 days. Can adjust as needed.
Choose Signal: Choose the BTD signal you want to calculate stats for. Aggressive, Medium, Conservative.
Choose Strictness:
Optimistic - Will use the highest price while trade was opened as the exit price.
Realistic - Will choose the close price as the exit price when the trade was closed.
As a note, it will use the open price on the day the signal fired as price you get in. The difference between the open price and either the highest price over the trade duration or close price at the end of the trade duration calculated. These occurrences will then be averaged out to calculate the BTD Avg Run and BTD Avg Heat Taken dollar amounts.
I have added a watchlist column that you can use to quickly see the performance rating. There will be a difference in the rating the watchlist column displays and what the chart says because of the delay in updating the watchlist columns. If anything, take what you see on the chart as the most accurate rating.
Hopefully, this will help identify tickers that have responded more favorably to BTD than others. This should help you identify where to put your stops, the amount of dollar gain, and the probability of a profit being realized.
Indicator
Code:
WATCHLIST COLUMN
Code:
Update 31Dec20
- Added option to show STR trades stats
- Added option to show BTD Percentile indicator
- Added options to highlight BTD trades on chart
- Added strictness settings for BTD trades
- Optimistic enters at the Open after BTD signal and exits at the highest bar occurred within the trade duration
- Realistic enters at the close after BTD signal/exits at the close at the end of the trade duration
- Added strictness settings for STR trades
- Optimistic enters at the open after STR signal and exits at the lowest bar within the trade duration
- Realistic enters at the close after STR signal/exits at the close at the end of the trade duration
- Show Signals displays the actual BTD Percentile indicator
- I missed something and made a little update to the indicator, now it highlights the last bar of the trade duration for the BTD signals.
STR All Stats
STR Stats Show Min Labels
Indicator Options
Highlight BTD Trades
Highlight STR Trades
Last edited: