Need Pine Script code to calculate the last two times a condition was met, get the Lows and color the bars on the chart with different colors - pine-script-v5

I need help with the following syntax for Pinescript v5.
Find the last two times a condition was met
Get the lows for those bars
Color the bars for those two bars on the chart with two different colors.

Related

Measure distance between two columns in echarts

I am using echarts for my graph and I have a requirement for displaying 25th quartile, median, average, 50 and 75 quartiles like below.
While it works in most cases, My problem is the line labels collide in cases where there is no sufficient distance between two lines hence the reason why I display the median label on top of average above. Currently I determine this by the number of columns between consecutive lines, while this work, it doesn't in a situation where the number of columns are many and still the distance between two lines is not sufficient for the labels. I am wondering is there is way to measure the px distance between two columns in echarts ? For example column A --> B has the width of 18px . Any help will be appreciated.

Color the background based on value

I have collected multiple time series for evaluation and further use in MATLAB.
I am aware there are ways to change the color of a plot based on its value.
But in my case I would like to change the background color of a plot based on one data series and have other plots in front.
Maybe the words don't explain it too well, so I tried to make a clear example:
In this plot, the background was colored according to data series 1, in the foreground data series 2 is plotted as a line plot in blue.
Is there a way to achieve this using MATLAB?

Matplotlib - align centre monthly width barchart without overlap

I'm plotting two sets of monthly values on one figure, one in line format, the other in bars.
I want to bars to be one month wide so that there are no gaps between them, and the ticks, points, and bars to all be centred. I can do this, but the bars then overlap slightly due to the differing lengths of the months (largest difference obviously seen in Feb-Mar)
Is there some sort of hack to get around this?
Thanks!

Tableau Control Chart - Attribute measure incorrect

All
I have a control chart, with on the X-axis a time period, and the Y-axis the value of the measure (I'd like to plot all the points in a control chart).
However, I have 2 different values as a measure, which have the exact same date (up to a second match) but different measure values.
When I plot this on a control chart, instead of having 2 points in the control chart with value 500 and 550 for example - it gives me one point with a value of about 200.
It also gives a notification that there is a NULL value in this axis, which points to the X-axis where 2 records have the exact same date.
Any idea what I can do to make this correct - or make tableau draw the measure points correctly?
Thanks in advance!
It's difficult to answer without seeing more detail about your problem, but this sounds like a good candidate for a blended axis. (multiple measures sharing a single axis)
The easiest way to do this is to put your (probably continuous) datetime field on the row axis and one of your measures on the row axis to see one of then control plots. Then drag the second measure to the Y-axis until you see a little translucent two bar icon to indicate that you are adding a second measure to that axis, at which point you can release the pointer and you should see a two plots on the same axis.
If the scales for the two measures are radically different, you can instead drag the second measure to the right side instead to get a dual axis.

Bar graph x-axis titles do not work with many bars

I'm using MATLAB and I want a bar plot.
I plotted the bars, and then give titles to the bars.
If I only using 10 bars it works (see pic1).
But often I need more, mostly 32 bars (see pic2).
In this case the titles are not under the bars. I found out that MATLAB don't overlap the titles. The max value is 15 bars.
Does anyone knows how I can get MATLAB to overlap the titles?
Here is my code for plotting the bars:
y = absSlopes(1, 1:size(absSlopes,2));
hb = bar(y);
set(gca,'XTickLabel',titles);
rotateXLabels(gca, 45);
ylabel('Anzahl');
absSlopes is a matrix and I use the complete first line.
You may want to try XTick in addition to XTickLabel. At least for regular plots you can enforce specific spacings through this setting.
You can do this by an additional setup-command:
set(gca,'XTickLabel',titles);
set(gca,'XTick',absSlopes(1,:));
Of course, you can set both properties in the same line, but I like to keep it simple in case you want to deactiviate/comment one or the other setting later on.