How to use chartlink scanner? - stock

How to use chartlink scanner for the following condition:
Price should be above 200 periods SMA
Price should be close to 200 periods SMA
Note: I want to use it for daily time frame

Related

How to get percentage Difference in qliksense

I need one help.
I calculate a Difference Between Current Year Sale and Last Year
like.
num(Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},
[CALYEAR]={">=$(vCurrentYear)"}>}[_volume_SO]),'##.0')- num(Sum({$<[HSUBSEGM.descr]
={"Clinker and Cement"},[CALYEAR]={">
=$(vPreviousYear)<=$(vPreviousYear)"}>}[_volume_SO]),
'##.0')
so I m getting and answer Suppose.
This Year sale is 100 $ and Last Year sale was 50 $.
so total growth 50 $.
But I want to show growth in %.
In this case my Revenue growth is 50 % because it got double from last year..
the mathematical answer should be of this form
(sum(CurrentYearSales)-sum(PreviousYearSales))
/ sum(PreviousYearSales)
So using your example as a guide:
I removed some of the num() functions and applied it to only the final result and simplified the set analysis for vCurrentYear and vPreviousYear. That is purely my own style choices.
Give this a go
num(
(Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={$(vCurrentYear)}>}[_volume_SO])
- Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={$(vPreviousYear)}>}[_volume_SO]))
/
Sum({$<[HSUBSEGM.descr]={"Clinker and Cement"},[CALYEAR]={$(vPreviousYear)}>}[_volume_SO])
,'##0.00%')

Calculate Hourly Pay Based on Pay Rate Column

I am trying to calculate the hourly pay based on the pay rate column. Technically, I am trying to see who has hourly pay assigned to that column vs folks that have annual salary in that column.
Employee
Pay_Rate
400001
10283.52
304068
120000
304069
20.25
I am trying to find a decimal and if decimal is found, I seeing if its greater than zero. If its greater than zero, then I leaving it alone assuming its hourly pay; but if decimal isnt found, then I am taking that number and dividing by 2080 to get hourly pay. My logic, however, works well unless there is a decimal in annual pay. How do I code around that?
CASE WHEN ((EMP.PAY_RATE - trunc(EMP.PAY_RATE)) > 0) THEN EMP.PAY_RATE ELSE (EMP.PAY_RATE/2080) END AS "Hourly_Wage",
Sample output from the abve data set is:
Payrate
10283.52
57.692307
20.25
Simply changed the pay rate threshold. I was over thinking this until I read the comment from Thorsten.
CASE WHEN (EMP.PAY_RATE < 600) THEN EMP.PAY_RATE ELSE (EMP.PAY_RATE/2080) END AS "Hourly_Wage"

how to calculate the moving avg for stock in stock market

I want to cal the moving avg for an etf, also i want to know how that can be cal on the paper? Value is available for 6 period and I want to predict the next value using macd cross.

Accessing data from multiple rows

So I am having some troubles writing a sql query. It is a financial stock problem and we have two table, one named A and one named B. The dates are divided into periods, so we want to calculate the investment value for the next period based on some criteria of the current period.
For instance, to calculate the investment value of period 2, we first need to compare the price of stock of the first date of period 1 from table A with the strike price of the same date from table B, and then take the max price and divide it by the investment of first date which is given as 10,000. After that, you just simply do 10000/max(price,strike), and then multiply the value by 10000. I know how to get the max which can be done by either using CASE or max, but the difficulty I am facing is that how can I actually get the investment value of the previous period. The example above is an exception because we know the value of the first day. However, if you want to calculate the investment value for period 3, you will first need the value of period 2, and this is where I am stuck at.
EDIT
Table A
Date Price
1/16/15 206
2/20/15 208
3/20/15 205
Table B
Date Strike
1/16/15 195
2/20/15 201
3/20/15 206
For example, the number of shares on 2/20/2015 is 10000(206) = 48.54
And the investment value is 48.54 * 208 = 10096.
206 is the max of 206 and 195, and 208 is the max of 208 and 201.
Thanks in advance!

How to compare two dates based on another column (SQL)?

I am trying to compare the prelim_inbound ship date with the inbound ship date.
See data here
The end goal is just that I need to determine the how often the prelim date > inbound date, the prelim date = inbound date, the prelim date < inbound date to determine weather or not the manufacturers are shipping products early, late, or on time. I'm struggling trying to figure out how to do this.
You can use the DateDiff function:
datediff(dd,PrelimShipDate,InboundShipDate) as difference
You can use Case When to check if it's positive, negative or zero
case when datediff(dd,PrelimShipDate,InboundShipDate)>0 then 1
when datediff(dd,PrelimShipDate,InboundShipDate)=0 then 0
when datediff(dd,PrelimShipDate,InboundShipDate)<0 then -1 end as comparison
You could then count the 1s, 0s, & -1s for a how many of each if you like.