Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=3
- study(title="CD ~ Bitmex Funding Influence Periods", shorttitle="CD ~ Mex Time", overlay=true)
- //checkboxes
- iMove1 = input(title="Build up period 1", type=bool, defval=true)
- iBuy1 = input(title="Buy window 1", type=bool, defval=true)
- iSell1 = input(title="Take profit period 1", type=bool, defval=true)
- iMove2 = input(title="Build up period 2", type=bool, defval=true)
- iBuy2 = input(title="Buy window 2", type=bool, defval=true)
- iSell2 = input(title="Take profit period 2", type=bool, defval=true)
- iMove3 = input(title="Build up period 3", type=bool, defval=true)
- iBuy3 = input(title="Buy window 3", type=bool, defval=true)
- iSell3 = input(title="Take profit period 3", type=bool, defval=true)
- iUse1 = input(title="Extra 1", type=bool, defval=false)
- iUse2 = input(title="Extra 2", type=bool, defval=false)
- iUse3 = input(title="Extra 3", type=bool, defval=false)
- //Session choice
- Sess1 = input(title="Build up period 1", type=string, defval="0244-0400:1234567")
- Sess2 = input(title="Buy window 1", type=string, defval="0400-0401:1234567")
- Sess3 = input(title="Take Profit period 1", type=string, defval="0401-0414:1234567")
- Sess4 = input(title="Build up period 2", type=string, defval="1044-1200:1234567")
- Sess5 = input(title="Buy window 2", type=string, defval="1200-1201:1234567")
- Sess6 = input(title="Take Profit period 2", type=string, defval="1201-1214:1234567")
- Sess7 = input(title="Build up period 3", type=string, defval="1844-2000:1234567")
- Sess8 = input(title="Buy window 3", type=string, defval="2000-2001:1234567")
- Sess9 = input(title="Take Profit period 3", type=string, defval="2001-2014:1234567")
- Sess10 = input(title="Extra 1", type=string, defval="0000-0001:1234567")
- Sess11 = input(title="Extra 2", type=string, defval="0000-0001:1234567")
- Sess12 = input(title="Extra 3", type=string, defval="0000-0001:1234567")
- // **** Logic
- sessToUse1 =iMove1 == 1 ? Sess1 : '0800-1530:2'
- sessToUse2 = iBuy1 == 1 ? Sess2 : '0800-1530:3'
- sessToUse3 = iSell1 == 1 ? Sess3 : '0800-1530:4'
- sessToUse4 = iMove2 == 1 ? Sess4 : '0800-1530:5'
- sessToUse5 = iBuy2 == 1 ? Sess5 : '0800-1530:6'
- sessToUse6 = iSell2 == 1 ? Sess6 : '0800-1530:7'
- sessToUse7 = iMove3 == 1 ? Sess7 : '0800-1530:1'
- sessToUse8 = iBuy3 == 1 ? Sess8 : '0800-1530:3'
- sessToUse9 = iSell3 == 1 ? Sess9 : '0800-1530:4'
- sessToUse10 = iUse1 == 1 ? Sess10 : '0800-1530:5'
- sessToUse11 = iUse2 == 1 ? Sess11 : '0800-1530:6'
- sessToUse12 = iUse3 == 1 ? Sess12 : '0800-1530:7'
- // *** Apply custom rules
- bgPlot1 = (iMove1 == 0 ? time(period) : time(period, sessToUse1))
- bgPlot2 = (iBuy1 == 0 ? time(period) : time(period, sessToUse2))
- bgPlot3 = (iSell1 == 0 ? time(period) : time(period, sessToUse3))
- bgPlot4 = (iMove2 == 0 ? time(period) : time(period, sessToUse4))
- bgPlot5 = (iBuy2 == 0 ? time(period) : time(period, sessToUse5))
- bgPlot6 = (iSell2 == 0 ? time(period) : time(period, sessToUse6))
- bgPlot7 = (iMove3 == 0 ? time(period) : time(period, sessToUse7))
- bgPlot8 = (iBuy3 == 0 ? time(period) : time(period, sessToUse8))
- bgPlot9 = (iSell3 == 0 ? time(period) : time(period, sessToUse9))
- bgPlot10 = (iUse1 == 0 ? time(period) : time(period, sessToUse10))
- bgPlot11 = (iUse2 == 0 ? time(period) : time(period, sessToUse11))
- bgPlot12 = (iUse3 == 0 ? time(period) : time(period, sessToUse12))
- // Set the background colour
- bgcolor(iMove1 and bgPlot1 > 0 ? #0F1626 : na, transp=80)
- bgcolor(iBuy1 and bgPlot2 > 0 ? #33FFAF : na, transp=40)
- bgcolor(iSell1 and bgPlot3 > 0 ? #FF533D : na, transp=90)
- bgcolor(iMove2 and bgPlot4 > 0 ? #0F1626 : na, transp=80)
- bgcolor(iBuy2 and bgPlot5 > 0 ? #33FFAF : na, transp=40)
- bgcolor(iSell2 and bgPlot6 > 0 ? #FF533D : na, transp=90)
- bgcolor(iMove3 and bgPlot7 > 0 ? #0F1626 : na, transp=80)
- bgcolor(iBuy3 and bgPlot8 > 0 ? #33FFAF : na, transp=40)
- bgcolor(iSell3 and bgPlot9 > 0 ? #FF533D : na, transp=90)
- bgcolor(iUse1 and bgPlot10 > 0 ? gray : na, transp=0)
- bgcolor(iUse2 and bgPlot11 > 0 ? gray : na, transp=0)
- bgcolor(iUse3 and bgPlot12 > 0 ? gray : na, transp=0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement