♥ 0 |
I put in GetTime() & get a 13 -digit #. I want to convert it to something like 11:05 AM, Monday, Jan 9, 2018. How do I do that? I do not want to re-invent the wheel. I get it. It is milliseconds form some time in 1970. Basically, trying to do something like this def CurTime=GetTime();If CurTime> 9 PM each day and CurTime < 9PM each day + 11 hours or 8AM the next morning, then AssignBackgroundColor(Color.Gray) ; So if anyone can give me a hint on a function that converts or some script lines that do that for me,then I can get going. Basically, just adding Gray Transluscent Background to the times I am asleep on my chart study.
RESOLVED
Marked as spam
|
Private answer
So what you want is to shade the background color of the chart based on a start time and end time. I think the best way to show this in action is to take a look at this video and examine the code provided with it: “Thinkorswim Overnight Range Scan Alert“ There are two inputs at the very top of the code, alertPeriodStart and alertPeriodEnd. We use those inputs to create a start counter and end counter:
Then we combine those two into a single true/false variable that defines the alert period:
Then we use that alertPeriod within our AddCloud() function:
Notice this AddCloud() function also contains another variable named “okToPlot”. That’s actually one of the inputs we provide that allows the user to turn the shaded background on and off. Marked as spam
|
Please log in to post questions.
You don’t have the ability to create new categories. That is my job as the moderator. I scan each and every question and often move them to a more appropriate category when needed. For example I have moved this question into the “Chart Studies” category.
Thanks, I do not know where I would be w/o you. ThinkScript Support is 10 days getting back on email, and often tries to avoid answering questions. I wish I could give you more and intend to do so as this knowledge pays for itself. There is so much to TOS to learn. For other newbies, I came up with this code for my application which actually works.
# Time Section_______________________________________________________________
input DayTimeStart=1100; # 8AM PST
input NightTimeEnd=2359; # EST in 2400 -24 hr Clock time. 9PM PST
def CountfromStart=SecondsfromTime(DayTimeStart);
def CounttilEnd= Secondstilltime(NightTimeEnd);
def dayperiod=If(CountfromStart >0 && CounttilEnd >0,1,-1); # then 1 else 0;
#def sleepperiod= If((CountfromStart
Excellent. Very glad you are able to find the resources you need here. Sorry to hear about lack of support from TD Ameritrade. The code you posted above is nearly identical to the code I posted in my answer on Jan 7th. Thanks for all your support.