Tag Archive : pine script

AP Risk Management Assistant 20-02-25.01 shared alpha



AP Risk Management Assistant 20-02-25.01 shared alpha by ApopheniaPays on TradingView.com

TradingView Script. Free TradingView account required to use. Direct link: hhttps://www.tradingview.com/script/cviFZ4S5-AP-Risk-Management-Assistant-20-02-25-01-shared-alpha/

Initial alpha release, just for you to play with. No warranty, guarantee, support.

—–

A word about the “regretted sale” features:

BUYBACK SPOT PRICE AFTER ‘REGRETTED’ SALE:

This is the level at which you will lose the same amount by having sold and bought back in as if you had simply held without selling. If you buy back at this level after a regretted sale, whenever you sell again, you will make the exact same profit or loss as if you had not made the regret sale. And every dollar below this price that you buy back in, is a dollar more profit you would have made if you had held and sold at that price. So if you now expect the price to go back up, you can get back in the game at this price or lower. Even if it goes back up just a little more than the spot price of your regretted sale, you can get back in at this price and then at least cut your losses by selling higher. Beware though — if you buy back in using this feature and then you sell anywhere below where you originally made the regret sale, you will lose more than you would have by simply not buying back in. Buying back in like this can only be profitable if the spot price goes back up at least to where you made the regret sale, and then, you have the discipline to really sell again at a higher price than that.

For instance, if you are on track to break even on 1.5 WhatsiCoins at spot price $1500, but instead stop out at $1435, and check the ‘I REGRET IT’ box and fill in 1.5 and $1435, it will give you a buyback line at a lower price, say, for example, $1417. If the price drops past $1417, and you buy back in, and it rises again to $1500, you can sell at $1500 and break even overall, exactly as if you hadn’t made the regretted sale. Or if the price drops to $1400 and you buy back in there, and it rises to $1500, you can sell there, and instead of breaking even you’ll make $25.50 profit. ($17/WhatsiCoin * 1.5 coins).

However, if you buy back in at $1417 and it only goes to $1425, and you sell there, you’ve taken on an additional loss of $15 ($1435-$1425 = $10 loss/coin, * 1.5 WhatsiCoins) and you would have done better not to buy back in.

And always remember: when you make a regret buyback, yeah, you’re where you would have been anyway, but, that position is further from profitability. If you make a regret buyback at $20 less than you sold out at, you’re now $20 further from profitability than you were when you sold, no matter what, and good luck with that addtional obstacle. And if you buy back at more expensive, and the price falls to your stop again, you’ve lost even more.

Generally, stop-losses are a good idea. This indicator aims to help you plan them sensibly.

So if you clearly made a bad mistake, and things go just right and dip far enough before a clear and predictable HUGE rebound that you’re sure is coming, this “REGRET IT” feature can get you back in to profit at no cost whatsoever. Or, it can easily cost you even more money, chasing your losses like a clueless newbie. Be careful.

Crossing detector & 2-field date/time entry [tradingview]



ApopheniaPays Crossing detector & 2-field date/time entry by ApopheniaPays on TradingView.com

TradingView Script. Free TradingView account required to use. Direct link: https://www.tradingview.com/script/izM2anXV-ApopheniaPays-Crossing-detector-2-field-date-time-entry/

A demonstration created by request.

You specify a horizontal line by value, start date/time, and end date/time, and choose a data source (bar close is the default) and it will label count how many times that source crosses that line between those dates/times.

“Crossing type”: count only crossing up, crossing down, any cross, or any touch at all. “Any touch” ignores the source you specified in the first input, and triggers if any part of the candle at all is touching the specified value.

BONUS DEMO FEATURE: Enter the start and end dates for your horizontal line as MMDDYY and HHMM (24 hour time).

: Jan 17, 2020 would be 11720 (properly it would be 011720, but Pine inputs delete leading 0s).
: November 17, 2020 would be 110720.
: 8:30 AM would be 0830.
: 8:30 PM would be 2030.

Remember to enter the right time zone.

I believe nobody else has published a 2-input date/time picker on TV, at least the last time I checked they hadn’t, they all make you input M,D,Y,H,M as separate fields. Ugh!

If you use any parts of this code, please credit me. If somehow you happen to make a lot of money using this code, please think about what a fair share would be to pay me for my help, then give that amount to a worthwhile charity.

RSS2k
Follow by Email173
Facebook42