In Pine's strategy tester, why does the quantity number above an order double the order size? - pine-script-v5

When a strategy draws quantity above the signal label, it's always double the order size and positive or negative depending on if it's a long or short. Why does it draw at double the value? What controls this number? I've been struggling to find any reference to it, where is it documented?

Related

Mapbox style to separate overlapping lines

Given two linestrings that occupy the same space, is it possible to define a style such that the lines are offset from each other and are rendered side-by-side?
A colleague says he can half remember that this functionality is available in the style spec, but I have not been able to find reference to it. Is it possible?
The property you are looking for is "Line-Offset".
From documentation (paint-line-line-offset as of 2018-09-17) :
line-offset (Paint property) Optional number. Units in pixels. Defaults to 0. Transitionable.
The line's offset.
For linear features, a positive value offsets the line to the right, relative
to the direction of the line, and a negative value to the left.
For polygon features, a positive value results in an inset, and a negative value results in an outset.

Show Separate Mark Labels alongside Measure Value Labels

(source: tableau.com)
I'm using Measure Values for combining two measures:
1)Count of Clients (As a percentage)
2)% Retention (Calculated field which uses another calculated field called Numerator Retention in it's formula over the total to calculate the %)
Measure Value Mark Labels successfully show the respective percentages for the two measures. Now I wanna show the respective count of clients or numbers behind these percentages but I'm unable to do so since I've already used Measure Value Mark Labels to do something similar.
When I try editing the Labels text, it edits it for all labels together and hence I'm getting all labels for all rows and not how I want it to show selectively as I described.
Example Solution: For Private Residence, I only want 125 to show with 60% which is the actual number behind the percentage. And I want only 119 to show with 95%
You can do this, but not using Measure Values. You should mirror what I have done here. I do not know your calculation for the Respective Retention, so use your calculation.
You need to move both of your measures to the Columns shelf and make them a Dual Axis:
After doing that, you will have access to the individual measures - so you can give labels independently:
Just make sure you place the measures that you want for each axis respectively.

How to extract LBP features from facial images in MATLAB?

I'm not familiar with Local Binary Pattern (LBP), could anyone help me to know how to extract LBP features from facial images (I need a simple code example)?
While searching, I found this code, but I didn't understand it.
So first of all you need to split the face into a certain amount of
sections.
For each of these sections you then have to loop through the all of
the pixels contained within that section and get their value (grey scale or colour values).
For each pixel check the value of the pixels which border it in (diagonals and up down left and right) and save them
for each of the directions check if the colour value of. if the colour is greater than the original pixels value you can assign that value a 1 and if it is less you can assign it as a 0.
you should get a list of 1's and 0's from the previous steps. put these numbers together and it will be a large binary number, you should be able to convert this to decimal and you will have a number assigned for that pixel. save this number per pixel.
after you have got a decimal number for each pixel within a section you can average all of the values to get an average number for this section.
This may not be the best description of how this works so here is a useful picture which might help you.
There is an extractLBPFeatures function in the R2015b release of the Computer Vision System Toolbox for MATLAB.

precise scaling of matlab textboxes with axes magnification

I would like to have a text box rescale with the level of magnification, such that one unit of text is always assigned one unit of horizontal axis-length. The text width should not change but rather the spacing between characters.
For instance, if the x-axis displayed [0:50], fifty characters should be displayed, one at each integer position. If the magnification was increased such that the display comprised only [0:10], only ten characters would be displayed, again placing one character at each integer position along the horizontal axis.
Finally, the text would ideally not display when the magnification level was below some threshold determined by the number of characters that can be legibly printed along a horizontal line spanning the extent of the axes.
I have tried using the text object, but it doesn't seem to have the relevant properties to allow such dynamic behavior. I have instead considered breaking the N-length string into N unit-length strings and placing each at a defined x-position, but I'm having trouble figuring out how to display only those relevant at the prevailing zoom level (there is some spill-over of characters beyond the bounds of the axis). In contrast, with this approach, all the characters appear as a jumble at zoom levels so low that the number of characters printed cannot be reasonably accommodated.
Thus, I inquire whether another solution besides printing a series of unit-length strings might be advised and, if not, how the twin problems of text spill-over and text overlap can be resolved at high and low zoom, respectively (the first might be done by somehow preventing printing of information outside the axes; the second seems to require some dynamic magnification-aware means of suppressing text output at or above a certain x-axis extent).

Calculate X position where string ends

I have a string with some font size & added that text on UIView using drawInRect method. I am able to calculate the approx Y position of the string by calculating its height, but I want to know the X position as well.
Can I calculate the x location of string where my string gets end.
string length & font size can vary.
Thanks
Perhaps calling CGContextGetTextPosition after drawing the string will give you the coordinate you need.
For more information, read the “Text” chapter of Quartz 2D Programming Guide.