Answers to Commonly Asked Questions

Status
Not open for further replies.

MerryDay

Administrative
Staff member
Staff
VIP
Everything you wanted to know about REPAINTING and were afraid to ask

Repainting is when an indicator triggers (prints an arrow, shows up on a scan/watchlist, sends an alert, buy & sells on back testing, etc) because at that moment the conditions are true for whatever triggered it. But the conditions don't stay true so later that arrow, scan/watchlist, alert, buys & sell in strategies disappear with no trail that it happened in the first place.

The Negative: Repainting is problematic especially for newer traders. Many of these indicators provide triggers promising that a stock has hit a low (or high) and is indicating NOW NOW NOW is the time to make entry and it can be right, reinforcing their belief that this is a good strategy. But it can also be wrong, it erases that signal, continues to drop like a rock, and crushes previous profits. Just the potential of that possibility causes traders to lack confidence, to leave trades early at the smallest sign of trouble, creating a feedback loop of ever-smaller profits and ever-larger losses.

No, repainting indicators can not be rewritten to not repaint. Repainting is part of their DNA.

Positive Side of these Indicators:
  • Savvy scalpers, who are also using other strategic elements and have expertise in reading price action are known to make use of some repainting indicators because they trigger MUCH faster than the non-repainting. They factor the cost of losses due to phantom signals into their strategy.
  • Swing Traders and Scalpers will sometimes use these indicators to analyze overall trendlines as opposed to looking for specific entry or exit. The caveat being that even if the point is many many candles past is can STILL REPAINT, the trendline can go from up to down based on new data points. But this is true even when drawing manual trendlines. So I can see the use for utilizing these types of indicators to get a general idea of historical trends.
How do you know if an indicator is a repainting indicator?
If you look at a script and if there is a fold operation using highest and/or lowest that is the indication that it repaints.
Fold is a recursive operation that keeps redefining the highest and lowest and redrawing them.
Generally, if you have an indicator that shows buy and sell signals on your chart and every single signal works out perfectly, such as: Trend Reversals, Zigzags, Swing High, Swing Low, COG, Hurst indicators, some Pivot Points, etc... then most likely that indicator repaints. Looks great for backtesting because all the false signals and bad buy/sells are erased.

Other REPAINTING-type Behavior:
In TOS, an indicator can be triggered and signal prematurely during the formation of a candle because the conditions are met but the signal can disappear by the close of the candle if the conditions for the signal do not hold true. A workaround would be to be scan/alert/paint the arrow on the prior candle and/or do not trigger your scan/watchlist/alert/arrow/signal based on just one study. This holds true for reducing many types of false signals.


This information was compiled from the various posts written about repainting. A search of this forum will provide the detail from which these statements were derived.
HTH
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
The Infamous "Too Complex" Error

'Generally' too complex scanner messages means that the study is not scannable. However, 'sometimes', the problem is just too many extraneous statements which are not related to the logic needed for the scan. Writing a separate study with the extraneous removed puts less strain on resources and will then sometimes run successfully.

Another work-around that posters have sometimes had success with is to limit the data pool that you are scanning against. Scanning the Universe of Stocks is never recommended. Scanning a watch list of your preferred equities, scanning the DJIA or NASDAQ 100, or limit on volume, market cap, etc... Anything that will require a considerable less amount of TD's resources will occasionally get around the too complex error.

Yet another, work-a-round is to re-write the one study and break it into multiple studies. Then run the scan in parts. Do some calculations, save results to a watchlist and then run the rest in the next scan.

However, a majority of the time, the problem is built into the complex logic of the study and then there is no work-around.
Supertrend, the Trend Reversal Indicators, and other Repainting Indicators are generally too complex to utilize the TOS Scanner or to use as WatchLists.
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
Commonly Asked Questions about Alerts:
There are Three Types of Alerts:
There are alerts written into studies. They only alert when the chart w/ the study is open on your screen​
They cannot be sent to phone/email. They cannot have custom sounds.​
There are alerts created on a chart for one specific stock that you want to alert on. The alert will only fire once. At that point, the condition has been met, the alert expires. No, this can't be changed.​
There are scanned watchlist alerts which alert whenever the results of the scan changes. These alerts can be 3-7min delayed.​
Alerts blinking by too fast? To see all alerts: click on the message center
Want to see a list of alerts all the time? detach the message center
TeXjiwC.png
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
Guidelines For Posting To The UseThinkScript Forum
  1. Many questions asked have answers already posted. I did a search of one question recently and it had been answered over 100 times. All these duplicate posts clutter the forum making it difficult for you and all of us find what we are looking for. PLEASE search the forum for possible answers, before posting!
  2. Here is a Great Hack For Searching Those Huge Threads for your answer.
  3. Reference the link for the study you are asking about. Frequently, threads will have multiple script versions.
  4. Tell us what aggregations you are trading on.
  5. Provide a marked-up screenshot of what you are attempting to accomplish w/ your question or to illustrate the issue you are having. Provide at least one screenshot of the whole chart (or scan, watchlist, etc) and then any close-up screenshots. Don't know how to upload screenshots to the forum? Here are directions.
If no thread exists for the indicator you are referencing. YOU MUST PROVIDE THE CODE. Not a link to a YouTube video or to some other site. Nobody can help modify an existing code unless the code is provided. To share code in your post, click on this icon at the top of your post and then paste the code.
QNUw9Yh.png


Lastly, be concise and complete in your query. "It's broken" isn't a detailed enough explanation. What aggregations have you tested?
Which equities? etc.. Pictures are worth 1000 words. Not providing screenshots severely limits the type of assistance that can be given. HTH
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
Multiple Time Frames on a Chart

  1. Use of multiple time frames in a strategy can be integral to success. Plotting the higher time frame on the time-frame that you are trading on, eliminates the need to have multiple charts open.
  2. MTF indicators should ONLY be used for the overall analysis.
  3. MTF indicators should NOT be used to analyze the current candle for entry or exit due to repainting behavior which causes phantom signals to appear and disappear until the candle closes on the higher aggregation.
Having Problems? Does the MTF indicator appear to be not working or partially working when you load the study onto your chart?
A common error when using MTF indicators is trying to use a time frame that is lower than the chart you are posting it on. On the TOS platform, you can display data from a higher timeframe onto a lower timeframe but not the other way around.
https://tlc.thinkorswim.com/center/...hapter-11---Referencing-Secondary-Aggregation

HTH
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
How To Search Long Threads
Don't want to read all 30 pages of a post? Just want to find the scan, an alert, a watchlist for the study, you are looking for?
Here is how:
  1. Go to the Search feature in the upper right corner of the page...
  2. Enter the term "scan" .... or alert or watchlist or arrow. whatever you need.
  3. Select "This thread" from the dropdown on the right where it is defaulted to "Everywhere"
  4. Press Enter or click on the word "Search"...

If you press the "G" part of the "Search" button you'll get an even longer list of Google Search results, so start with the standard "Search" first and if you're not satisfied then try the "G"...
Thanks to @rad14733 for this tip.
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
The Basics for Developing a Good Strategy
  1. Never trade just one indicator. Additional indicator(s) give confirmation that improves your odds of being right as long as that second indicator does not have multicollinearity.
  2. Never trade on just one timeframe. Analyze multiple-time frames for a broader picture of what is happening w/ an asset. Higher aggregations provide a warning when there is no long-term trend or momentum to provide support to your entry. Whether scalper or swing trader the likelihood of success increases when trades go with the trend.
  3. Never enter into a trade without a strategy of when you are getting out. Studies have consistently shown that it is not poor entry points that are causing retail investors to lose money; it is poor exits. Use of the above, will improve exits and reduce false signals.
  4. This advice from @Pensar: Any trading strategy, no matter how simple or complicated, will have losses. There is no way to avoid them. That's why its critical to use stops, regardless of your indicators or method. Research and understand position sizing, probabilities, and risk-to-reward - these are highly important to successful trading. Remember that indicators only indicate, not predict - 99% of indicators are based on price or volume, so understanding the market structure is critical. Look for areas of price consolidation to capture the moves of price expansion.
Are there traders that make money and don't follow these basic tenets of Technical Analysis? Absolutely! But if you are not one of them, incorporating these concepts into your strategy could help.

You can google the basics of a good strategy for more information. This Technical Analysis Cheat Sheet link has a whole set of articles, I found informative in helping me develop successful strategies. Do not be put off by the word 'dummies' in the title. These articles are comprehensive but understandable. HTH
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
How to take perfect screenshots:
  1. Click on the upper-most hamburger icon
    HIKwnjU.png
    at the top right-hand side of the TOS chart.
  2. Click on take a screenshot.
  3. Click save.
Mark up your screenshot using an image editor so we can understand what you want us to look at.
Then to upload your screenshot to this forum, follow this tutorial:
https://usethinkscript.com/threads/how-to-insert-image-in-a-post-thread.277/
HTH
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
'custom expression subscription limit exceeded'

WatchLists

There may only be 1,100 - 1,500 Custom Watchlist Fields displayed in the TOS app at one time. It is necessary to either have fewer results populate the watchlists or have less watchlists. There is no work-around for this limitation.​
 

MerryDay

Administrative
Staff member
Staff
VIP
Adjust the distance of the Arrows to the Candles
The following snippet controls the placement of candles by using a percentage of the bar range.
The higher to value, the candle is further away from the candle. Smaller the value closer.
Ruby:
# ########################################################
# Adjust the distance of the Arrows to the Candles
# This plots arrows at a percentage of bar range above the bar high/low
def prange = high – low;
def plotHigh = high + prange * .3;
def plotLow  = low  - prange * 1.0;
plot BuyCriteria = if BuyTrigger then plotLow else double.NaN ;
plot SellCriteria = if SellTrigger then plotHigh else double.NaN ;
# ########################################################
Example of a Study Using Arrow Placement Script
Ruby:
# TOS MovingAverage Strategy
input price = close;
input averageType = AverageType.EXPONENTIAL;

plot FastMA = MovingAverage(averageType, price, 20);
plot SlowMA = MovingAverage(averageType, price, 50);
AddCloud(FastMA, SlowMA, Color.green, Color.orange);
# ########################################################
def BuyTrigger = FastMA crosses above SlowMA ;
def SellTrigger = FastMA crosses below SlowMA ;
# ########################################################
# Adjust the distance of the Arrows to the Candles 
# This plots arrows at a percentage of bar range above the bar high/low
def prange = high – low;
def plotHigh = high + prange * .3;
def plotLow  = low  - prange * 1.0;
plot BuyCriteria = if BuyTrigger then plotLow else double.NaN ;
plot SellCriteria = if SellTrigger then plotHigh else double.NaN ;
# ########################################################
BuyCriteria.SetPaintingStrategy(PaintingStrategy.ARROW_UP) ;
BuyCriteria.SetDefaultColor(color.plum);
BuyCriteria.SetLineWeight(2);
SellCriteria.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN) ;
SellCriteria.SetDefaultColor(color.blue);
SellCriteria.SetLineWeight(2);
DxjFhs6.png
 

MerryDay

Administrative
Staff member
Staff
VIP
How To Color Your Clouds
Make cloud colors modifiable and/or change the opaqueness to lighten the clouds so they don't overwhelm the candle color.

kH0PSm4.png


The following code snippet is an EXAMPLE of how to use GlobalColor.
To use the example in your code, you would add DefineGlobalColor statements for each color you want and then you put those GlobalColors in your AddCloud statement in place of the color. variables.

Code:
DefineGlobalColor("Bullish", Color.light_green);
DefineGlobalColor("Bearish", Color.light_RED);
AddCloud(YourVariable1,  YourVariable2,  GlobalColor("Bullish"),  GlobalColor("Bearish"));

Once GlobalColors are defined, click on the gear icon, next to the study and change the opaqueness

AbTky1E.png

HTH
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
How To Add A Watchlist Column
click on the gear to the right of your watchlist​
click on Customize​
CDIZ9nc.png
If you click on the drop-down arrow, you will see all the indicators available to populate a watchlist​
If you know the indicator that you want, you can type it into the box​
click on Add Item​
click on OK​
xXxAqZd.png
 

MerryDay

Administrative
Staff member
Staff
VIP
Creating A Strategy From A Study
All you need to convert a study into a study is the following code snippet. It should be added to the bottom of your study and then the study needs to be cut&pasted under the Strategy Tab.
Ruby:
Ruby:
#Order Management
AddOrder(OrderType.BUY_AUTO, YOU_NEED_TO_FILL_THIS_IN_buy  , tickcolor = Color.YELLOW, arrowcolor = Color.BLACK, name = "Buy", tradeSize = 100);
AddOrder(OrderType.SELL_TO_CLOSE, YOU_NEED_TO_FILL_THIS_IN_sell , tickcolor = Color.PINK, arrowcolor = Color.RED, name = "sell", tradeSize = 100);

The field YOU_NEED_TO_FILL_THIS_IN_buy must be replaced with whatever the field name is for the buy arrow. The field YOU_NEED_TO_FILL_THIS_IN_sell must be replaced with whatever the field name is for the sell arrow.

Read more about it here:
https://usethinkscript.com/threads/addorder-thinkscript-backtest-auto-buy-sell-in-thinkorswim.741/
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
Creating Arrow Plots

When creating plots in thinkscript you not only have to define the logic of what you want plotted but you must also state WHERE on the candle or line that you want it plotted. (IE the low, high, open, close, of the candle).
An example of the syntax is if mycondition is true then low else double.Nan (print nothing)
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
The Peculiarities Of Secondary Aggregations

The secondary aggregation period cannot be less than the chart that it is being displayed on. Higher timeframes can be used on lower timeframe charts but not the other way around.
https://tlc.thinkorswim.com/center/...hapter-11---Referencing-Secondary-Aggregation

There is no work-around to the limitation of no secondary aggregations can be used in the TOS Scan Hacker
a2.png

You can read about it here:
https://tlc.tdameritrade.com.sg/center/howToTos/thinkManual/Scan/Stock-Hacker/studyfilters
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
Combining Two or More Indicators
The easiest method to see signals from two or more studies is to set up a scan for the various study triggers. The results will only be those candidates that have met all your conditions. This method can even eliminate the need to have those studies on your chart if you are in need of real estate. This method is favored over attempting to create a kitchen sink indicator as it is much easier to change out indicators as your strategy develops.

Combining multiple indicators into the same lower section is not recommended due to scaling issue. When you zoom in and out, it shows different values.. It's like mixing oil with water :D
 
Last edited:

MerryDay

Administrative
Staff member
Staff
VIP
ToS Platform Limitations

ToS studies can be referenced in custom studies. Custom studies cannot be referenced in another script.
There is not a work_around. :(

The ToS platform does not allow backtesting of anything other than strategies. The Strategy script needs to contain all the conditions necessary to create the AddOrder statement.
 
Last edited:
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
J007RMC Pre-Market Questions & Answers Questions 18
BenTen Pre-market After-market Answers Indicators 144

Similar threads

Top