//Created by user ChrisMoody, with help from Alex in TechSupport and TheLark //Currently works on Stocks //Currently works on Forex but only based on the New York Session starting at 1700 East Coast Time //Futurer Versions will have options to plot sessions bsed on Forex Europe Opening Range , Asia, etc. study(title="CM_Opening-Range-V1", shorttitle="CM_OpenRnge-V1", overlay=true) up60on = input(true, title="60 Minute Opening Range High") down60on = input(true, title="60 Minute Opening Range Low") up30on = input(false, title="30 Minute Opening Range High") down30on = input(false, title="30 Minute Opening Range Low") is_newbar(res) => change(time(res)) != 0 adopt(r, s) => security(tickerid, r, s) high_range = valuewhen(is_newbar('D'),high,0) low_range = valuewhen(is_newbar('D'),low,0) high_rangeL = valuewhen(is_newbar('D'),high,0) low_rangeL = valuewhen(is_newbar('D'),low,0) up = plot(up60on ? adopt('60', high_range):na, color = lime, style=circles, linewidth=4) down = plot(down60on ? adopt('60', low_range): na, color = #DC143C, style=circles, linewidth=4) trans60 = up60on ? 75 : 100 fill(up, down, color = white, transp=trans60) up30 = plot(up30on ? adopt('30', high_rangeL): na, color = #7FFF00, style=circles, linewidth=2) down30 = plot(down30on ? adopt('30', low_rangeL): na, color = red, style=circles, linewidth=2) //trans30 = up30on ? 70 : 100 //fill(up30, down30, color = white, transp=trans30)
-Plots High and Low of Opening Range for first Hour (default) for Stocks and Forex. Option to plot 30 minute Opening Range.
-For Stocks - Only uses Cash Session and Pre/Post market hours must be turned off. (Will fix in future update.
-For Forex - Only plots Opening Range of New york session opening at 5pm East Coast time. (Will add Europe, Asia, Australia session options in future release).
*** IntraDay Futures are coming soon and will adjust Opening range times for those sessions.
Known Issue: Transparent background isn’t plotting if you only choose the 30 minute Opening Range. Will be fixed soon in a future release.
Video on how to import this Indicator:
Link to Code for Indicator:
a mid range line plus fibo extension lines at 1.382 and 1.618 something you could consider adding to yours. I am sure the peeps at TV will appreciate as we all
appreciate all you do. Cheers
FYI, Admin responded with the following suggestion:
"maybe you don't know about Pine Script new features:
Inputs for session, resolution and symbol. You may use them in this script and make it more usable than now."
Stocks work perfect.
Forex works perfect based on NY Session open at 1700
We could code Europe etc but the problem is we couldn't get the lines to stop at 1700 when the day resets in Forex. So Europe was going from 0300 to 0300...this creates a problem b/c the typical use is to look at current days ranges on the timezone yuoo trade and then in comparison to the Opening Range of Other markets around the world. The issue is we need all the lines to stop plotting at the same time. I'll let you know as soon as this feature becomes available....which it may have been updated this week I just haven't heard back yet to verify or seen any documentation on how the function would be written.
All I would say is code it so the option is there for either the Stock market (30/60mins) or FOREX (to end of Asian session = 300 mins).
I would also ask it if is possible to only draw the respective indicator based on the Symbol used...i.e. draw ASIAN range when FOREX symbol selected, draw 30/60 mins when Equities selected. Not sure if one of the functions currently provides that info (or a work around using TICKID to ID the market?).
I'll have to check regarding recognizing Forex Vs. Stocks etc. Not sure on that one... I know you can specify a specific symbol, not sure if you can specify a group of symbols...Might be possible to create True condition for certain forex pairs since most forex traders don't actually trade that many symbols....
So what I meant to say is that the "Asian Range" in FOREX is used similarly to the 30/60 min opening range.
Note however people may use different times for the "Asian Range". I currently have it set to 300 mins = 1700-2200 (oops, that is wrong, should be 480 = 1700-0300...I have to change my code). But others may want to use 2400, so would need to use a setting of 350. Is there a way to make this an input value?
As far as NY not opening at 1700 it is true and false...so I'll give that one to you. NY official trading day starts at 1700 and goes to 1700 the next day. BUT since for all the other sessions I'm using their active when the banks are open I'll change NY to 0800 when US banks open. Initially we couldn't that. But the added in the sessions function...Before that ALL Forex was based on the day starting at 1700 NY time and ending and 1700... Making good progress but we're just no there yet to make THIS CURRENT Project work perfectly TODAY...Maybe we will get a gift next week....
BTW, Start of FOREX day = 1700. That is when swaps are settled and is official start of trading day. Start of NY = 0800.
So, as for sessions, the more I think about it, the more I think all that is needed is what I have added to your code. In other words, Just code for the open/start of the FOREX day at 1700 to soem close, eg. the end of Asian Session. 2 settings often used: 2400 (=420 mins from open) or 0200(=540 mins). But if can make the input user defined, with defaults, then that would be very good.
// Inverse Fisher Transform Stochastic Oscillator
stochper = parameter("Stoch Period");
slowing = parameter("Stoch Slowing");
RBWStoch=(Sum(RBW- low(RBW, stochper ) , slowing ) /
x = .1*(RBWStoch-50);
Settings are below. Does this look right?
And what platform did that code come from So I can try and check it?
length = input(14, minval=1)
smoothK = input(1, minval=1)
smoothD = input(3, minval=1)
k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)
He's actually already coded the Inv fisher RSI and several others. I'm consulting with him and he is helping us out. He's also already coded the Cyber Cycle that I found when I started researching this code. Most people use it with this the Inv Indicators....
The closest I've gotten is Plotting the Europe Session but the problem is the lines go for an entire 24 hours to 0300 the following day, so NY would plot from 0800 to 0800, which of course creates overlapping of session lines that are from the previous day. I need to get the lines to stop at 1700 for all sessions. It's my top priority right now...and I will post the update here so you will automatically be notified.
Here is a little secret for you. The founders of TV have created the most advanced Institutional grade platforms in existence. I know b/c I own them. People purchase those platforms that run extremely advanced systems, and they do everything your talking about with ease. A lot of the same programmers are working on TV. It's not a "Hope" these features come....what will be released in the next several months to a year will be advanced features 99.9% of all retail traders have never seen. TV users will have the most advanced platform ever created...that's is why I am here b/c I want to be a small part of it. We are working with a developer and will soon be implementing his system on TV. I have this developers system and your talking thousand and thousands of lines of code. The technology they have on the back end will give a TV user with a basic computer and or an iPad more features and capabilities than I have with "Very" expensive platforms and a 10K state of the art computer. ....And all for $20 a month plus a few add ons here and there.
Lots of great stuff coming.....Great time to be a Trader...
I'll call the Premium Data Vendor tomorrow and ask why they didn't back adjust the price and see what they say. And I'll call the other data vendor and see why they did back adjust the price. I don't trade stocks...but I know if a individual stock pays a dividend the price droops b/c the company has less money on their balance sheet so Wall Street adjusts the price accordingly. So my gut call is this is a rare situation where the SPY didn't show the same intraday chart as the SPX Index. I'll try and find out why one data vendor would show the historical prices different from the other one and TradingView....
US residents can't trade it...unless they ca no pen up a trading account overseas with roughly a million dollars. Theres a few loopholes regarding creating a LLC (Business entity) and documenting you have a high net worth.
So this leaves us with people who live outside the United States who have a spot Forex Account...which is the majority of traders outside the US. The vast majority of those traders trade the Forex market exclusively. If they do trade (CFD's) I may have misspelled that...then the vast majority will trade the equivalent of the ES futures contract (S&P 500) vs. the Dow, or Spot Gold or Oil. Even in the US the Dow futures have pretty light volume...although there is plenty of volume to trade it.
How can you trade it:
The session can be customized to start plotting that indicator at the US open 9:30 New York time. Or you could simply use symbol DIA, the Dow 30 ETF on your chart...and if it breaks the opening range enter in the US30 you have access to. Th entries and exits should be 99.9% the same no matter which symbol you plot on the chart...Since the US30 is based on the DOW 30 if the prices were different their would be huge Arbitrage opportunities institutions would capitalize on...due to the liquidity those almost never exist. In my opinion the Dow futures trade "Cleaner" than the ES contract by far. One benefit of plotting the DIA symbol is you will be able to see gaps that the US30 won't show you. And you have to take Gaps in to account with the opening range trade....but that's a topic for another time....