Detecting candlestick pattern - image-recognition

I have a question about a simple box drawing algorithm done in a chart.
A box should be drawn over 3 certain candlesticks.
The three candlesticks are classified like: the highs and lows of the left and right candlesticks are biggger/lower than the high and the low of the middle one. So the left and right candlestick cover the middle one.
If this pattern is detected, a rectangled (dashed) box should mark that pattern with top box of the highest high and the lowest low of the three candlesticks.
Has anybody an idea, how to box the candlestick pattern with a dashed box line?
I have solved the problem with plotshape so far:
Pattern = high[2] > high[1] and low[2] < low[1] and
high > high[1] and low < low[1]
plotshape(Pattern, style=shape.circle, location=location.abovebar, size=size.tiny, color=color.red)
But I would like to box the three candlesticks. Don't know how. Or highlight them in any way else but with circles, arrows or similar.
Does anybody have a clue how to mark the pattern with a dashed box for example?
Thank you!

Related

How to implement this stacked line chart in MPAndroidCharts or iOS-Charts

I have a number of charts/graphs created with the ported MPAndroidCharts project iOS-Charts by DanielGindi but I'm getting a request and I'm just not sure it's technically possible with things as they exist today.
I have used gradients but not sure if there's a way to kind of have it just be a 2 sided/colored gradient instead of a gradual fade. I have not created or seen an example of a dotted line coming through the existing chart but assuming zoom isn't a possibility I could hypothetically float a view over the top of it but I'd definitely prefer to have it in the native charts code/implementation.
The first graph is showing how much a user plans to have at retirement, the two shades of green represent different sources of money, the dotted line represents their spending from retirement to their estimated time of death.
The second graph is showing the gap between how much a user plans to have at retirement and how much we project they're missing compared to what they have and how that will look across the time from retirement to estimated death.
Thoughts?
It looks like a line chart with three lines and each with a solid fill.
In the top one, the dashed line graph has a white stroke and no fill, but in the bottom one, it has a black stroke and gray fill.
In the top one, the dashed line should be z-ordered to be on top, but in the bottom one, it should be z-ordered to be on the bottom.

Draw right extended line on "High and Low bar" of pivot High candle

I want to draw a line , extended right, on the Low of the pivot high candle and at High of the pivotlow, as applicable in the running market, can anyone suggest a little code which does that? . we should also delete history to make the chart clear. I am new in pine script

Make contour labels point uphill: reverse direction of text label on line feature

I am designing a map in Mapbox Studio, using mapbox.mapbox-terrain-v2’s contour layer to determine the contour lines. This is based on the outdoors style.
In the outdoors style, the contour labels are oriented so that the text is displayed between -90° and 90° of horizontal, because Keep Text Upright is set. If I disable this, then the text becomes oriented at any angle. However, this text is oriented at exactly the opposite angle to what I would like: it always points downhill, not uphill. See first image below: note that the numbers are upright where the elevation increases from north to south.
What I am aiming for is to use the Ordnance Survey style of orienting numbers uphill (upright where the elevation increases from south to north), as in the second image below.
My current style can be seen here. I have tried using the text-rotate field, but this rotates each character individually, and there does not appear to be a function to reverse the string to counteract this. Additionally, this rotates about the top of each letter, meaning that the result is offset from the actual contour line, and text-translate + text-translate-anchor seem unable to resolve this.
As you noticed, using text-rotate on a symbol layer with placement: line rotates each character individually. So you would need to then reverse the string, which isn't possible within the expressions available.
However. There is one hacky workaround which may solve the problem for you. You can simply hardcode all the possible elevations with their reversals:
["match", ["get", "ele"],
750, "m057",
700, "m007",
650, "m056",
600, "m006",
550, "m055",
500, "m005",
""
]
Combined with a text-offset of 0,1.5, this actually looks alright:
I've published the style here

Expand line to a polygon

I would like to expand a line to a wider polygon. Add 10 meter on both sides of the line for example.
Here is an example of what I would like
Take this line
And expand it to a wider polygon, like this
I did this manually, is there a way to do this automaticly?
Changing the KML or using a program?
Thanks
Vincent
Depending on how accurate you need this – this is not trivial.
One possible algorithm could be:
for each segment do
expand segment to rectangle with width 2r
targetShape.join(rectangle)
next
for each point do
expand point to circle with radius r
targetShape.join(circle)
next
targetShape.outerHull(precision)
Each single line in this routine is tricky and depends on your expectations.
You could leave out the circles and instead make the rectangles longer, but this wil not work on sharp turns.
All of this involves ugly calculations to figure orthogonal lines etc.
You could try it in an graphic tool, gimp or inkskape :-)

Android custom input component with graphical representation?

I am looking all over the net to find out a code to make a custom input component that I need but didn't stumble upon anything similar. Here's how I'd like it to work:
the purpose is to input the quantity (a number)
the quantity is to be changed with two buttons (+ & -)
there should be a button to accept the input
Here's the tricky part - the graphical representation of the input:
I'd like to have two pictures representing the currently selected quantity in the following way:
q = 0:
Both pictures are dimmed
q = 1:
The upper-left quarter of the first picture is bright (normal) and the rest is dimmed
q = 2:
The upper half of the first picture is bright (normal) and the rest is dimmed
q = 3:
The upper half + lower-left quarter of the first picture is bright (normal) and the rest is dimmed
q = 4:
The first picture is bright and the second one is dimmed
q = 5:
The first picture is bright and the upper-left quarter of the second picture is bright
.
.
.
q = 8:
Both pictures are bright.
I hope I've explained that in an understandable way.
The question is:
Do I have to make 5 instances of each picture (dimmed, bright upper-left quarter, bright upper half, bright upper half + lower-left quarter, bright) or is it possible to have only one instance of each picture (bright) and to dim the portions (as necessary) with the code?
Of course, I'd appreciate a link to anything that would be of any help or chunk of the code.
I think you should be able to handle all of your conditions with just 2 images. But use a combination linearlayout,framelayout and imageviews. Some thing like this to represent one image.
FrameLayout
Imageview
LinearLayout (Divided to 4 cells using the weight property)
You can change the alpha value of the bg color of the linear layouts to get the dimmed effect.
This can also be done using different slices of the images and changing the alpha value of the imageview. You will need to find what suits you more. It wont be easy to find any code samples as this is not a common UI found in apps.