♥ 0 |
I’m looking to alter this code to start the plot at 9:30 and have it end at 9:45, only showing the last period. The first photo is what the code produces now, the second is what I’m trying to get it to look like. TIA! input timeFrame = AggregationPeriod.DAY; def StartTime = 0930; plot Lower = open(period = timeFrame) * ((prctLower / 100) + 1); plot Upper = open(period = timeFrame) * ((prctUpper / 100) + 1) ; declare hide_on_daily;
Marked as spam
|
Private answer
For this solution I will borrow some code from our video titled: “Thinkorswim Overnight Range Scan Alert“. In the code provided with that video we have the elements that control the yellow shaded area known as the “alert zone”. It uses a start and end time to determine the extent of the alert zone. From the code you provided I see that you have added variables to contain a start and end time but you have not used them to connect to anything. So I will be providing the missing pieces, to connect the start and end time in your existing code to the plots. I will also provide a line of code to connect your user input, It takes three lines of code to connect your start and end times to a true/false variable named
This takes care of the requirement to plot only between the start and end time. We still need to connect your user input,
Now we only need to modify your plot statements to include an if/then/else statement, which uses the true/false variables named
If If user input Screenshot below shows the result. Marked as spam
|
Please log in to post questions.
Great! Thank you Pete.