How can I request higher timeframe trendlines to show on lower timeframes via pinescript? [SOLVED] - pine-script-v5

With some assistance, I have been able to successfully get trendlines to draw broadening formations off outside bars up to 100 candles. I have been able to get color input enabled as well as get the trend lines to go to the lowest/highest previous candle or furthest previous candle, as long as it is within the outside bar.
My question is... How can I get my script to pull the broadening formations from a higher timeframe (weekly, monthly, year) and show them on a smaller timeframe? (Daily, 4 hr, 1 hr, etc)?
I understand there needs to be a security function but I am unsure how to add that into the code. I'm scratching my head on this one and would appreciate some assistance please. Thank you.
:Solved:

Calculate the high and low with request.security
And check that it does not repaint
Something like that:
i_htf = input.timeframe ('', 'Select Higher Timeframe')
highHft = request.security(syminfo.tickerid, i_htf,
high[1],
lookahead = barmerge.lookahead_on) //No repaint

Related

Back syncfusion chart drawing when scrolling

Good day. Faced the problem with the back drawing of the graph using syncfusion_flutter_charts (if necessary). If I need to build the values ​​in front, then there is no problem:
chartSeriesController?.updateDataSource(addedIndexes: [...]);
But how to do it behind? The point is that my data is a date:value pair (x: date, y: value). And I display only the latest data, for example 7 days, 30 days. But if the user wants to see the previous results, then he need to scroll to the left and be able to see the previous days and their values ​​with the same detail (7, 30 days). As far as I understand, I'm satisfied with two solutions, displaying all the data at once, but from a certain index and the number of days at a time with the ability to scroll left and right, and gradual rendering, for instance the user will move with +1 & -1 value. It is also important that the detailing of the chart is chosen not by movements on the chart, but in the menu (I have it implemented). Thanks for your suggestions.

Tableau add trend line to discrete data?

I have run into this more times then I like, and I think it will continuously haunt me. I am creating reports/dashboards that report monthly or yearly or weekly data. The dates come in with just the last day of the period. For example, now I am working 2019 monthly report that is a bar chart with a trend line. Took me about 15 minutes to make in excel. However, we are trying to move everything into Tableau for dashboards. Trend line is always grayed out when using discrete dates and sometimes when using continuous dates. The dates are in the format DD/MM/YYYY so I can convert them as continuous but that skews the spacing on the X-Axis. I have messed around to get it to work but it takes time. I am shocked that this very basic thing does not work when Excel has been able to do it for a very long time. Does anyone know of a good work around? I have tried calculated the trend line myself, but do not see how I can add in the y=mx+B line that is generated. I am debating creating a data set just for this, but that seems long and hard way for something that I would have expected out of the box. Below is some basic data, in Excel it takes about 1 minutes to create a line chart, click (+) add trend line and your done.
I was not able to deal with the skew of the X-Axis very well but playing with the date it started and setting the major tick marks to monthly got me close. Looking at the picture below you will see the tick marks are not in the center of the bars but close. As for the trend line, I added a Dual axis on the same data that was the sum of all shown fields with no division by the parts (this is a stack mark bar chart). Since this is a basic line chart with continuous dates, a trend line is a simple click. I then removed the Tick Markets and set the opacity to 0% making the line invisible. I did not change the trend line so now that is all you can see. Seems like a long and hard way to do it, but it works. (UPDATE) Better fix, NEVER USE EOM always use First of Month.

I want to create a speedometer style for my dashboard indicating the average response time for the month

How to plot a speedometer style graph in tableau that shows the average response time for the month.
For example, for bed tracking data, the response time meas a person that takes time to respond to the bed clean. SO I have the data for the whole month and what I need to do is to create a speedometer style indicating the average response time.
I would recommend you use a Bullet chart instead as the 'speedo' chart is not ideal, as it can be misleading.
That said, if you are determined and this is your only graph then have a look at this site
https://public.tableau.com/profile/adam.e.mccann#!/vizhome/Data16JediChartPresentation_Desktop3/SessionIntro
and view the Adam E McCann presentation from the "Gauge 4 How to" slide onwards
There is maths involved in doing this chart, but it is straight forward and quite satisfying to make Tableau do something that you truly created.
Good Luck.

Using the Overlay feature in panel but showing only an averaged line

I have created an overlay of 100 curves. I thought the image looked impressive but one of my reviewers stated that I should only show the averaged line. Meaning, only show a line that is the average of the 100 curves. Is this possible using the xtline feature, or do I need to get deeper into programming code to produce the graphic? Alternatively, it would be great if I could show both (the 100 curves and the averaged curve) in the same graphic.
You don't need anything complicated here. Just calculate the mean across the panel and show it directly. Here is some technique. I am guessing that in your real example with 100 curves a legend is pointless. Note the c(L) and read the help to find what it does.
webuse grunfeld, clear
set scheme s1color
gen log_invest = log(invest)
egen mean_log_invest = mean(log_invest), by(year)
line log_invest year, legend(off) lc(gs12) c(L) || line mean_log_invest year, c(L) scheme(s1color) ytitle(something sensible)

Swift Linechart for timeline

I am planning to do a linechart, which should represent price changes based on a week, a month and so on. Therefore, I use the cocoapod "Charts" (github.com/danielgindi/Charts).
I always have the price changes for a certain point in time. I am wondering now how I could create the chart, that the x-line is showing the values according to the accurate time - and not the same distance for each value, even when two values are on the same day, and the next one 3 days after.
At the moment, it looks like this:
This should then help to insert a marker, where the user can move through the days/months, and see what the price was for each point in time.
Does anybody of you has an idea? I thought about adding values for each half hour to the dataset, with dummy values, to receive the same result, but this doesn't seem like a perfect solution..
Thanks a lot,
Alex