Translate bullish swing pivot from TC2000 to Thinkorswim


Category:
0
0

Hello

Can someone convert below TC2000 to Thinkorswim?

L>L1 AND H>H1 and L1<L2 and H1 <H2 and O<L +((H-L)*0.30) AND C>H-((H-L)*0.30) AND H – L >= 3 * MAX(H1 – L1, 3)

Thanks

RESOLVED
Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on June 24, 2023 10:32 pm
162 views
1
Private answer

I'm pretty sure I have this worked out. It would have been very helpful if you had included an example of this pattern from the charts so I had something to use for validating my solution. Since you did not, I strongly suggest you test this out before using it.

I have included the original TC2000 formula elements as comment lines so you can see how that formula was translated into Thinkorswim. The variable names are intended to further explain what each section of the formula is measuring.

I have included a screenshot below showing an example of this pattern on the chart. The pattern involves three candles and I have marked them with a magenta colored box.

# L > L1
def higherLow = low > low[1];
# H > H1
def higherHigh = high > high[1];
# L1 < L2
def pirorLowerLow = low[1] < low[2];
# H1 < H2
def priorLowerHigh = high[1] < high[2];
# combination of all four conditions
def pivot = higherHigh and priorLowerHigh and higherLow and pirorLowerLow;
# O < L +((H - L) * 0.30)
def openWithinRange = open < (low + (high - low) * 0.30); # C > H - ((H - L) * 0.30)
def closeWithinRange = close > (high - (high - low) * 0.3);
# H – L >= 3 * MAX(H1 - L1, 3)
def minimumRange = (high - low) >= 3 * Max(high[1] - low[1], 3);
# all conditions combined
plot scan = pivot and openWithinRange and closeWithinRange and minimumRange;

Update: In the comment section below there was a request to add another element to this scan. The idea being to use a higher time frame, (weekly), to confirm a bullish trend. This can be added to any custom scan you create on Thinkorswim and you have a nearly unlimited number of ways to determine the "bullish trend". So here are some ideas as well as resources you will need to learn how to fit all the pieces together.

First up, you need to know how to create a MTF scan:
https://www.hahn-tech.com/thinkorswim-mtf-macd-scan/

You will find that it is very simple. Just add another Study Filter to your scan and set the time frame to whatever higher time frame you want to use.

Once you get that second study filter added, you can build your "bullish trend" using the Condition Wizard. No coding required, just a few clicks of the mouse. For the condition, you might chose something like

"Stocks above simple moving average the previous 3 bars"

or

"Three consecutive bars of 2% or more gain".

Each of these are included as examples in our video Thinkorswim Condition Wizard

Or if you are feeling very adventurous, you may consider browsing existing solutions in our stock scanners topic, and try someone else's idea of a bullish condition. The following link shows the results for the search term "bullish" in our stock scanners topic:
https://www.hahn-tech.com/ans/cat/scans/page/3/?question_type=all&category=%2Fans%2Fcat%2Fscans%2F&search=bullish

I assure you if you take the time to learn how to master these tools your mind will be free to dream up an unlimited number of possibilities. But you need to invest the time in learning the tools, and how all the pieces fit together. If you don't feel you are getting the most from the scan tools on Thinkorswim, be sure to check out our master class on the topic: Thinkorswim Scans Beginner to Advanced

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on June 25, 2023 10:32 am
0
Thank you for the prompt reply. Your answers are always precise and with detailed explanation as always. This code is trying to identify big breakout bar so that we can continue the rally for next couple or 3/4 days (of course after validating the trend on weekly timeframe, though I wish even if that can be included along with this code, so basically on weekly timeframe, if the trend is long and if its not about to reach any resistance on weekly, then only you would take this trade)
( at June 25, 2023 11:13 pm)
0
Yep, that is very simple to implement. Check my update in the solution above for details. Grab a cup of coffee and get started.
( at June 26, 2023 8:32 am)