Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

Custom FP/HRFP Indicator for ThinkOrSwim

Posted by robert 
Custom FP/HRFP Indicator for ThinkOrSwim
July 16, 2013 08:13AM
I have written an indicator which will mark the chart when a FP or HRFP occurs. This indicator will work on any time frame chart.



Some things to note:

1. This indicator marks a FP/HRFP in the very strictest sense of the term. That is to say, the indicators are crossing at the same time.

2. Based on the mathematics alone, this indicator will consider a cross to have happened even if the lines have crossed by the tiniest bit.

3. Due to the above, what the indicator considers a FP/HRFP may be different than what the user is comfortable calling a FP/HRFP.

Caveat Emptor
A FP/HRFP which has been flagged is not necessarily a trade. The user is responsible for identifying what is or is not a trade.





Copy and Paste Everything Below This Line

# FP/HRFP Identifier
# Robert Payne

def CCr = Average(close,2);
def CCg = Average(close[3],3);
def C1 = if (CCr[0] > CCg[0] AND CCr[1] <= CCg[1]) then 1 else if (CCr[0] < CCg[0] AND CCr[1] >= CCg[1]) then -1 else 0;

def RSI = RSIWilder(length = 13).RSI;
def highestRSI = Highest(RSI, 21);
def lowestRSI = Lowest(RSI, 21);
def RSIS = (RSI - lowestRSI) / (highestRSI - lowestRSI);
def Kpd = Average(RSIS, 3);
def Dpd = Average(Kpd, 5);
def C2 = if (Kpd[0] > Dpd[0] AND Kpd[1] <= Dpd[1]) then 1 else if (Kpd[0] < Dpd[0] AND Kpd[1] >= Dpd[1]) then -1 else 0;

def MACDr = ExpAverage(close,8) - ExpAverage(close,13);
def MACDg = ExpAverage(MACDr,5);
def C3 = if (MACDr[0] > MACDg[0] AND MACDr[1] <= MACDg[1]) then 1 else if (MACDr[0] < MACDg[0] AND MACDr[1] >= MACDg[1]) then -1 else 0;

def DIr = DIPlus(5);
def DIg = DIMinus(5);
def C4 = if (DIr[0] > DIg[0] AND DIr[1] <= DIg[1]) then 1 else if (DIr[0] < DIg[0] AND DIr[1] >= DIg[1]) then -1 else 0;

def Count = C1 + C2 + C3 + C4;
def Hup = if Count == 4 then 1 else 0;
def Fup = if Count == 3 then 1 else 0;
def Hdn = if Count == -4 then 1 else 0;
def Fdn = if Count == -3 then 1 else 0;

AddVerticalLine(Fup,"FP",color.light_green);
AddVerticalLine(Hup,"HRFP",color.green);
AddVerticalLine(Fdn,"FP",color.pink);
AddVerticalLine(Hdn,"HRFP",color.red);
Re: Custom FP/HRFP Indicator for ThinkOrSwim
July 16, 2013 10:51AM
Robert - thanks again. Great info
TCB
Re: Custom FP/HRFP Indicator for ThinkOrSwim
July 16, 2013 12:45PM
Awesome, thanks for sharing
Re: Custom FP/HRFP Indicator for ThinkOrSwim
August 20, 2013 09:08AM
Robert - this is a great study.

yesterday it started to act strangely.

not sure if its due to TOS update 2 days ago or not.

are you having any problems?

Walt
Re: Custom FP/HRFP Indicator for ThinkOrSwim
August 20, 2013 09:30AM
Robert,

How do you include screen shots
Re: Custom FP/HRFP Indicator for ThinkOrSwim
August 20, 2013 03:38PM
Quote
Wallemac
Robert - this is a great study.

Thanks.

Quote
Wallemac
yesterday it started to act strangely.

not sure if its due to TOS update 2 days ago or not.

are you having any problems?

Walt

I've not noticed any problems. However, I do know that the TOS weekend update was extremely buggy and was pulled back on Sunday. (I believe this is the first time they've had to pull a release back and revert to the previous build.) So...it's possible that if you still have the newest release of TOS that it is causing problems.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
August 20, 2013 03:54PM
Quote
mtut
Robert,

How do you include screen shots





Re: Custom FP/HRFP Indicator for ThinkOrSwim
August 21, 2013 04:16PM
Thanks Robert, I have implemented your indicator into my everyday trading. I have also converted your code into a column. However, due to the current restraints of TOS, you can not set it for any type of custom timeframe. Have to use 60 or 20 instead of 55 and 21
Re: Custom FP/HRFP Indicator for ThinkOrSwim
August 21, 2013 05:10PM
This seems useful. Thank you for posting.



Edited 1 time(s). Last edit at 08/21/2013 05:15PM by rufinatti.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
August 21, 2013 05:16PM
Quote
mtut
Thanks Robert, I have implemented your indicator into my everyday trading. I have also converted your code into a column. However, due to the current restraints of TOS, you can not set it for any type of custom timeframe. Have to use 60 or 20 instead of 55 and 21

You are correct as to the limitations of the timeframes. I've spoken with customer service and, as of now, there is no plan to implement that feature in the near future.

Congrats on converting the code to a column indicator. It is also very easy to tweak for a custom scanner in TOS so that it can scan the whole market, or whatever segment you desire, for FP/HRFP plays.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
September 11, 2013 03:32PM
code is working like a charm now. thanks for sharing Robert
Re: Custom FP/HRFP Indicator for ThinkOrSwim
September 11, 2013 03:47PM
You were sold on FP,HRFP but there is alot more need.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
September 13, 2013 01:31PM
Wonderful - THANK YOU for sharing this!
smileys with beer
Re: Custom FP/HRFP Indicator for ThinkOrSwim
September 15, 2013 08:50AM
Does this method work on the Daily and 233 charts? Thanks much!

- RaleighTrader
Re: Custom FP/HRFP Indicator for ThinkOrSwim
September 15, 2013 10:40AM
Quote
RaleighTrader
Does this method work on the Daily and 233 charts? Thanks much!

- RaleighTrader

Yes. This indicator will work for any time frame. Just follow the instructions above and add it to your chart.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
September 15, 2013 07:50PM
Hi Robert,

I noticed on one of your screen shots (for Netflix) that you had a 20 day, 13 min timeframe. Is there a way to customize such timeframes on TOS Charts? Just curious, thanks much!

Kind regards,
RaleighTrader
Re: Custom FP/HRFP Indicator for ThinkOrSwim
September 15, 2013 08:46PM
Quote
RaleighTrader
I noticed on one of your screen shots (for Netflix) that you had a 20 day, 13 min timeframe. Is there a way to customize such timeframes on TOS Charts? Just curious, thanks much!

It's easy, though not immediately obvious. Take a look at this thread: [www.researchtrade.com]
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 26, 2013 10:47AM
I am a GW 1-5 student and am using your indicator and am finding it very useful. Would you kindly share with me how to convert it into a scan for TOS?
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 26, 2013 11:27AM
Quote
Modata
I am a GW 1-5 student and am using your indicator and am finding it very useful. Would you kindly share with me how to convert it into a scan for TOS?

Follow the directions I posted here to begin setting up your scan.

-- Set your price and volume requirements as desired.
-- When you get to the part about adding a custom filter, use the below code and keep the aggregation setting on "daily" rather than changing it to "weekly" as in the example posted in that thread.

If you follow those instructions, you'll end up with a scan which will scour all of the market stocks looking for a FP/HRFP. However, if you want to only scan through the list of stocks that are in your personal trading basket, then change the drop down menu for "Scan In" from "All Stocks" to your personal basket as demonstrated below. Also, I would delete the price and volume filters leaving only the custom scan filter since you've already pre-screened the stocks in your personal basket to meet your needs.



def CCr = Average(close,2);
def CCg = Average(close[3],3);
def C1 = if (CCr[0] > CCg[0] AND CCr[1] < CCg[1]) then 1 else if (CCr[0] < CCg[0] AND CCr[1] > CCg[1]) then -1 else 0;
def RSI = RSIWilder(length = 13).RSI;
def highestRSI = Highest(RSI, 21);
def lowestRSI = Lowest(RSI, 21);
def RSIS = (RSI - lowestRSI) / (highestRSI - lowestRSI);
def Kpd = Average(RSIS, 3);
def Dpd = Average(Kpd, 5);
def C2 = if (Kpd[0] > Dpd[0] AND Kpd[1] < Dpd[1]) then 1 else if (Kpd[0] < Dpd[0] AND Kpd[1] > Dpd[1]) then -1 else 0;
def MACDr = ExpAverage(close,8) - ExpAverage(close,13);
def MACDg = ExpAverage(MACDr,5);
def C3 = if (MACDr[0] > MACDg[0] AND MACDr[1] < MACDg[1]) then 1 else if (MACDr[0] < MACDg[0] AND MACDr[1] > MACDg[1]) then -1 else 0;
def DIr = DIPlus(5);
def DIg = DIMinus(5);
def C4 = if (DIr[0] > DIg[0] AND DIr[1] < DIg[1]) then 1 else if (DIr[0] < DIg[0] AND DIr[1] > DIg[1]) then -1 else 0;
def Count = C1 + C2 + C3 + C4;
plot Decision = if Count >=3 OR Count <=-3 then 1 else double.nan;
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 26, 2013 04:52PM
Thank you. I look forward to giving it a try.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 30, 2013 01:01PM
Hi Robert,

Is it possible to write a formula for HRFP in TC2000?
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 30, 2013 02:14PM
Quote
26htailog
Is it possible to write a formula for HRFP in TC2000?

I'm sorry to tell you that I am utterly unfamiliar with that product. I have never once looked at it and have no idea what capabilities it has. I've got quite a lot on my plate this week; but if I get time and if TC2000 is something that I can install on my Mac for free, I'll take a look at it.



Edited 1 time(s). Last edit at 12/30/2013 02:20PM by robert.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 30, 2013 05:35PM
I understand Robert. If you do get the time then I truly appreciate it.

Thanks for the response and have a wonderful new year!
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 30, 2013 06:24PM
Hi Robert, thanks so much for this contribution. Just curious how did you add that trigger line to your DMI study? I can't find where to add the band? Is it a custom ADX study? Thanks
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 30, 2013 09:22PM
Quote
jmkiritsis
Just curious how did you add that trigger line to your DMI study? I can't find where to add the band? Is it a custom ADX study?

Yes, custom. Dead simple, though. Adjust the colors and trigger level as desired from the indicator settings menu.

# DI Indicator with Trigger Line
declare lower;

input DI_length = 5;

plot "DI+" = DIPlus(DI_length);
"DI+".SetDefaultColor(Color.RED);
"DI+".SetLineWeight(2);

plot "DI-" = DIMinus(DI_length);
"DI-".SetDefaultColor(Color.GREEN);
"DI-".SetLineWeight(2);

plot trigger = 10;
trigger.SetDefaultColor(Color.GRAY);

If you are using the modified DI / ADX indicator that I posted in the fun with thinkscript thread, just add the following to the bottom of that code if you want to add the trigger line.

plot trigger = 10;
trigger.SetDefaultColor(Color.GRAY);
Re: Custom FP/HRFP Indicator for ThinkOrSwim
December 30, 2013 09:58PM
26htailog,

As a follow up to your request, I looked into installing TC2000 on my system, but it is a subscription service that I'll not be signing up for. So, I'm afraid you'll have to figure it out on your own. Sorry, bud.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
January 28, 2014 05:07PM
Thanks for posting this. I think it will really help me on days when I am in a jam and don't have as much time to spend on charts.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
February 11, 2014 05:46PM
Hi Robert,

I set up your FP/HRFP scan. Thanks so much for the tutorial!. Do you know of any way to have it scan on a custom 233 time frame instead of a daily time frame? I didn't see that option but just curious if you knew if it was possible.

Thanks again for your great contributions.

John
Re: Custom FP/HRFP Indicator for ThinkOrSwim
February 11, 2014 06:03PM
Quote
jmkiritsis
I set up your FP/HRFP scan. Thanks so much for the tutorial!. Do you know of any way to have it scan on a custom 233 time frame instead of a daily time frame? I didn't see that option but just curious if you knew if it was possible.

You're welcome. Unfortunately, due to the restrictions of the ThinkorSwim platform, it is not possible to run a scan on custom time frames. The closest you could get to that would be to pick an aggregation period of 4 hours.



Edited 1 time(s). Last edit at 02/11/2014 06:05PM by robert.
Re: Custom FP/HRFP Indicator for ThinkOrSwim
February 11, 2014 11:00PM
Hi Robert,

Thanks, yeah I figured. Just thought hopefully maybe there was a chance I was missing something.

Thanks again smiling smiley
Sorry, only registered users may post in this forum.

Click here to login