Show Minutes as Intervals on the horizontal scale in TradingView Lightweight - ios

is it possible to show minutes instead of a day in the lightweight chart? in swift the CandlestickData accepts time in timestamps, however it only displays the day
thank you
the CandlestickData accepts time in timestamps, however it only displays the day

Lightweight charts will show a bar for every data point that you supply, it doesn't matter if it is at a day resolution (interval) or at a minute interval or anything else.
If you give it 100 bars then it will show 100 bars.
With regards to the time scale. You can set options to change how the timestamp is displayed. See the options here: https://tradingview.github.io/lightweight-charts/docs/api/interfaces/TimeScaleOptions
You are probably interested in this property:
https://tradingview.github.io/lightweight-charts/docs/api/interfaces/TimeScaleOptions#timevisible
you can set this options within the createChart options or via the applyOptions api method. Similar guide here: https://tradingview.github.io/lightweight-charts/tutorials/customization/chart-colors#applying-options

Related

How to look back a certain number of days for an indicator and how to only calculate logic upto the last complete bar (i.e. not the current bar)

I'm relatively new to Pine and was having trouble with a couple of things.
So I've got a indicator that I want to look back for the last 5 full days of activity, however not each stock trades in the premarket/afterhours so I want to be able to look back say 5 days and then calculate the number of bars on the time frame (i.e. for a 5 min or hourly resolution). That way I can calculate the number of bars present on the current ticker for that time frame and adjust my indicator length (instead of just having a constant figure of 80 bars or whatever).
The second thing I want to do is only have the indicator update on the completion of a full bar (for example the hourly resolution). So I want it to only calculate up to x-1 bars. Right now I'm finding that it's updating on each new tick. ( I was able to figure this one out, just changed it from i= 0 to length -1 to i=1 to length).
Any help is greatly appreciated.
Thanks,
A

MQL4 max bars in chart

I'm trying to limit resources consumed by MT4 and go to options to set max bars in chart to something smaller like 500. My custom indicator calculates values from a 10 and 20 EMA.
Now the indicator does not even want to attach to the chart!
Even if I increase the number I cannot get my CI to attach to the chart again.
Please can you let me know what the minimum number should be for max bars in chart and why a simple CI as set out above will not attach to the chart?
Lastly, could you please help me also by stating what the default value for max bars in chart normally is? I thought it is 999999 but cannot remember.
Thanks so much for your effort.
In order to use your resources efficiently, ask your indicator to compute only last bars, prev_calculated should be used and go only since that value to the end of the chart(to the current bar). You can also make your indicator sleeping if number of bars is same, and let it run only when new bar appears (rates_total>prev_calculated) if that can be accepted for your task

Controlling shown y-axis labels?

So I am using the Charts framework (formerly ios-charts) for a couple of charts.
One of them in a bar chart where the y-axis is duration in seconds - that I then convert into readable minute:second notation with a formatter.
But the selected interval of labels bugs me a little. I would like to control them so they are only shown at intervals that makes sense for this - like say every half or full minute. But I can't seem to find a way to do that for that axis. Only the x-axis seems to have options for that?
So am I missing something here? Or it is not in the framework?
Whoops. Never mind. I found the 'granularity' property on the axis right after asking. And it seems to do what I need.

Changing the viewport to only show certain intevals of ios-charts linechart

I'm using the ios-charts library and I have a LineChart View that has x values that are dates from every weekday of this year. On the y-axis I have values between 0 and 25.
I would like to zoom in on different intervals on the LineChart View.
For example only show Data for week X one time and later change to show data for three months, etc etc.
I did not find anything in the documentation on how to do this. I used the "zoom" function with out any success.
(Example : Zoom and show the last 20 days on the x axis or zoom and show the last three months)
Has someone does this before?
It's a tough question and very advanced control. I guess you need to read carefully about the code, focusing on moveViewToX, and the logic and functions in ChartTransformer. Combining some tricks and calculations, you may find a way to fine-grainedly controll what you want to display.
Also, there is a property:
/// the maximum number of entried to which values will be drawn
internal var _maxVisibleValueCount = 100
may also help you.

Correlate time series with Graphite

Does Graphite have a way to visualize correlation between two time series?
I would want somehting like this:
In this SlideShare presentation there's a mention of a correlate data transform function (slide 11) however I can't find documentation about it.
The trick to displaying events in Graphite is to apply the drawAsInfinite() function on the red metric. This displays events as a vertical line at the time of the event.
Update-
Perhaps you mean timeShift().
"..what if we want to directly correlate the activity between now and
the same time two weeks ago? This is where the timeShift() function
comes in. Let's take a look at the same 4-week period, but this time
we'll review two weeks of current data and overlay it with a
time-shifted span of the two weeks prior."
Source.
To answer my own question: it is not possible and would not fit Graphite's vision.
From their GitHub issue tracker:
If the X axis isn't time then it isn't a time series... Graphite is a graphing tool for time series data.
Divide one by the other. The straighter that line is, the more related they are. If that correlation is linear of course. Could be logarithmic or anything. But in these cases, your two axis example wouldn’t work either.

Resources