I have a data set of a given stock in a csv format. Specifically, it gives me a tick-by-tick data of the security for a given period of time. I want to create a program to analyse this data set and help me optimise my strategy for day trading. My strategy is as follows:
On any given day, if the first 15 minute data has a significant price variance (say of 100 points)indicating volatility , it creates high and low levels for that day using the highest and lowest price points for those first 15 minutes. It then analyses further when these levels are broken during the rest of the day. The idea is that the first 15 minute data on a volatile day will create levels of support and resistances, which once broken, will guide the mood of the rest of the day. A trade execution framework can thus be created using this rationale.
For Example,
On a given day in the first 15 minutes(from 9:15 AM to 9:30 AM), the highest price the security reached was 12000 and the lowest it reached was 11900. The variance therefore was a 100 points indicating a volatile day. And so, we make 12,000 (highest point) as our resistance and 11,900(lowest point) as our support.
Lets say, at about 10:00 AM, the price of the security breaches the 12000 level and moves up. We then take a long trade(buy the stock) and put a target of 1 percent. That means that we aim to sell the stock once it has appreciated 1 percent, which in this case will be at 12,120.
We also put a stop loss right in the middle of our support and resistance levels. In this case, the stop loss will be at 11,950(half of the 100 point variance) This is our maximum defined loss i.e. we exit the trade and take the loss if the asset moves below 11,950 after the trade has been executed.
I want to create a program which takes the following inputs
1. Price points at different points of time during a whole month
2. A measure of variance before the program goes through further analysis
3. A stop loss point
4. A target percentage
I then want it to output:
1. The number of trades which hit the target point
2. The number of trades which hit the stop loss
The intention is to backtest this strategy on the given data and find optimised measures of variance, target percentages and stop loss points to ensure that this strategy is generally profitable in the long run. If you think there are other, more efficient ways to achieve the same objective then please let me know.