Metode Kalkulator Classic, Woodie, and Camarilla dengan program java

Java program untuk  menghitung  gold market levels resitan dan support (R4, R3, R2, R1, Pivot, S1, S2, S3, S4) menggunakan metode Classic, Woodie, and Camarilla  berdasarkan pergerakan harga kemarin .


📥 Diberikan Input

harga hari kemarin:

  • OPEN = 3237.91

  • HIGH = 3269.20

  • LOW = 3222.90

  • CLOSE = 3238.00


📊 Formulas


Classic (Floor Pivot)

P = (High + Low + Close) / 3
R1 = (2 * P) - Low
R2 = P + (High - Low)
R3 = High + 2*(P - Low)
R4 = R3 + (R2 - R1)

S1 = (2 * P) - High
S2 = P - (High - Low)
S3 = Low - 2*(High - P)
S4 = S3 - (S1 - S2)

Woodie

P = (High + Low + 2*Close) / 4
R1 = (2 * P) - Low
R2 = P + (High - Low)
R3 = High + 2*(P - Low)
R4 = R3 + (R2 - R1)

S1 = (2 * P) - High
S2 = P - (High - Low)
S3 = Low - 2*(High - P)
S4 = S3 - (S1 - S2)

Camarilla

R1 = Close + (High - Low) * 1.1 / 12
R2 = Close + (High - Low) * 1.1 / 6
R3 = Close + (High - Low) * 1.1 / 4
R4 = Close + (High - Low) * 1.1 / 2

S1 = Close - (High - Low) * 1.1 / 12
S2 = Close - (High - Low) * 1.1 / 6
S3 = Close - (High - Low) * 1.1 / 4
S4 = Close - (High - Low) * 1.1 / 2

P = (High + Low + Close) / 3

💻 Java Implementation

Berikut  Java class yang bisa dilakukkan untuk prediksi.


public class GoldMarketPrediction {

    public static void main(String[] args) {
        double open = 3237.91;
        double high = 3269.20;
        double low = 3222.90;
        double close = 3238.00;

        System.out.println("=== CLASSIC METHOD ===");
        calculateClassic(high, low, close);

        System.out.println("\n=== WOODIE METHOD ===");
        calculateWoodie(high, low, close);

        System.out.println("\n=== CAMARILLA METHOD ===");
        calculateCamarilla(high, low, close);
    }

    static void calculateClassic(double high, double low, double close) {
        double pivot = (high + low + close) / 3;
        double r1 = (2 * pivot) - low;
        double r2 = pivot + (high - low);
        double r3 = high + 2 * (pivot - low);
        double r4 = r3 + (r2 - r1);

        double s1 = (2 * pivot) - high;
        double s2 = pivot - (high - low);
        double s3 = low - 2 * (high - pivot);
        double s4 = s3 - (s1 - s2);

        printLevels(pivot, r1, r2, r3, r4, s1, s2, s3, s4);
    }

    static void calculateWoodie(double high, double low, double close) {
        double pivot = (high + low + 2 * close) / 4;
        double r1 = (2 * pivot) - low;
        double r2 = pivot + (high - low);
        double r3 = high + 2 * (pivot - low);
        double r4 = r3 + (r2 - r1);

        double s1 = (2 * pivot) - high;
        double s2 = pivot - (high - low);
        double s3 = low - 2 * (high - pivot);
        double s4 = s3 - (s1 - s2);

        printLevels(pivot, r1, r2, r3, r4, s1, s2, s3, s4);
    }

    static void calculateCamarilla(double high, double low, double close) {
        double range = high - low;
        double r1 = close + (range * 1.1 / 12);
        double r2 = close + (range * 1.1 / 6);
        double r3 = close + (range * 1.1 / 4);
        double r4 = close + (range * 1.1 / 2);

        double s1 = close - (range * 1.1 / 12);
        double s2 = close - (range * 1.1 / 6);
        double s3 = close - (range * 1.1 / 4);
        double s4 = close - (range * 1.1 / 2);

        double pivot = (high + low + close) / 3;

        printLevels(pivot, r1, r2, r3, r4, s1, s2, s3, s4);
    }

    static void printLevels(double pivot, double r1, double r2, double r3, double r4,
                            double s1, double s2, double s3, double s4) {
        System.out.printf("Pivot: %.2f\n", pivot);
        System.out.printf("R1: %.2f, R2: %.2f, R3: %.2f, R4: %.2f\n", r1, r2, r3, r4);
        System.out.printf("S1: %.2f, S2: %.2f, S3: %.2f, S4: %.2f\n", s1, s2, s3, s4);
    }
}

How to Run

  1. Copy-paste the code into GoldMarketPrediction.java.

  2. Compile:

    javac GoldMarketPrediction.java
  3. Run:

    java GoldMarketPrediction


Comments

Popular posts from this blog

create image slider using phyton in web

Tahukah kamu Algoritma Genetika dan Penerapannya dalam Industri

create animated futuristic profile card using html+css+js

CRUD SPRING REACTIVE WEBFLUX +Mongo DB

Top 7 Digital Transformation Companies

100 perusahaan perangkat lunak (software) populer dari Eropa dan Amerika yang memiliki kehadiran atau operasional di Indonesia.

TOP 8 Framework Populer menggunakan bahasa .NET

Python Date and Time Manipulation

TOP 5 Trends Programming 2024

Daftar Kata Kunci (Keyword) dalam Bahasa Pemrograman Python