How can I get accurate values in camarilla pivot in 1-minute timeframe ?

Asked by Sejpalsinh Jadeja · SOLVED
1 reply 835 views Jump to solution Reply
Sejpalsinh Jadeja Original Post
AlgoDelta Team

I’m using Camarilla pivot in my algo and calculating it from 1-minute candles.

I’m already checking HLC properly, but still the pivot levels are not matching chart values.

Am I missing something here?

Posted Apr 24
Reply

    1 Reply

    Support AlgoDelta
    Support AlgoDelta AlgoDelta Support ·

    Yes, this will happen in the one minute candle data is used from the historical data.

    Because, Camarilla (and most pivots) should not be calculated from one minute candles.

    Correct approach:

    You have to calculate pivot in the previous full day candle not the previous day one-minute candles.

    Because the last candle close in the minute candle is different from the previous full day candle – just slightly different of some points but still the values in pivot will be inaccurate.

    Below is the code that you can refer:

    def camarilla_pivot(prev_high, prev_low, prev_close):
        diff = prev_high - prev_low
        
        levels = {
            "H1": prev_close + (diff * 1.1 / 12),
            "H2": prev_close + (diff * 1.1 / 6),
            "H3": prev_close + (diff * 1.1 / 4),
            "H4": prev_close + (diff * 1.1 / 2),
            "PP": (prev_high + prev_low + prev_close) / 3.0,
            "L1": prev_close - (diff * 1.1 / 12),
            "L2": prev_close - (diff * 1.1 / 6),
            "L3": prev_close - (diff * 1.1 / 4),
            "L4": prev_close - (diff * 1.1 / 2),
        }
    
        return levels
    
    # Example (use previous day data of 1 day timeframe candle)
    prev_high = 200
    prev_low = 180
    prev_close = 190
    
    levels = camarilla_pivot(prev_high, prev_low, prev_close)
    print(levels)
    Verified Solution
    • Appreciate the answer that you explained and also thanks for the code that you provided it’s really help me a lot. – Sejpalsinh Jadeja Team Jul 28
    Markdown supported · ```json for code blocks · paste or drop screenshots

    Be specific and kind. Never share API keys, passwords or personal account details.

    Welcome to the community

    Log in or create your account in under a minute.

    1. 1Mobile
    2. 2E-mail
    3. 3Password
    +91

    Have a password?

    By continuing you agree to the community guidelines. We’ll send a one-time code by SMS.