एल्गोरिदमिक ट्रेडिंग (algorithmic trading) Logo Light Mode

Kotak

Stockshaala

Module 5
पॉपुलर (popular) अल्गो ट्रेडिंग स्ट्रेटेजीज़ (algo trading strategies)
Course Index
Read in
English
हिंदी

Chapter 2 | 2 min read

अल्गो स्ट्रेटेजी (algo strategy): मीन रिवर्शन (mean reversion) – बाय द डिप (buy the dip), सेल द स्पाइक (sell the spike)

आपने ये पहले सुना होगा:

"सस्ता खरीदो, महंगा बेचो।"
"स्टॉक्स हमेशा अपने एवरेज पर लौटते हैं।"

यही मीन रिवर्शन (mean reversion) के पीछे का फिलॉसफी है।

जब कोई स्टॉक अपने सामान्य प्राइस रेंज से बहुत दूर चला जाता है, अल्गो ट्रेडर्स मानते हैं कि यह वापस एवरेज पर लौटेगा (या "रिवर्ट" करेगा)। इसलिए वे डिप खरीदते हैं या स्पाइक बेचते हैं

मान लीजिए एक स्टॉक आमतौर पर ₹90 और ₹110 के बीच ट्रेड करता है।

एक दिन पैनिक के चलते, यह ₹80 पर गिर जाता है।

मीन रिवर्शन अल्गो ₹80 पर खरीदेगा, यह उम्मीद करते हुए कि यह ₹100 की ओर वापस उछलेगा।

यह मानता है कि प्राइस मूव एक ओवररिएक्शन था — कोई नया ट्रेंड नहीं।

मीन रिवर्शन अवसरों का पता लगाने के लिए इंडिकेटर्स:

  • बोलिंजर बैंड्स (Bollinger Bands)
    ये बैंड्स वोलेटिलिटी के आधार पर एक्सपैंड और कॉन्ट्रैक्ट होते हैं।
    अगर प्राइस लोअर बैंड को छूता है, तो यह ओवरसोल्ड हो सकता है – एक खरीद संकेत।
    अगर यह अप्पर बैंड को छूता है, तो यह ओवरबॉट हो सकता है – एक बिक्री संकेत।
import pandas as pd

def calculate_bollinger_bands
(data, window=20, num_std=2):
    """
    Calculate Bollinger Bands.
    
    Parameters:
    data    : DataFrame with
    'close' prices
    window  : Moving average 
    period
    num_std : Number of standard
    deviations
    
    Returns:
    DataFrame with columns: 
    MA, Upper Band, Lower Band
    """
    data['MA'] = data['close']
    .rolling(window=window).mean()
    data['STD'] = data['close']
    .rolling(window=window).std()
    data['Upper'] = data['MA']
    + (data['STD'] * num_std)
    data['Lower'] = data['MA']
    - (data['STD'] * num_std)
    return data[['MA', 'Upper'
    , 'Lower']]

# Example usage:
# df = calculate_bollinger
_bands(price_data)

  • आरएसआई (RSI - Relative Strength Index)

    आरएसआई < 30 = ओवरसोल्ड (खरीद)
    आरएसआई > 70 = ओवरबॉट (बिक्री)

def calculate_rsi(data,
 period=14):
    """
    Calculate Relative Strength 
    Index (RSI).
    
    Parameters:
    data   : DataFrame with
    'close' prices
    period : Lookback period
    (default = 14 days)

    Returns:
    Series containing RSI values
    """
    delta = data['close'].diff()
      # Price changes

    #Separate gains and losses
    gain = delta.where(delta >
     0, 0)
    loss = -delta.where(delta 
    < 0, 0)

    #Use Exponential Moving
    Average 
    (smoother than simple average)
    avg_gain = gain.ewm(span=
    period, adjust=False).mean()
    avg_loss = loss.ewm(span
    =period
    , adjust=False).mean()

    #Relative Strength (RS)
    rs = avg_gain / avg_loss

    #RSI Formula
    rsi = 100 - (100 / (1 
    + rs))
    return rsi

  • मूविंग एवरेज पुलबैक (Moving Average Pullbacks)

    अगर प्राइस अपने मूविंग एवरेज से 5-10% नीचे गिरता है, तो अल्गो खरीद का ट्रिगर कर सकता है।

    मान लीजिए:

    • स्टॉक का 20-दिन का मूविंग एवरेज = ₹100
    • वर्तमान प्राइस = ₹88
    • आरएसआई = 25

    आपका अल्गो कहता है, "यह बहुत सस्ता है!"
    यह स्टॉक खरीदता है और तब निकलता है जब प्राइस ₹98 तक पहुंचता है या आरएसआई 50 पार कर जाता है।

import pandas as pd

def calculate_
moving_average
(data, window=20):
    """
    Calculate Simple 
    Moving Average (SMA).
    
    Parameters:
    data   : DataFrame with 
    a 'close' column
    window : Lookback period 
    (default = 20)
    
    Returns:
    Series with SMA values
    """
    return data['close'].rolling
    (window=window).mean()

# Example usage:
# price_data['SMA_20'] 
= calculate
_moving_average(price_data, 
window=20)

  • मार्केट्स न्यूज़, पैनिक, या शॉर्ट-टर्म हाइप पर ओवररिएक्ट करते हैं
  • प्राइस फेयर वैल्यू पर लौटने की प्रवृत्ति रखते हैं
  • यह साइडवेज या रेंज-बाउंड मार्केट्स में अच्छा काम करता है
  • ट्रेंडिंग मार्केट्स इस स्ट्रैटेजी को खत्म कर सकते हैं – स्टॉक गिरता ही रह सकता है!
  • कभी भी मानकर न चलें कि डिप = रिवर्सल। हमेशा उपयोग करें:
  • स्टॉपलॉस (stoploss)
  • पोजीशन साइजिंग (position sizing)
  • टाइम-बेस्ड एक्जिट (उदा., अगर 3 दिन में रिवर्सल नहीं होता तो बाहर निकलें)
  • कई इंडिकेटर्स को मिलाएं (उदा., आरएसआई + बोलिंजर)
  • न्यूज़ इवेंट्स के दौरान ट्रेडिंग से बचें (जैसे आरबीआई पॉलिसी या अर्निंग्स)
  • एक समय पर कुछ ट्रेड्स तक एक्सपोज़र सीमित करें

तो, मोमेंटम = वेव पर सवारी करें
मीन रिवर्शन = बाउंस को पकड़ें

दोनों की अपनी जगह है। अल्गोस आपको इमोशन को हटाने और लॉजिक का पालन करने में मदद करते हैं।

अगला है: एक बहुत ही दिलचस्प कॉन्सेप्ट – पेयर्स ट्रेडिंग (Pairs Trading), जहां आपको मार्केट डायरेक्शन की परवाह नहीं होती!

This content has been translated using a translation tool. We strive for accuracy; however, the translation may not fully capture the nuances or context of the original text. If there are discrepancies or errors, they are unintended, and we recommend original language content for accuracy.

Is this chapter helpful?
Previous
एल्गो स्ट्रेटेजी: मोमेंटम स्ट्रेटेजी (momentum strategy) - राइड द वेव (ride the wave)
Next
अल्गो स्ट्रेटेजी (algo strategy): पेयर्स ट्रेडिंग (pairs trading) – न्यूट्रल (neutral) और स्मार्ट (smart)

Disclaimer: This article is for informational purposes only and does not constitute financial advice. It is not produced by the desk of the Kotak Neo Research Team, nor is it a report published by the Kotak Neo Research Team. The information presented is compiled from several secondary sources available on the internet and may change over time. Investors should conduct their own research and consult with financial professionals before making any investment decisions. Read the full disclaimer here.

Investments in securities market are subject to market risks, read all the related documents carefully before investing. Brokerage will not exceed SEBI prescribed limit. The securities are quoted as an example and not as a recommendation. SEBI Registration No-INZ000200137 Member Id NSE-08081; BSE-673; MSE-1024, MCX-56285, NCDEX-1262.

Discover our extensive knowledge center

Explore our comprehensive video library that blends expert market insights with Kotak's innovative financial solutions to support your goals.

PreviousNext