following you get my approach for a trading strategy:

“I want to develop a trading strategy in python, to test it with the help of backtrader.

my strategy should track position loss value in points and open reverse stop position on specific threshold (for example -5000points of current position). I like the script to work on a minute chart timeframe.

I want the strategy to run intraday, within a specific timeframe (for example starting on 01:15 each day and stopping on 21:00).

On starting time the strategy should start with a loops. Aim of the loop is to open a reverse stop order with an increased lotsize (lotsize of related order * multiplier) everytime the related order hits the loss threshold.

On stopping time, the script should end up all tasks and close all active positions and go into sleep until next starting time.

The loop in detail should go like this (you already mentioned it pretty right in your previous answer) (additional info: I need to be able to change the parameters as easy as possible. Perhaps it would be best to make them accessible in a separate code file. In general I’m a very big fan of modular coding style. Everytime I use X in the following explanation I want a parameter):

on first time starting the loop it should open a market order in X Direction (BUY or SELL) with LotSize of X (default value 0.01). Than the Strategy should keep go on working like you mentioned in point 1-4 of your previous answer:

It should start tracking the loss of this position like you mentioned in point 1 of your previous answer. It should check as frequently as possible the entered Threshold of loss in points (X, default value is -5000points).

If the threshold is touched for the first time, a reverse stop market order should be opened with increased lotsize (calculated: lotsize original related order * multiplier (X = 5.0).

The old order should be closed.

The loop should restart: tracking the loss touching the threshold, closing and opening another reverse stop position with increased lotsize again.

The loop should getting repeated maximum X times (Parameter for MaxLoopCount, default value should be 5).”

Structure:


1. **`config.py`**: Contains all the configurable parameters.
2. **`strategy.py`**: Defines the trading strategy based on your specifications.
3. **`main.py`**: Sets up the Backtrader environment, loads the data, and runs the backtest.

let's start with a simpler version of the logic, test it and when successful, adding further features step by step. The overall modular structure is superb. please keep it. keep the parameters as well as they are. lets break down the logic to the core function: I just want the script to open the initial order on START_TIME and close/kill everything on STOP_TIME. After that "sleep" and start repeating, when START_TIME is reached on the next day. One Additional Info: please adjust the Timeframe from M1 to Tickdata. I have downloaded "Excess_USTECH_2023.csv" file which contains tick data for the whole year 2023. I want to use it for backtesting. Once the core function of opening and closing in everyday loops is working, we will go on with re-implementing the previous discussed features step-by-step again. 

The “Excess_USTECH_2023.csv” is formatted in the following way. Please make sure the script can handle the tickdata provided.

```bash
"Exness","Symbol","Timestamp","Bid","Ask"
"exness","USTEC","2023-01-02 23:30:20.051Z",10967.58,10970.14
"exness","USTEC","2023-01-02 23:30:22.096Z",10967.28,10969.9
```