convert series to fix value pine script - series

How I can get a special value in series to Fix value
//#version=4
study("My Script", overlay = true)
float lastclose = close[1]
// I want get close last bar (11.00 am 9/5/2021) = 1.21632(EURUSD) , I don't want lastclose is series
plot(lastclose)
// I want this plot
plot(1.21632)
You can see in my picture , Red line is that I want.
https://www.tradingview.com/x/DK0Fsdpj/
enter image description here

If it's just about the plot.
plot(close, color=color.red, linewidth=4, show_last=1, trackprice=true)
This hides the plot and uses a horizontal dotted line to track the level. You could subsitute close[1] or similar if you wanted an older close price. If you don't want a dotted line, use line.new() and the other line functions to manage and update a line drawing, with extend set to both.

Related

SSRS Bar Chart Conditional Formating

I am trying to conditional format a bar in my Bar Chart.
I am comparing Planned Time VS Actual time and I want to set a conditional format to display different colors IF Actual is less than or Equal to Planned then show me RED else GREEN.
I am unable to find a way to do this. Please Help!
I tried SWITCH and IIF functions but nothing happens. Same of my code attached.
=iif(Fields!ActualDuration.Value <= Fields!PlannedDuration.Value, "Light Coral", "Dark Sea Green")
I expect the bars to change color according to my criteria.
Because your chart sums the values, your expression for the Series Fill property also needs to use SUM:
=iif(SUM(Fields!ActualDuration.Value) <= SUM(Fields!PlannedDuration.Value), "Light Coral", "Dark Sea Green")

SSRS line chart

I have one question to the line chart.
I would like to create a line chart, which values are given. It should look like this chart here:
My question is, how can I implement this. I tried to put it as a stripline in the chart but it only shows a horizontal line without this steps at the beginning.
How can I create this line chart like in the picture above?
can I put into this:
the values.
Striplines are intended to display just a line across the chart, or varying width, height, to demonstrate an area... from MSDN
Strip lines, or strips, are horizontal or vertical ranges that shade the background of the chart in regular or custom intervals
To get the behaviour (I think) you require you can add a new series to the data you are returning with each of those datapoints. Irrespective of what other data you are charting, you can change the type of this series to Line Chart, and change the order of the series on teh chart to make it uppoermost.
Without further information - such as the data you are tyrying to superimpose this on - it's hard to advise further.

Is it posible to get the position of point on an excel graph axis

I'm not sure this is possible but thought this was the best place to ask.
Is it posible to get the position of a series value on a graph in excel?
For example, if I have a line graph in excel that has time along the x axis, is it possible to (using VBA) get the position of a specific point on that axis.
What I am trying to do is have a vertical line that is can be positioned based on a date entered by the user.
like this
Where the green line could be positioned by entering in a date (rather than just being manually moved) (or also it could be set to automatically move to the current date etc).
I was then thinking that if the position is on the graph is queryable, then I can just access the line object and move it to any position I wanted through VBA.
Any Ideas? or is this just not possible?
The "cleanest" way to do this is to add the line to the chart as a new series. In that way, Excel handles all of the positioning and your work is simplified. To get a vertical line on a chart, there are a number of options. I prefer this route:
Create a small 2x2 area with two dates and two values
Add in the date or x-axis value you want the line at (E3 in image). You can use =TODAY() here or some manually entered value.
Set the second x-axis value equal to the first
Use MAX and MIN on the data to get the values for each date. You can also use 0 and 1 and a secondary axis, but I think MAX/MIN is easier.
Add the data to the chart and format as a marker with straight line.
Formulas
E3: =TODAY()
E4: =E3
F3: =MIN(C3:C27)
F4: =MAX(C3:C27)
Result and chart data series for vertical line

How to cut out numbers from an image dynamically?

i've got to this stage:
where i can find the numbers in the above image but i need to cut them out so i can retain the order etc. but the as the number increases the spacing changes and the position of the number?
so i think it should be a find a white PX the continue until it find a solid black col and then use the points to do a simple cut any help would be great.
A simple solution would be this:
Find the first upmost horizontal line which contains white pixels
From that line find the first horizontal line which contains only black pixels
Those two lines are your upper and lower borders.
Between this borders proceed like this:
Find the first most left vertical line which contains white pixels
From that line find the last vertical line which contains only black pixels and which comes directly after a line with white pixels.
Those two lines are your left and right borders.
The steps to separate single numbers can be performed analogously.
If you need to identify which numbers are in your picture, I recommend using specialized computer vision libraries.
Some VB.net pseudo code to get you going:
Sub FindTopBorder(image As MyImage) As Integer
For y = 0 to image.Height - 1
For x = 0 to image.Width - 1
Dim pixel = image.GetPixel(x, y)
If ('Check if pixel is white here with RGB or Color') Then
Return y
End If
Next
Next
' Just in case there are no white pixels or use an exception instead
Return -1
End Sub
I would start looking into Connected component segmentation. You find a pixel which is within a character (number). Then run the connected component algorithm which finds all connected pixels under specific set of rules (e.g. slight deviation in color, stop at hard borders etc).
http://en.wikipedia.org/wiki/Connected-component_labeling
If you can use libraries, I'm sure OpenCV or similar libraries support this out of the box.
//edit
I see you need VB.net. Probably it is easiest to port some algorithm to VB or create one yourself.
See e.g. http://www.codeproject.com/Articles/336915/Connected-Component-Labeling-Algorithm
What to expect
Input
An image containing two shapes:
Output
Now each is separated into single images.

dojox.charting: how to align the plotArea of 2 charts, one above another?

I'm trying to layout 2 linked charts, one above the other, similar to what you might see on the Google Finance page.
I can render both charts just fine, but getting the plotAreas to line up exactly is a bit of a mystery. The chart.plotArea.width of each chart seems to depend on the width of my Y axis labels. Thus the 2 charts are not the same width and have different values for chart.getCoord().l.
Right now, I'm using an offset which is manually calculated, but there must be a better way.
this.chart.render(); // top chart, getCoords().w=800
// manually set margins for lower chart to match
this.chartVol.margins.l = this.chart.offsets.l - 59 + 10;
this.chartVol.margins.r = this.chart.offsets.r - 31 + 10;
// render bottom chart
this.chartVol.render(); // bottom chart same width, getCoords().w=800
There are two simple ways to do it:
Use maxLabelSize and labelFunc. The former is the maximal label's size in pixels. The latter is a function, which takes a number, and returns a corresponding string label.
Use labels, which is an array of {value, text} objects, and include one long dummy string of desired size at the end with some bogus value.
I don't recall how to do it without custom labels, so if you feel like it is really needed, please submit an enhancement ticket.