# Feature Specification: Timeframe Profiles

**Last Updated:** 2025-09-15

## 1. High-Level Goal

To introduce a "Timeframe Profile" system that simplifies the strategy's configuration for production use while retaining granular control over individual trading conditions for development and backtesting. This will be achieved by allowing the user to select either a pre-configured profile or a manual override mode.

## 2. Key Features (User Stories)

*   As a **production user**, I want to select a single, pre-tested profile (e.g., "12H - Aggressive") from a dropdown menu to automatically enable the optimal set of trading conditions for that timeframe, without having to manage dozens of individual switches.
*   As a **developer**, I want to switch to a "Manual / Development" mode that allows me to enable or disable any individual trading condition to test new combinations and refine the strategy.

## 3. Implementation Plan (The "Dual-Mode" Approach)

This plan is designed to work within the constraints of Pine Script, which does not support dynamically hiding or showing input settings. The logic will be controlled by a master "mode" switch.

### 3.1. New Inputs in `MainStrategy.pine`

Two new master inputs will be added at the top of the strategy settings:

```pinescript
// Controls whether the strategy uses pre-configured profiles or manual switches.
i_config_mode = input.string("Profile", "Configuration Mode", options=["Profile", "Manual / Development"], group="General Setings")

// A dropdown to select the desired profile when in "Profile" mode.
i_timeframe_profile = input.string("1D - Default", "Timeframe Profile", options=["1D - Default", "12H - Aggressive", "8H - Conservative"], group="General Setings")
```

All existing `i_enable_longCondition_...` input switches will remain, grouped under a clear header like `--- MANUAL CONDITION OVERRIDES ---`.

### 3.2. New Library: `LibraryProfileManager.pine`

A new library will be created to centralize the logic for each profile.

*   **`EnabledConditions` Type:** This custom `type` will define a boolean field for every trading condition in the strategy.
    ```pinescript
    export type EnabledConditions
        bool enable_rsiRegularBullish
        bool enable_stochRocM3
        // ... and so on for all ~40 conditions
    ```

*   **`f_get_enabled_conditions()` Function:** This function will take the selected profile name as input and return a populated `EnabledConditions` object.
    ```pinescript
    export f_get_enabled_conditions(string profile_name) =>
        results = EnabledConditions.new()
        switch profile_name
            "1D - Default" =>
                results.enable_rsiRegularBullish := true
                results.enable_stochRocM3 := true
                // ... set all other booleans for the 1D profile
            "12H - Aggressive" =>
                results.enable_rsiRegularBullish := false
                results.enable_stochRocM3 := true
                // ... set all other booleans for the 12H profile
        results
    ```

### 3.3. Logic Flow in `MainStrategy.pine`

The main strategy will use an `if/else` block based on `i_config_mode` to determine the source of the final enablement booleans.

```pinescript
var bool enable_rsiRegularBullish = false
// ... declare all other final enablement booleans

if i_config_mode == "Profile"
    profile_settings = libProfileManager.f_get_enabled_conditions(i_timeframe_profile)
    enable_rsiRegularBullish := profile_settings.enable_rsiRegularBullish
    // ... assign all other booleans from profile_settings
else // Manual / Development Mode
    enable_rsiRegularBullish := i_enable_longCondition_rsiRegularBullishDivergence
    // ... assign all other booleans from the individual input switches
```
The rest of the strategy (e.g., `longEntryEnablementInputs`) will then use these final `enable_...` variables.

## 4. UI/UX Considerations

*   **No Dynamic Hiding:** It is a known limitation of Pine Script that we cannot dynamically hide the manual override switches when "Profile" mode is selected.
*   **Clarity via Naming:** The settings panel will be organized with clear group names and tooltips to guide the user, making it obvious that the manual switches are for development purposes and can be ignored when using a profile.
