Systemicbeta

Sine

systemic:core-sinMath

Inputs

NameTypeDescription
DataNumber seriesThe series of angles, in radians, whose sine is calculated.

Outputs

NameTypeDescription
SinNumber seriesThe sine of each input angle, a value from -1 to 1.

Cost

6
credits per run
1,000
bars

0.198 + 0.00569·n credits for n bars, rounded up. The marks are each plan's limit of bars.

The Sine module computes the sine of each value in the input series. The sine maps an angle (in radians) to its vertical position on the unit circle. The result oscillates smoothly between −1 and +1.

sin⁡(θ):R→[−1,1]\sin(\theta) : \mathbb{R} \rightarrow [-1, 1]

How It Works

flowchart TD
    subgraph Input["Input Data"]
        A["Angles in radians:<br/>θ₁, θ₂, θ₃, ... θₙ"]
    end
    
    subgraph Processing["Sine Calculation"]
        NP["Sine of each value"]
        NAN["Missing or ±∞ → empty"]
    end
    
    subgraph Output["Result"]
        S["sin(θ₁), sin(θ₂), ... sin(θₙ)"]
        B["All values bounded: [-1, +1]"]
    end
    
    A --> NP --> NAN --> S --> B

The Unit Circle and Sine

The sine is the y-coordinate of a point that moves around the unit circle:

flowchart LR
    subgraph Cycle["One Complete Rotation (0 to 2π)"]
        P0["θ = 0<br/>sin = 0"]
        P1["θ = π/2<br/>sin = +1"]
        P2["θ = π<br/>sin = 0"]
        P3["θ = 3π/2<br/>sin = -1"]
        P4["θ = 2π<br/>sin = 0"]
    end
    
    P0 -->|"Rising"| P1 -->|"Falling"| P2 -->|"Falling"| P3 -->|"Rising"| P4
Angle (radians)Angle (degrees)sin(θ)Position on Cycle
00°0Start (right)
π/630°0.5Rising
π/445°0.707Rising
π/290°+1Peak (top)
π180°0Zero crossing (left)
3π/2270°−1Trough (bottom)
2π360°0Complete cycle

Key Mathematical Properties

PropertyDescriptionFormula
Bounded RangeOutput always between −1 and +1−1≤sin⁡(θ)≤1-1 \leq \sin(\theta) \leq 1
PeriodicityRepeats every 2π radianssin⁡(θ+2π)=sin⁡(θ)\sin(\theta + 2\pi) = \sin(\theta)
Odd SymmetryNegating input negates outputsin⁡(−θ)=−sin⁡(θ)\sin(-\theta) = -\sin(\theta)
Phase RelationshipCosine is shifted sinecos⁡(θ)=sin⁡(θ+π2)\cos(\theta) = \sin(\theta + \frac{\pi}{2})

Angle Units: Radians Required

⚠️ Important: This module expects angles in radians, not degrees.

Conversion formula:

radians=degrees×π180\text{radians} = \text{degrees} \times \frac{\pi}{180}
Common DegreesRadianssin(θ)
0°00
30°π/6 ≈ 0.5240.5
45°π/4 ≈ 0.7850.707
60°π/3 ≈ 1.0470.866
90°π/2 ≈ 1.5711.0
180°π ≈ 3.1420

Financial Applications

1. Cyclical Time Encoding

Markets have cycles: daily trading sessions, weekly patterns, monthly options expiry and seasonal trends. The sine encodes these cycles as smooth, continuous features with no jumps.

flowchart TD
    subgraph TimeData["Raw Time Data"]
        H["Hour of day: 0-23"]
        D["Day of week: 1-7"]
        M["Month: 1-12"]
    end
    
    subgraph Convert["Convert to Angles"]
        HA["θ = hour × 2π / 24"]
        DA["θ = day × 2π / 7"]
        MA["θ = month × 2π / 12"]
    end
    
    subgraph Encode["Cyclical Encoding"]
        SIN["Sine module"]
        COS["Cosine module"]
    end
    
    subgraph Features["Smooth Features"]
        F1["Hour: sin, cos"]
        F2["Day: sin, cos"]
        F3["Month: sin, cos"]
    end
    
    H --> HA --> SIN & COS --> F1
    D --> DA --> SIN & COS --> F2
    M --> MA --> SIN & COS --> F3

Why this matters: With raw hour values (0-23), 23:00 and 00:00 look as far apart as possible, but they are next to each other. Sine/cosine encoding keeps them close.

2. Intraday Session Timing

Encode the position within a trading session:

Timeθ (if 9:30-16:00)sin(θ)Interpretation
9:30 (Open)00Session start
11:00≈ 0.23π0.66Morning session
12:45 (Midday)π/21.0Peak of session
14:30≈ 0.77π0.66Afternoon session
16:00 (Close)π0Session end

3. Seasonality Features

CycleAngle FormulaApplication
Hour of Dayθ = hour × 2π / 24Intraday patterns
Day of Weekθ = day × 2π / 7Weekly seasonality
Day of Monthθ = day × 2π / 30Monthly patterns
Month of Yearθ = month × 2π / 12Seasonal effects
Quarterθ = quarter × 2π / 4Quarterly cycles

Sine + Cosine: Complete Circular Encoding

Sine alone is ambiguous (sin(π/4) = sin(3π/4)). Pair it with cosine for an unambiguous circular encoding:

flowchart LR
    subgraph Quadrants["Circle Quadrants"]
        Q1["Q1: sin > 0, cos > 0<br/>θ ∈ (0, π/2)"]
        Q2["Q2: sin > 0, cos < 0<br/>θ ∈ (π/2, π)"]
        Q3["Q3: sin < 0, cos < 0<br/>θ ∈ (π, 3π/2)"]
        Q4["Q4: sin < 0, cos > 0<br/>θ ∈ (3π/2, 2π)"]
    end
    
    Q1 --> Q2 --> Q3 --> Q4 --> Q1
Angle Rangesin(θ)cos(θ)Quadrant
0 to π/2++1st
π/2 to π+−2nd
π to 3π/2−−3rd
3π/2 to 2π−+4th

Example System: Time-Based Signal

A time-aware system that reacts only during active hours. It needs an input series that holds the hour of each bar:

flowchart TD
    subgraph Input["Market Data"]
        P["Price Data"]
        T["Timestamp"]
    end
    
    subgraph TimeEncode["Time Encoding"]
        HOUR["Extract hour"]
        ANGLE["θ = hour × 2π / 24"]
        SIN["SIN(θ)"]
    end
    
    subgraph Indicator["Momentum"]
        RSI["RSI(14)"]
    end
    
    subgraph Logic["Session-Aware Logic"]
        PEAK["sin > 0.7?<br/>(Active hours)"]
        OVER["RSI < 30?<br/>(Oversold)"]
        AND["AND"]
    end
    
    subgraph Action["Signal"]
        BUY["Buy Signal"]
    end
    
    T --> HOUR --> ANGLE --> SIN --> PEAK
    P --> RSI --> OVER
    PEAK & OVER --> AND --> BUY

This system gives buy signals only during active trading hours (when the sine of the hour angle is high) and skips low-liquidity hours.


Missing Data

When an input value is missing (empty), the output on that bar is empty too. This happens, for example, when a stock series has no bar on a weekend or holiday. Gaps are never filled: every output value is the sine of a real input value. The output has the same length as the input, so each value stays on its own bar.


Handling Invalid Inputs

The sine of an infinite angle (±∞) does not exist. This is different from missing data, but both give an empty output:

  • Missing input → empty: there was no value to compute from
  • ±Infinity input → empty: there was a value, but its sine is undefined

Every finite angle, however large, has a valid sine (the angle wraps every 2π2\pi).


Edge Cases

SituationBehaviorNotes
No input valuesRejected with an errorAt least 1 value is required
Missing valuesEmpty on the same barGaps are kept, never filled
Very large anglesWraps correctly (periodic)sin(100π) ≈ 0, with tiny rounding differences
Negative anglesWorks correctly (odd symmetry)sin(−π/2) = −1
Infinite valuesEmptySine is undefined for an infinite angle

ModuleRelationship
CosinePair with Sine for a complete circular encoding
TangentThe sin/cos ratio, unbounded
ArcSineInverse sine: converts values back to angles

Further Reading


Examples

Input angles (radians):

[0, 0.5π, π, 1.5π, 2π]

Step values:

sin(0)      = 0
sin(0.5π)   = 1
sin(π)      = 0
sin(1.5π)   = -1
sin(2π)     = 0

Output:

[0, 1, 0, -1, 0]

Another example:

Input : [0, π/6, π/4, π/3]
Output: [0, 0.5, ≈0.7071, ≈0.8660]

Interpreting the Output

  • Values near +1: the angle points mostly “up”.
  • Values near −1: the angle points mostly “down”.
  • Values near 0: the angle is near horizontal (pointing “right” or “left”).
  • Smooth angle changes give smooth sine changes, which suits continuous cycles.

Summary

The Sine module turns angles (in radians) into smoothly oscillating values between −1 and +1. Its main financial use is cyclical time encoding: converting time into continuous features that keep the circular nature of time. Pair it with the Cosine module for a complete encoding. Remember: the input must be in radians, not degrees.

Rendering diagrams...
© 2026 WanoLabs. All rights reservedBeta v0.1.5