Repaints Trend Reversal for ThinkorSwim

Repaints
Status
Not open for further replies.
Is there a way to make this into a bot? auto trades using the script in this indicator with TDA API system? Also Does this website have such codes that people share here? Thanks
 

BenTen's Watchlist + Setup + Trade Recaps

Get access to Ben's watchlist, swing trading strategy, ThinkorSwim setup, and trade examples.

Learn more

@EasyRantisi The TOS platform does not support autotrading.There are APIs. If you search this forum for API, you will find some information that might help you.
 
@EasyRantisi Welcome to the usethinkscript forums... While you may be initially impressed by this indicator, hopeflly you have read about it repainting and understand the risks... I wouldn't consider this indicator to be worthy of any form of auto-trading even if it was supported by Thinkorswim...There are only a couple of auto-trading adaptations mentioned here in these forums that use an API and Python... Use the site search feature to locate them... Most members who semi-automate their trades do so using Conditional Orders with custom Thinkscript embedded in them... You will also find that a vast majority of members here primarily scalp or day trade... Good luck...
 
@EasyRantisi Welcome to the usethinkscript forums... While you may be initially impressed by this indicator, hopeflly you have read about it repainting and understand the risks... I wouldn't consider this indicator to be worthy of any form of auto-trading even if it was supported by Thinkorswim...There are only a couple of auto-trading adaptations mentioned here in these forums that use an API and Python... Use the site search feature to locate them... Most members who semi-automate their trades do so using Conditional Orders with custom Thinkscript embedded in them... You will also find that a vast majority of members here primarily scalp or day trade... Good luck...
For sure. In my experience the times the reversals actually work on the 1 minute are more times than the repaints. So getting stopped out 2 times trying to find a true reversal is small compared to the 30 cent plus move. Has that been your experience? What indicator has benefited you the most? For me it’s probably the volume buy sell. Helpful when reading price action.
 
Is there a way to get this on mobile as an indicator? Perhaps like a triangle on the candle stick to note reversal. I really enjoy this on the 10 and 15-M frame as an option day-trade play. Easy to use.

1. My method, wait 1-hour after the bell rings
2. Wait for indicator to pop-up. Watch the volume bar be super green.
3. Sell 10 vertical contracts with a 20% stop
4. Wait for the next trend reversal to pop up again.
5. Wait until the 10-minute reversal happens
6. Sell and find another stock.

I’m a Fibonacci trader
1. BTD upper indicator Meter 0.2 or less
2. TMO Crossover
3. BTD Multi Time frame convergence of short and medium trend. All three would be ideal and sell.
4. BlackFlagSwingArm hitting first fib line. Excellent trailing Fibonacci
5. Custom volume that shows ask vs bids
6. Painted Beep Boop Bars.

However. I would like to show the bars painted when ask Or his volume is 90% or more
 
For sure. In my experience the times the reversals actually work on the 1 minute are more times than the repaints. So getting stopped out 2 times trying to find a true reversal is small compared to the 30 cent plus move. Has that been your experience? What indicator has benefited you the most? For me it’s probably the volume buy sell. Helpful when reading price action.

I trade based more on momentum than simple reversals... I've dabbled with trend reversals but they are too unpredictable because there is no real way of knowing when the bottom is the real bottom... I've even observed RSI as confirmation only to have a reversal above the 30 turn again and drop into the teens... Momentum insures that reversal has been established and makes it possible to grab a small scalp before momentum slows and reverses or enters consolidation... How the market is interpreted depends on individual trading style... I usually monitor multiple indicators...
 
Take a look st PSAR.
The purpose of the PSAR indicator is to determine trend direction, capture reversal signals and trade entry and exit points.
A bullish trend is characterized by PSAR a dot below a candlestick body, bearish trend is characterized by a PSAR dot above a candlestick body.
It performs best in markets with a steady upwards or downwards trend. Since the parabolic SAR tends to whipsaw back and forth in choppy or
sideways markets, it’s not wise to use it for trading signals then.

The Signal is shown by the switch of position of PSAR dots (or what shape you want to us), and Up and Down Arrows at the turning points,
Sounds alerts can be added at the bottom of the the TOS study, and there is a label at the top which also notifies upon a change. You can change the sounds, or add a custom one.

Code:
# from input all the way down to plot is merely a copy/paste of the traditional PSAR study.  Below that is the additional lines added to the code to create audible and visual alerts + chart label.

input accelerationFactor = 0.02;
input accelerationLimit = 0.2;

assert(accelerationFactor > 0, "'acceleration factor' must be positive: " + accelerationFactor);
assert(accelerationLimit >= accelerationFactor, "'acceleration limit' (" + accelerationLimit + ") must be greater than or equal to 'acceleration factor' (" + accelerationFactor + ")");

def state = {default init, long, short};
def extreme;
def SAR;
def acc;

switch (state[1]) {
case init:
    state = state.long;
    acc = accelerationFactor;
    extreme = high;
    SAR = low;
case short:
    if (SAR[1] < high)
    then {
        state = state.long;
        acc = accelerationFactor;
        extreme = high;
        SAR = extreme[1];
    } else {
        state = state.short;
        if (low < extreme[1])
        then {
            acc = min(acc[1] + accelerationFactor, accelerationLimit);
            extreme = low;
        } else {
            acc = acc[1];
            extreme = extreme[1];
        }
        SAR = max(max(high, high[1]), SAR[1] + acc * (extreme - SAR[1]));
    }
case long:
    if (SAR[1] > low)
    then {
        state = state.short;
        acc = accelerationFactor;
        extreme = low;
        SAR = extreme[1];
    } else {
        state = state.long;
        if (high > extreme[1])
        then {
            acc = min(acc[1] + accelerationFactor, accelerationLimit);
            extreme = high;
        } else {
            acc = acc[1];
            extreme = extreme[1];
        }
        SAR = min(min(low, low[1]), SAR[1] + acc * (extreme - SAR[1]));
    }
}

plot parSAR = SAR;
parSAR.SetPaintingStrategy(PaintingStrategy.POINTS);
parSAR.SetDefaultColor(color.BLUE);



#code below this line creates a visible alert (chart label) and audible alert on the first bar the PSAR dots flip (price crosses PSAR)

# because of the copy/paste of tradtional PSAR study above this it is easy to use that to create the below def and plot with simple lines of code.

def PSAR = ParabolicSAR(accelerationFactor = accelerationFactor, accelerationLimit = accelerationLimit);

plot BullishSignal = Crosses(PSAR, close, CrossingDirection.BELOW);
BullishSignal.SetLineWeight(5);
BullishSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
BullishSignal.AssignValueColor(CreateColor(51, 204, 0));

# in Alert you select what text will appear in the messages window when your alert trigers by placing those words between quotation marks.  Alert(condition or trigger, words to appear, how often to sound the alert, what sound to hear)
Alert(BullishSignal, "Bullish PSAR", Alert.BAR, Sound.Ring);
AddLabel(close > PSAR, "     Bullish PSAR     ", CreateColor(51,204,0));

# Because BullishSignal will be true ONLY for the bar where the PSAR dots flip, this label is a visual alert that will ONLY appear at the time the PSAR dots flip
AddLabel(if BullishSignal == 1 then yes else no, "     PSAR just flipped to Bullish     ", (CreateColor(51,204,0)));



plot BearishSignal = Crosses(PSAR, close, CrossingDirection.ABOVE);
BearishSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
BearishSignal.AssignValueColor(Color.RED);
BearishSignal.SetLineWeight(5);

# Because BeaarishSignal will be true ONLY for the bar where the PSAR dots flip, this label is a visual alert that will ONLY appear at the time the PSAR dots flip
Alert(BearishSignal, "Bearish PSAR", Alert.BAR, Sound.Ring);
AddLabel(close < PSAR, "     Bearish PSAR     ", color.RED);
AddLabel(if BearishSignal == 1 then yes else no, "     PSAR just flipped to Bearish     ", color.RED);
 
@amangaloreab If you read through this thread, you will see that it's a common issue. Not much we can do due to the repainting factor of the indicator.
 
@Picard to use the script in post# 1385 in the TOS scanner
Copy the code
In Studies, click Create
Paste the above study
Name the study: Trend_Reversal_Scanner
Save
Click on the scanner.
  1. Click on +Add filter
  2. Click on the pencil icon next to the filter you just added
  3. Click edit
  4. In the left column, click on the 1st pull-down window, click study
  5. Type in Trend_Reversal_Scanner
  6. Under Plot, click on the pull-down window, choose upArrow
  7. In the middle column, choose is true
  8. Save
I didn't write this script. Any questions should be referred to the original poster. HTH
I'm not that new to scanning and do it most every day. But for some reason I did what you said 1-8 and scanned saved the study and called it just like it say. But I get no results can anyone help out? I've tried limiting the search to NYSE or NAS and $10-20 stocks but no hits I even changed it from 1 bar ago to upto 3 bars ago and nothing. Not sure what I'm missing. :(

MK
 
@svencool If you upload an image of a stock chart that has the trigger on the current candle and provide an image of the scanner which is not showing that stock in its results, someone on here might be able to troubleshoot the issue.
How To Insert An Image Into A Post

This scanner is too complex to run on the universe of stocks. And we have no idea if the subset of stocks that you have attempted to run it against has no results because at that moment there are no signals or if there is a programming issue. Be aware that studies that are too complex to run overall, do tend to have flaky results even when you reduce the subset.
 
@mikeraya Been using it for awhile.
@BenTen Is there a certain time to run scans? I ran one and got about 75 Stocks and tried running it since same scan and script errors out. Didn't know if the TOS Server was to busy or, figured if you have used it maybe you could give me some pointers? Like with in 3 bars or what ever thanks.... Just seems like I keep getting Error: Script Execution Timeout.

I figured this out. I was making a mistake I changed the value from 1 to a 2 and works perfectly.... Thanks for everyone putting up with my novice questions. I wrote a scan that finds up-trending stocks and have had a pullback. Then I scan that list and seems to work just fine. Thanks for the push everyone!

MK
 
Last edited:
@BenTen Is there a certain time to run scans? I ran one and got about 75 Stocks and tried running it since same scan and script errors out. Didn't know if the TOS Server was to busy or, figured if you have used it maybe you could give me some pointers? Like with in 3 bars or what ever thanks.... Just seems like I keep getting Error: Script Execution Timeout.

That error is common if you are trying to scan too many symbols... The solution is to only scan a subset, like one of your watchlists, rather than All Stocks... Are you really going to trade All Stocks...??? 💡
 
Getting a lot of execution timeout on the scanner. Anyone else? Worked initially. Scanning about 30 tickers.
 
Status
Not open for further replies.

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
333 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top