Click here to Login

                                                   Historical screening and customized statistics based on criteria


Lars Karlsson
2017-07-31 08:57:16


I've been having some success with part time swing trading of a reversal type strategy, and would now like to refine my strategy in a time efficient manner in order to improve my win rate.
I want to screen (EOD) a couple of years worth of data for Nasdaq stocks that have increased +50% over a few days.
From this screen I want an output of all the stocks that meet this criteria and also for which date this is true for each of these symbols.
To this table I also want to add colums with customized parameters, such as e.g. performance one week after, candlestick criteria etc.

Could anyone perhaps point me in the right direction to accomplish this feat?

Is it possible to also include an intraday parameter in such as the slope of the first trading hour range midpoint through the last trading hour range midpoint?

Thank you in advance!


Amritendu Maji
2017-07-31 12:25:32


I think you can look at the following examples and see if these help you.

I don't know much about intraday trading, so I will not venture there. Hope the above helps.

2017-08-01 07:45:20


Here is how to combine EOD and Intraday data:

Lars Karlsson
2017-08-01 07:50:56


Amazing, thank you for the rapid answers! I'll get right to it.

Lars Karlsson
2017-08-02 17:56:34


Regarding being able to find specific dates for when the criteria is true for different symbols, I found this forum thread:

However, I'm not quite sure how I would be able to get the date for when the criteria is met over the course of a year, especially if the criteria are met on several different dates for the same symbol.

Maybe you could offer some help in this context?

2017-08-03 05:34:18


You need to calculate the number of bars since the criteria was true using "barssince" function then reference the past day, month, week values using "ref" and the value returned by "barssince".

Lars Karlsson
2017-08-03 07:29:01


How would I get barssince() to return more than one value per symbol? Thank you.

Amritendu Maji
2017-08-03 11:00:00


I think to get more than one instance, you will need to use this custom indicator.

Thank you.

Lars Karlsson
2017-08-04 05:39:29


Great, thanks for your response Amritendu! However, I'm not able to download the trading object. What could be the issue?

Amritendu Maji
2017-08-04 22:22:37


I was also not able to download it. Maybe Admin can figure it out.

Thank you.

2017-08-05 06:11:07


It should work now.

Lars Karlsson
2017-08-07 00:39:21


Thank you again!

I also received this response from Quantshare:

"This function returns only the number of bars since the last time the criteria was met.
You can use the valuewhen function instead:
a = valuewhen(criteria, day(), 1); // Return the day when the last criteria was met
a = valuewhen(criteria, day(), 2); // Return the day when the before last criteria was met"

A couple of additional questions:

1. It looks like I need to write a custom function to be able to find and return all the dates in a symbol where the criteria has been met, I can't find this function anywhere else, is this correct?

2. Another question is about the ability to modify the output of the stock screener to return multiple rows for each different date for the same symbol, but I'm guessing this isn't possible, am I right?

Lars Karlsson
2017-08-07 01:41:37


How would I go about to be able to return an array of values from a custom function?

Amritendu Maji
2017-08-07 11:14:47


My understanding is that a custom function returns one value per bar. Admin can correct me if I am wrong.

Usually, it is like this...

Result[i] = ResultsForThatBar;

Maybe do a loop in your calling function that will get the results... I don't know this language well enough to provide specifics. I am just trying to see if the logic works.

Good luck.

2017-08-09 06:25:37


Correct. The custom function returns only one array of values. One value per bar.

No more messages


No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"


Trading Items
Potential Issues and Errors in Historical Data
Historical Earnings Calendar Data for U.S. Stocks - Date/Time and...
Historical EOD data for LSE-listed Stocks and ETFs
Market Rule based on the Crossover Between Stock Close prices and...
FII Derivatives Statistics - Index/Stock Futures and Options

How-to Lessons
How to create trading rules based on Put and Call volume data
How to quickly select stocks based on the last value of a databas...
How to download and use U.S. stocks earnings data
Difference between the watchlist and the screener tools
How to create a volatility-based Stop - Dynamic stop based on the...

Related Forum Threads
Where can I get global historical stock and bond index prices?
Daily and Historical Downloaders
Historical Daily High, Low, and Close for every single stock?
Basic features and some issues with the background

Blog Posts
Backtesting a Strategy Based on Bond and Stock Index ETFs
How to get buy and sell orders for a portfolio based on a trading...
How to create buy and sell trading rules based on News Data
Fundamental Screen based on Stock price, ROI and Market capitaliz...
Download historical EOD data for the stock, futures, ETF and Fore...

Create an account
Affiliate Program
Contact Us
Trading Forum
How-to Lessons
About Us
Terms of Use

Copyright 2021
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Follow us on Google+
RSS Trading Items

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.