Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator('Forex/Crypto/Custom Market Sessions v2', overlay=true)
- //credit goes to TradeMasterSavis for providing the original code
- //MENU/////////////
- ShowMarketSessions = input(true, title='Show Market Sessions')
- //Market Sessions
- MarketSessionsSettings = input.string(title='Market Sessions Settings', defval='ON', options=['ON'])
- ForexORCrypto = input.string(title='Forex, Crypto, OR Custom Market', defval='Forex', options=['Forex', 'Crypto', 'Custom Market'])
- Forex = input.string(title='Forex Settings', defval='ON', options=['ON'])
- /////FOREX/////
- //Inputs
- Ft1 = input.session(title='Forex Sydney Session (xxxx-xxxx to define a interval):', defval='1700-2000:1234567', confirm=false)
- Ft2 = input.session(title='Forex Tokyo Session (xxxx-xxxx to define a interval):', defval='2000-0300:1234567', confirm=false)
- Ft3 = input.session(title='Forex London Session (xxxx-xxxx to define a interval):', defval='0300-0800:1234567', confirm=false)
- Ft4 = input.session(title='Forex New York Session (xxxx-xxxx to define a interval):', defval='0800-1400:1234567', confirm=false)
- Ft5 = input.session(title='NO TRADE ZONE (xxxx-xxxx to define a interval):', defval='1400-1700:1234567', confirm=false)
- //CryptoSessions
- ForexSession1 = ForexORCrypto == 'Forex' ? not na(time('1', Ft1)) : true
- ForexSession2 = ForexORCrypto == 'Forex' ? not na(time('1', Ft2)) : true
- ForexSession3 = ForexORCrypto == 'Forex' ? not na(time('1', Ft3)) : true
- ForexSession4 = ForexORCrypto == 'Forex' ? not na(time('1', Ft4)) : true
- ForexSession5 = ForexORCrypto == 'Forex' ? not na(time('1', Ft5)) : true
- //Plot BGColor
- bgcolor(ShowMarketSessions and ForexSession1 and ForexORCrypto == 'Forex' ? color.red : na, title='Forex Sydney Session', transp=75)
- bgcolor(ShowMarketSessions and ForexSession2 and ForexORCrypto == 'Forex' ? color.orange : na, title='Forex Tokyo Session', transp=75)
- bgcolor(ShowMarketSessions and ForexSession3 and ForexORCrypto == 'Forex' ? color.yellow : na, title='Forex London Session', transp=75)
- bgcolor(ShowMarketSessions and ForexSession4 and ForexORCrypto == 'Forex' ? color.green : na, title='Forex New York Session', transp=75)
- bgcolor(ShowMarketSessions and ForexSession5 and ForexORCrypto == 'Forex' ? #000000 : na, title='NO TRADE ZONE', transp=0)
- Crypto = input.string(title='Crypto Settings', defval='ON', options=['ON'])
- /////CRYPTO/////
- //Inputs
- Ct1 = input.session(title='Crypto Sydney Session (xxxx-xxxx to define a interval):', defval='2100-0000:1234567', confirm=false)
- Ct2 = input.session(title='Crypto Tokyo Session (xxxx-xxxx to define a interval):', defval='0000-0800:1234567', confirm=false)
- Ct3 = input.session(title='Crypto London Session (xxxx-xxxx to define a interval):', defval='0800-1200:1234567', confirm=false)
- Ct4 = input.session(title='Crypto New York Session (xxxx-xxxx to define a interval):', defval='1200-1800:1234567', confirm=false)
- Ct5 = input.session(title='NO TRADE ZONE (xxxx-xxxx to define a interval):', defval='1800-2100:1234567', confirm=false)
- //CryptoSessions
- CryptoSession1 = ForexORCrypto == 'Crypto' ? not na(time('1', Ct1)) : true
- CryptoSession2 = ForexORCrypto == 'Crypto' ? not na(time('1', Ct2)) : true
- CryptoSession3 = ForexORCrypto == 'Crypto' ? not na(time('1', Ct3)) : true
- CryptoSession4 = ForexORCrypto == 'Crypto' ? not na(time('1', Ct4)) : true
- CryptoSession5 = ForexORCrypto == 'Crypto' ? not na(time('1', Ct5)) : true
- //Plot BGColor
- bgcolor(ShowMarketSessions and CryptoSession1 and ForexORCrypto == 'Crypto' ? color.red : na, title='Crypto Sydney Session', transp=75)
- bgcolor(ShowMarketSessions and CryptoSession2 and ForexORCrypto == 'Crypto' ? color.orange : na, title='Crypto Tokyo Session', transp=75)
- bgcolor(ShowMarketSessions and CryptoSession3 and ForexORCrypto == 'Crypto' ? color.yellow : na, title='Crypto London Session', transp=75)
- bgcolor(ShowMarketSessions and CryptoSession4 and ForexORCrypto == 'Crypto' ? color.green : na, title='Crypto New York Session', transp=75)
- bgcolor(ShowMarketSessions and CryptoSession5 and ForexORCrypto == 'Crypto' ? #000000 : na, title='NO TRADE ZONE', transp=0)
- CustomMarket = input.string(title='Custom Settings', defval='ON', options=['ON'])
- /////CRYPTO/////
- //Inputs
- CSt1 = input.session(title='Custom Market Session 1 (xxxx-xxxx to define a interval):', defval='0100-0500:1234567', confirm=false)
- CSt2 = input.session(title='Custom Market Session 2 (xxxx-xxxx to define a interval):', defval='0500-1200:1234567', confirm=false)
- CSt3 = input.session(title='Custom Market Session 3 (xxxx-xxxx to define a interval):', defval='1200-1600:1234567', confirm=false)
- CSt4 = input.session(title='Custom Market Session 4 (xxxx-xxxx to define a interval):', defval='1600-2200:1234567', confirm=false)
- CSt5 = input.session(title='NO TRADE ZONE (xxxx-xxxx to define a interval):', defval='2200-0100:1234567', confirm=false)
- //CryptoSessions
- CustomMarketSession1 = ForexORCrypto == 'Custom Market' ? not na(time('1', CSt1)) : true
- CustomMarketSession2 = ForexORCrypto == 'Custom Market' ? not na(time('1', CSt2)) : true
- CustomMarketSession3 = ForexORCrypto == 'Custom Market' ? not na(time('1', CSt3)) : true
- CustomMarketSession4 = ForexORCrypto == 'Custom Market' ? not na(time('1', CSt4)) : true
- CustomMarketSession5 = ForexORCrypto == 'Custom Market' ? not na(time('1', CSt5)) : true
- //Plot BGColor
- bgcolor(ShowMarketSessions and CustomMarketSession1 and ForexORCrypto == 'Custom Market' ? color.red : na, title='Custom Market Session 1', transp=75)
- bgcolor(ShowMarketSessions and CustomMarketSession2 and ForexORCrypto == 'Custom Market' ? color.orange : na, title='Custom Market Session 2', transp=75)
- bgcolor(ShowMarketSessions and CustomMarketSession3 and ForexORCrypto == 'Custom Market' ? color.yellow : na, title='Custom Market Session 3', transp=75)
- bgcolor(ShowMarketSessions and CustomMarketSession4 and ForexORCrypto == 'Custom Market' ? color.green : na, title='Custom Market Session 4', transp=75)
- bgcolor(ShowMarketSessions and CustomMarketSession5 and ForexORCrypto == 'Custom Market' ? #000000 : na, title='NO TRADE ZONE', transp=0)
Advertisement
Add Comment
Please, Sign In to add comment