PROTECTED SOURCE SCRIPT

SB Master Chart v5 (Public)

Mis à jour
SB Master Chart v5 is the latest progression of the SB Master Chart series of charts.

The original SB Master Chart and its successors was designed to be a visual aid for the savvy investor. The original concept was designed to provide valuable information so decisions could be made at a glance with utmost confidence.

As the chart progressed through versions, it has slowly shifted the responsibility of decision making from the trader to the indicator. In this version of the script, we have updated the backend decision code. The script has 3 distinct personalities coded to compliment each other, as well as keep the others in check..

The first personality is the buy algorithm. The buy personality is based on two conditions. The first algorithm first determines a trend, then it waits for a confirmation. The personality is comprised of the following indicators.
  • EMA 7
  • EMA 14
  • MACD
  • Stochastic
  • RSI


By default, the first personality has its visual settings disabled. Its still working, its just not displayed on the chart. It can be enabled in the settings. The background colors designate trend and confirmation.

The second personality is stubborn and its committed to making a profit. Its a hard line in the sand that configurable by you the user. Its the take profit/trailing take profit setting. It will not let other personalities sell for less than these configured values. The visual component of personality two is represented by black dots. This serves to showcase its minimum profit target when opening a trade and a trailing stop loss when the price exceeds the minimum profit target.

The third personality is the guy that does the dirty work that nobody wants to admit they do. This personality is based on the original SB Master Chart algorithm. This personality takes over when the first personality is unable to turn a profit. This personality goes to work finding appropriate places to dollar cost average. There are two settings that affect this personality.
  • DCA %
  • Risk Multiplier (use extreme caution, this could cause a margin call if used inappropriately).


DCA percent setting restricts this algorithm from buying when the price has not fallen below this threshold.
Risk Multiplier instructs this algorithm how much positions/qty to buy when it buys. At 2x, the algorithm will buy enough shares to double its current position, at 3x the algorithm will buy enough shares to triple its current position.

The visual representations of the third personality are that of red, orange, yellow and green. Red means overbought. When an orange appears just prior to a red, that orange means overbought with volume. Green means oversold and an orange preceding a green is an oversold with volume. Both the red and green represent an possible trend reversal and that's the signal to buy when its green.

This personality is comprised of the following indicators:
  • RSI
  • Stochastic
  • MACD
  • Bollinger
  • Volume


The code also features 3 modes. Altering the mode setting changes the way the personalities work together (or do not work together).
  • Normal
  • Aggressive
  • Buy the Dip


Mode Normal works exactly like described above. Each personality has its own duty and they do not interfere with each others work.
Aggressive mode adjusts the dynamic and both the first personality and the third personality share an equal part in opening starter positions.
Buy the Dip mode prevents personality one from buying. Since personality one only buys uptrends, you will never see it buying a dip. This mode puts personality 3 in the spotlight. All position are typically opened during a fast/quick market decline. Personality three is still bound by the rules of personality 2, but its responsible for buying and dollar cost averaging.

I have also included labels for every buy/sell. A green label is the script making its first purchase, yellow is points where it decided to dollar cost average and the red is where it chose to deleverage by closing out all its positions. Nothing prevents the algorithm from buying immediately after a sell, this is by design because we do not want to miss out on an uptrend, but we also do not want to be caught with too much leverage.

Also included vital statistics on the top right of the chart.

  • Open Positions
  • Cost Basis
  • Current Gain/Loss
  • Minimum Profit Target
  • Trailing Stop Loss
  • Total Trades to Date
  • Maximum Positions/Qty to Date


In the bottom right of the chart, I have the user configurable settings. This is important so a user can at a glance see the settings of the chart without having to open the options menu.

Together, all three personalities form a COMPLETE trading system. The system tracks purchase quantity, cost basis from the first buy, adjust with each new buy and calculates the running profit from the begining of the date set in the settings if it were to have bought and sold at every signal. The public version of the script requires the trader to use the script in real time watching for buy and sell opportunities. The private subscription version of the script has custom alerts that can be configured to alert the user on when to buy and sell and also gives the user appropriate trailing stop loss settings to automate the trading process.

I want to name the personalities at some point in time for the novelty factor, but I wanted to release the script as soon as possible for others to enjoy, so they are nameless at this point. If you have suggestions, please contact me with your suggestion. I will credit the person with the best personality with a free subscription to the private version of this indicator.

As always, understand the risks of trading and trade responsibly. Nothing in this script can predict the future. Past results do not guarantee future performance
Notes de version
Updated a label title.
Notes de version
Minor updates to plot symbols.
Notes de version
Updated Labels
Notes de version
Updated take profit personality to override user settings if it deems necessary to maximize profits.
Notes de version
Fixed bug in trailingStopLoss Logic
Notes de version
Found and fixed a monitor trailing stop bug
Notes de version
Converted cost basis and take profit/trailing stop calculations into functions.
Notes de version
For some reason update does not apply, trying again.
Notes de version
Made a minor change to the algo vs user take over of the trailing take profit calculation.
Notes de version
Converted Cost Basis and Trailing Stop calculations to functions.

Added options to input exiting quantity and cost basis. If you use these options, you have to set the date to "TODAY"s date or it will not function as expected.

This will also allow a trader to "Start Over" and have the script recalculate new buy/sell points moving forward if they miss any of the buy or sell signals.

Made a minor change to the trailing take profit calculation.

Major update to the algo. I have given the user the opportunity to manipulate the time frame that the different algos operate on. I am only able to give the user the ability to change the time frame for the normal buy algo and the dca/buy the dip algo. I am not able to give the user the ability to change time frame of the take profit/trailing take profit due to the complexity of the function to calculate everything. As such, it is recommended that you create the alert on the time frame that you want the Take Profit/Trailing Take Profit to take effect. This workaround gives the user the ability to manipulate all 3 algos time frames.

I have also reorganized the configuration options/settings to make it more obvious which algo is being manipulated by the user.

I have defaulted the normal buy algo to "1D" timeframe which should capture a stock in an uptrend and DCA/Buy the Dip Algo to the "120" try to capture intraday lows. This may be tweaked by the user and results will vary.

For manipulating the Take Profit/Trailing Take Profit, your main chart resolution will determine the frequency of updates/alerts. The lower the time frame, the tighter more frequent the stops will be. I recommend this be the lowest time frame of all 3. You do not want the other two time frames to be lower than this time frame.

There are many articles about issues accessing time frames lower than the charts actual time frame.
Notes de version
I had to remove the DCA/BTD Timeframe setting to restore expected functionality.
Notes de version
Fixed the multi-timeframe issue with the DCA/BTD Algo.
Notes de version
Fixed alertcondition() alerts.
Notes de version
Undid changes, it was committed by mistake on the wrong script.
Notes de version
Ok, I think I finally nabbed this mult-tf btd algo bug for good. Initially there was an issue, then I had to disable it, I found an temporary workaround that mimicked a fix. Now I think its fixed fixed. I had to translate my original code to traverse both time frames. This looks solid!
Notes de version
I had to revert the changes, it introduced repainting which could not be ignored.
Notes de version
Changed the way risk multiplier works. Please not this setting should not be used if using 3commas for signal. It should be unchecked.

The new setting now opens a larger position the further your negative.

Examples:
If you are down 10% on a trade, the dca signal will recommend opening 10 more positions.
If you are down 5% it will open 5 positions
Notes de version
Made some adjustments to decimal place formatting for low priced items (crypto and penny stocks).
Exponential Moving Average (EMA)Relative Strength Index (RSI)rsi_overboughtrsi_oversoldStochastic RSI (STOCH RSI)

Script protégé

Ce script est publié en code source fermé et vous pouvez l'utiliser librement. Vous pouvez le préférer pour l'utiliser sur un graphique. Vous ne pouvez pas visualiser ou modifier son code source.

Vous voulez utiliser ce script sur un graphique ?


Aussi sur:

Clause de non-responsabilité