RicardoSantos

[RS]DRWnine hardcoded dataset V1

109 0 7
Request for DRWnine: method for ploting hardcoded data.
Remove from Favorite Scripts Add to Favorite Scripts
study("[RS]DRWnine hardcoded dataset V1", overlay=true)

//  ||-->   Time Window to phase time/offset:
PhaseTime = input(0)//days

//  ||-->   Unix Timestamp constants:
_minute = 60 * 1000         //  Miliseconds in 1 Minute.
_hour = 60 * _minute        //  Minutes in 1 Hour.
_day = 24 * _hour           //  Hours in 1 Day.
//  ||-->   Time fix: in my case gmt+0 is +12 hours
_Time_Fix = input(12)*_hour
//  ||-->   Miliseconds since 1970-01-01 00:00:00.000 to: 2015-01-01 00:00:00.000 :
_Base_Year = 1420070400000.000
//  ||-->   Function to check if phased time is within time frame.
isDayWithin(_UT, _D)=>_UT+(PhaseTime*_day)+_Time_Fix >= (_Base_Year + (_D * _day)) and _UT+(PhaseTime*_day)+_Time_Fix < (_Base_Year + ((_D + 1) * _day))
//  ||-->   Data Structure:
getUValue(_UNIXTIME)=>
    _return = 
        //  ||-->  UNIXTIME CODE   <--||
        //  ||-->   Formating: 
        //  ||-->   time since january 1st 1970 ||
        //  ||-->   1234567890123
        //  ||  Start of time window    ||  End of Time Window  ||  Value   ||
        //_UNIXTIME >= 1429900000000 and _UNIXTIME < 1429910000000 ? 2015.01 :
        isDayWithin(_UNIXTIME, 0) ? 2014.000 :
        isDayWithin(_UNIXTIME, 1) ? 2001.001 :
        isDayWithin(_UNIXTIME, 2) ? 2001.002 :
        isDayWithin(_UNIXTIME, 3) ? 2001.003 :
        isDayWithin(_UNIXTIME, 4) ? 2001.004 :
        isDayWithin(_UNIXTIME, 100) ? 2015.100 :
        isDayWithin(_UNIXTIME, 101) ? 2015.101 :
        isDayWithin(_UNIXTIME, 102) ? 2015.102 :
        isDayWithin(_UNIXTIME, 103) ? 2015.103 :
        isDayWithin(_UNIXTIME, 104) ? 2015.104 :
        isDayWithin(_UNIXTIME, 105) ? 2015.105 :
        isDayWithin(_UNIXTIME, 106) ? 2015.106 :
        isDayWithin(_UNIXTIME, 107) ? 2015.107 :
        isDayWithin(_UNIXTIME, 108) ? 2015.108 :
        isDayWithin(_UNIXTIME, 109) ? 2015.109 :
        isDayWithin(_UNIXTIME, 110) ? 2015.110 :
        isDayWithin(_UNIXTIME, 111) ? 2015.111 :
        isDayWithin(_UNIXTIME, 112) ? 2015.112 :
        isDayWithin(_UNIXTIME, 113) ? 2015.113 :
        isDayWithin(_UNIXTIME, 114) ? 2015.114 :
        isDayWithin(_UNIXTIME, 115) ? 2015.115 :
        isDayWithin(_UNIXTIME, 116) ? 2015.116 :
        isDayWithin(_UNIXTIME, 117) ? 2015.117 :
        isDayWithin(_UNIXTIME, 118) ? 2015.118 :
        isDayWithin(_UNIXTIME, 119) ? 2015.119 :
        isDayWithin(_UNIXTIME, 120) ? 2015.120 :
        isDayWithin(_UNIXTIME, 125) ? 2015.125 :
        isDayWithin(_UNIXTIME, 130) ? 2015.130 :
        isDayWithin(_UNIXTIME, 135) ? 2015.135 :
        isDayWithin(_UNIXTIME, 140) ? 2015.140 :
        na
    _return

plot(getUValue(time), style=line, color=black, linewidth=2, offset=PhaseTime)

//  Notes:
//  2010 == 1262304000000
//  2015 == 1420070400000
English
English (UK)
English (IN)
Deutsch
Français
Español
Italiano
Polski
Türkçe
Русский
Português
Bahasa Indonesia
Bahasa Melayu
ภาษาไทย
Tiếng Việt
日本語
한국어
简体中文
繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out