Trend Reversal Indicator with Signals for ThinkorSwim

MerryDay

Well-known member
VIP
The below instructions were provided in post# 1387. For future reference, here is a hack for when you don't want to read all 71 pages of a post, just to find the scan, an alert, or a watchlist.

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 whatever you named the shared study
  6. Under Plot, click on the pull-down window, choose upArrow
  7. In the middle column, choose is true
  8. Save
HTH
 

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

MKToronto

New member
That doesnt seem to be how this indicator works. If a green bubble gets stopped out it will just disappear and wont change to a red bubble until it confirms a downward trend. The code I posted will alert you whenever a buy or sell bubble pops up.
Fantastic!!! It's working the way I wanted... Tons of thanks for your kindness.
 

MKToronto

New member
There's quite a few solutions on this thread but a lot of them either didn't work or the alert lagged. I found this code on page 66 to do exactly what I wanted - fire off an alert once a bubble pops up.

Rich (BB code):
#Alerts
input alerts = yes;
def bullish2 = if signal > 0 and signal[1] <= 0 then 1 else 0;
def bearish2 = if signal < 0 and signal[1] >= 0 then 1 else 0;
Alert(alerts and bullish2[1] == 1, "Up   ", Alert.BAR, Sound.Chimes);
Alert(alerts and bearish2[1] == 1, "Down ", Alert.BAR, Sound.Bell);

Btw, not stepping on your toes @MerryDay. Just sharing the solution I found works best. Perhaps Ben could share this code snippet on the first post?
Hello: May I ask for another help. Is there a way to show bid and ask size on a chart. The bid and ask Indicator is available but couldn't find a size indicator.
 

rad14733

Well-known member
VIP
Hello: May I ask for another help. Is there a way to show bid and ask size on a chart. The bid and ask Indicator is available but couldn't find a size indicator.

No... That data is not available via Thinkscript, only at the platform level...
 

EasyRantisi

New member
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
 

rad14733

Well-known member
VIP
@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

New member
@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.
 

TeddyBender

New member
VIP
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
 

rad14733

Well-known member
VIP
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...
 

Dman

New member
VIP
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);
 

svencool

Member
VIP
@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
 

MerryDay

Well-known member
VIP
@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.
 

svencool

Member
VIP
@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:

Volatility Trading Range

VTR is a momentum indicator that shows if a stock is overbought or oversold based on its Weekly and Monthly average volatility trading range.

Download the indicator

Similar threads

Top