Here is another strategy to help those who find the relation between the abstract currency moves in different timeframes and their relation to other currency moves.
If anyone has great ideas to share, I am quite sure money is already flowing in your world of creation and inspired beyond this physical world of desire.

Code
// Function prototypes
void ConvertToBinary(vars priceData, int* binaryRepresentation, int length);
void XORBinaryLists(int* list1, int* list2, int* result, int length);
int FindMaximumXOR(int* xorResult, int length);

void run() 
{
    // Set parameters
    BarPeriod = 60; // 1-hour bars
    StartDate = 2020;
    EndDate = 2021;
    LookBack = 100; // Look back period for initialization

    // Define the list of currency pairs
    string pairs[] = {"EURUSD", "GBPUSD", "USDJPY", "GBPJPY", "USDCAD", "EURAUD", "EURJPY", "AUDCAD",
               "AUDJPY", "AUDNZD", "AUDUSD", "CADJPY", "EURCAD", "EURCHF", "EURGBP", "EURNZD", 
               "GBPCAD", "GBPCHF", "NZDCAD", "NZDJPY", "NZDUSD", "USDCHF", "CHFJPY", "AUDCHF", 
               "GBPNZD", "NZDCHF", "CADCHF", "GBPAUD"
    int numPairs = sizeof(pairs) / sizeof(string);

    // Loop through each currency pair
    for(int i = 0; i < numPairs; i++) 
    {
        asset(pairs[i]);
        vars ClosePrices = series(priceClose());

        // Prepare binary representations for XOR operation
        int length = LookBack;
        int binaryPriceX[length];
        int binaryPriceY[length];

        // Fill binary representations (example: comparing current prices with a moving average)
        ConvertToBinary(ClosePrices, binaryPriceX, length);
        ConvertToBinary(series(SMA(ClosePrices, 20)), binaryPriceY, length); // 20-period SMA for comparison

        // Perform XOR operation
        int xorResult[length];
        XORBinaryLists(binaryPriceX, binaryPriceY, xorResult, length);

        // Find Maximum XOR value
        int max_xor = FindMaximumXOR(xorResult, length);

        // Example trading logic based on Maximum XOR
        if(max_xor == 1) // Significant divergence detected
            enterLong();
        else
            exitLong();
    }
}

void ConvertToBinary(vars priceData, int* binaryRepresentation, int length) 
{
    int i;
    for(i = 0; i < length; i++) 
    {
        binaryRepresentation[i] = (priceData[i] > priceData[0]) ? 1 : 0;
    }
}

void XORBinaryLists(int* list1, int* list2, int* result, int length) 
{
    int i;
    for(i = 0; i < length; i++) 
    {
        result[i] = list1[i] ^ list2[i];
    }
}

int FindMaximumXOR(int* xorResult, int length) 
{
    int max_xor = 0;
    for(int i = 0; i < length; i++) 
    {
        if(xorResult[i] > max_xor) 
            max_xor = xorResult[i];
    }
    return max_xor;
}


Thank you to the Team of Zorro Trader, who have inspired my life.

Last edited by TipmyPip; 12/15/23 16:29.

ZorroTraderGPT - https://bit.ly/3Gbsm4S