Custom Indicator - No Trade Zone Warning Back Ground Highlights!

3163 10
Years ago I did an analysis of my trades. Every period of the day was profitable except for two. From 10:00-1030, and 1:00 to 1:30. (I was actively Day Trading Futures ) Imagine a vertical graph broken down in to 30 minute time segments. I had nice Green bars in every time slot (Showing Net Profits), and HUGE Red Bars from 10 to 10:30 and 1 to 1:30. After analysis I found I made consistent profits at session open, but then I would enter in to bad setups around 10 to make more money. I also found after I took lunch when I came back at 1:00 I would force trades instead of patiently waiting for a great trade setup. I created an indicator that plotted a red background around those times telling me I was not allowed to enter a trade. Profits went up!!! Details on How to adjust times are in 1st Post. You can adjust times and colors to meet your own trading needs.
Remove from Favorite Scripts Add to Favorite Scripts
//Created By User ChrisMoody
//Created on 3-5-14
//Special Thanks to TheLark for showing me who to create the On/Off Check Boxes for The Plots.

study(title="CM_No-Trade-Zone", shorttitle="CM_NoTradeZone",overlay=true)
timeinrange(res, sess) => time(res, sess) != 0
sNT1 = input(true, title="No Trade Zone 9:30-10:00 AM EST?")
sLunch = input(true, title="Lunch 12:00-1:00 PM EST")
sNT2 = input(true, title="NTZ 1:00-1:30 PM EST")
warnClose = input(true, title="Warning Close 3:30-3:50 PM EST")
warnCloseFinal = input(true, title="Warning Close Final 3:50-3:55 PM EST")

//Extra Plots If Needed - Step1 - make sure you make active Step 2 and Step 3 Below
// Make active by deleting the to forward slashes at the left of extraPlot1 and 2
//extraPlot1 = input(true, title="ExtraPlot1 add Time Description")
//extraPlot2 = input(true, title="ExtraPlot2 add Time Description")

noTrade1 = red
lunchHour = yellow 
noTrade2 = red
warn_Close = orange 
warn_CloseFinal = orange

//Make active by deleting the to forward slashes at the left of extraPlot_1 and 2 - You can change colors here
//extraPlot_1 = red
//extraPlot_2 = red

//Must use Military Time  1300 = 1:00PM
//***Make sure your time zone is set to your correct time zone
bgcolor(sNT1 and timeinrange(period, "0930-1000") ? noTrade1 : na, transp=60)
bgcolor(sLunch and timeinrange(period, "1200-1300") ? lunchHour : na, transp=60) 
bgcolor(sNT2 and timeinrange(period, "1300-1330") ? noTrade2 : na, transp=60)
bgcolor(warnClose and timeinrange(period, "1530-1550") ? warn_Close : na, transp=50)
bgcolor(warnCloseFinal and timeinrange(period, "1550-1555") ? warn_CloseFinal : na, transp=10)

//Additional Plots if needed STEP 3  Adjust Time
//bgcolor(extraPlot1 and timeinrange(period, "1000-1030") ? extraPlot_1 : na, transp=60)
//bgcolor(extraPlot2 and timeinrange(period, "1400-1430") ? extraPlot_2 : na, transp=60)
Is it possible to change the colored in areas to plot dotted vertical lines instead? @ChrisMoody
Hi Chris, I love your work and am very interested in creating different chart looks. I have a few myself that look as if they have potential and will forward them to you. In the meantime I have a request. Could you modify the standard linear regression indicator that we get on tradingview such that the base line changes colour depending on whether it is pointing up or down? Thanks for all the interesting charts you have created.
Linear Regression Lines isn't a indicator we have access to yet. It's coming in a upcoming release...Then it shouldn't be a problem
What platform do you use? With all of your indicators, are they easily adopted on think or swim?
ChrisMoody blair_trader
Thats a simple bud loaded question for me...I own about every platform there is. I primarily use MultiCharts and are the professional and institutional grade platforms produced by the creators of TradingView. Both retail for $1500 a piece...I've had TOS since Tom Sosnoff released it. I trade options through that platform but don't use it for charting due to many limitations...however for free it's a great platform. If your a TOS fan I can't recommend enough paying for the top level of creator is the #1 developer for TOS and with the paid subscription he gives you all of the indicators/systems he's created. The forum has extremely talented programmers and pretty much every indicator you could want is already been produced on the paid forum...or people will gladly help you customize....

If your looking for specific charting features let me know and i can pint you in the right direction. However...I can assure you with the upgrades TradingView has planned over the next 3-6 months this platform will give you more features than other platforms.
Is perfect now, thanks!
Good...Glad you got it working
I love it! The time looks weard in my chart, show up 10:05 to start, 11:00, 12:00, 13:00 and so on.
Love it - great job
Includes Checkboxes in Inputs Tab To Easily Turn On/Off Highlight Periods.

Optimized for a 5 Minute Bar or Less. Max 30 Minute Bar (Won’t Show FinalWarning). To use a larger timeframe like 60 minutes all of the times need to cover a 60 minute period.

This indicator defaults to a period of NoTradeZone (Red) 9:30 to 10am, 12-1 (Lunch Hour-Yellow), NoTradeZone (Red) 1-1:30 and an WarningMarketsClosing Orange plot from 3:30 until 3:50pm and FinalWarning (Dark Orange) 3:50-3:55. You can change colors in the settings. But you have to go in to the source code to change times (Currently it’s not possible to set up where you can enter times in the Inputs Tab). Also make sure you have your time zone set Correctly!!!

You Must Watch Video Titled “Changing Time In The Code” For Directions On Adjusting Time Periods.

New Video Titled “Importing Custom Indicators” explains How To Install Using PasteBin Link to get Code for Indicator.

Link To Both Videos…Blog Post Dated Mar 03 2014:

Link To Copy Code:
Home Stock Screener Forex Screener Crypto Screener Economic Calendar Shows How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out