OPEN-SOURCE SCRIPT

Jalambi Paul model

Key Components
Inputs:

Window Length (window): The number of periods for calculating the rolling statistics. Default is set to 50.
Risk Percentage (risk_percentage): The percentage of capital risked per trade. Default is 1.0%.
Stop Loss and Take Profit Levels:
Stop Loss: Default is 2% of the entry price.
Take Profit: Default is 4% of the entry price.
Logarithmic Returns:

Calculates the logarithmic return of the price series using:
log_return
=
log

(
close
close
[
1
]
)
log_return=log(
close[1]
close

)
This helps in normalizing price changes.
Rolling Statistics:

Mean (rolling_mean): Calculated over the rolling window using the Simple Moving Average (SMA).
Standard Deviation (rolling_std): Measured over the rolling window to understand volatility.
Shiryaev-Zhou Index (SZI):

The SZI is a standardized z-score:
SZI
=
log_return

rolling_mean
rolling_std
SZI=
rolling_std
log_return−rolling_mean


This metric is used to detect overbought or oversold conditions.
Signal Generation:

Buy Signal (long_signal): Triggered when SZI is below a fixed threshold (-2.0).
Sell Signal (short_signal): Triggered when SZI is above a fixed threshold (2.0).
Visuals on the Chart:

Buy signals are plotted below the price bars with green upward-pointing labels.
Sell signals are plotted above the price bars with red downward-pointing labels.
Trade Execution:

Entry Conditions:
Long positions are opened when long_signal is true.
Short positions are opened when short_signal is true.
Exit Conditions:
Stop Loss and Take Profit levels are calculated based on the entry price and the respective percentage inputs.
Positions are closed automatically when these levels are hit.
Visualization:

Plots the stop-loss (red line) and take-profit (green line) levels on the chart for easier tracking.


meanmodelMoving AveragesregressionsreversionstratsTrend Analysis

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian