Files
xMQL5/BKPS/14030223/Documents/LongMethods/1.md
T
2024-05-17 21:12:22 +03:30

8.3 KiB

//
// XCHMA Commonly Used Calculations ...

//
// XCHMA Check LC State ...
bool isLCFastOverSlow = XCHMAIsLCFastOverSlow(1);
bool isLCFastUnderSlow = XCHMAIsLCFastUnderSlow(1);

//
// XCHMA Check MC State ...
bool isLMFastOverSlow = XCHMAIsMCFastOverSlow(1);
bool isMCFastUnderSlow = XCHMAIsMCFastUnderSlow(1);

//
double isSCFastCrossedOverSlow = XCHMAIsSCFastCrossedOverSlow(1);

//
// XCHMA Min/Max MC/LC ...
//
// Candle 1 ...
//
// MIN ...
double minLCMC1 = XCHMAGetMinMCLCValue(1);

//
// MAX ...
double maxLCMC1 = XCHMAGetMaxMCLCValue(1);

//
// Candle 2 ...
//
// MIN ...
double minLCMC2 = XCHMAGetMinMCLCValue(2);

//
// MAX ...
double maxLCMC2 = XCHMAGetMaxMCLCValue(2);

//
// Max SC Fast Value ...
double maxSCFast = XCHMAGetSCFastMaxInLoopback(xMAPNumberOfItemsPerTick);
double maxSCSlow = XCHMAGetSCSlowMaxInLoopback(xMAPNumberOfItemsPerTick);

//
// Max MC Fast Value ...
double maxMCFast = XCHMAGetMCFastMaxInLoopback(xMAPNumberOfItemsPerTick);
double maxMCSlow = XCHMAGetMCSlowMaxInLoopback(xMAPNumberOfItemsPerTick);

//
// Max SC Fast Value ...
double maxLCFast = XCHMAGetLCFastMaxInLoopback(xMAPNumberOfItemsPerTick);
double maxLCSlow = XCHMAGetLCSlowMaxInLoopback(xMAPNumberOfItemsPerTick);

//
// XCHLH Verifications ...
//
bool isLCMCHHSame = XCHLHIsSameLCMCHH(1);
bool isLCMCHHSameInPast = XCHLHIsLCMCHHSameInLoopback(xCHLHScLength);

//
bool isLCMCLLSame = XCHLHIsSameLCMCLL(1);
bool isLCMCLLSameInPast = XCHLHIsLCMCLLSameInLoopback(xCHLHScLength);

//
bool isMCSCHHSame = XCHLHIsSameMCSCHH(1);
bool isMCSCHHSameInPast = XCHLHIsMCSCHHSameInLoopback(xCHLHScLength);

//
bool isMCSCLLSame = XCHLHIsSameMCSCLL(1);
bool isMCSCLLSameInPast = XCHLHIsMCSCLLSameInLoopback(xCHLHScLength);

//
double xCHLHLCDiff1 = XCHLHGetLCDiff(1);
double xCHLHMCDiff1 = XCHLHGetMCDiff(1);

//
// XCHMA Max LC MC Verify in Up Tredns ...
bool isLCMCMaxVerified =
    isLCFastOverSlow &&
            isLMFastOverSlow
        ? xCHMAMcFastBuffer[1] < maxMCFast &&
              xCHMALcFastBuffer[1] < maxLCFast
        : true;

//
// XCHMA MC/LC Verification ...
bool isMCLCVerified =
    //
    // Check MC or LC is Trens Up for Paste 3 Candle ...
    (
        //
        (xCHMAMcFastBuffer[1] > xCHMAMcSlowBuffer[1]) ||
        (xCHMALcFastBuffer[1] > xCHMALcSlowBuffer[1])
        //
        ) &&
    (
        //
        (xCHMAMcFastBuffer[2] > xCHMAMcSlowBuffer[3]) ||
        (xCHMALcFastBuffer[2] > xCHMALcSlowBuffer[3])
        //
        ) &&
    (
        //
        (xCHMAMcFastBuffer[3] > xCHMAMcSlowBuffer[3]) ||
        (xCHMALcFastBuffer[3] > xCHMALcSlowBuffer[3])
        //
        ) &&
    //
    // Check SC Fast Over LC Slow and LC Fast ...
    xCHMAScFastBuffer[1] > xCHMALcFastBuffer[1] &&
    xCHMAScFastBuffer[1] > xCHMALcSlowBuffer[1]
    //
    && isLCMCMaxVerified;
;

//
double signalSlope = GetSlope(2, 1, xTDSignalBuffer);
double bearishSlope = GetSlope(2, 1, xTDBearishBuffer);
double bullishSlope = GetSlope(2, 1, xTDBullishBuffer);

//
double bullishSlopeOnCross = 0;
int bullishCrossOverBearishCount = XTDCountBullOverBearCrossesInLoopback(xMAPNumberOfItemsPerTick);
if (bullishCrossOverBearishCount > 0)
{
    //
    int bullOverBearCrossIndex = XTDFindBullOverBearCrossIndexInLoopback(xMAPNumberOfItemsPerTick);
    if (bullOverBearCrossIndex > -1)
    {
        bullishSlopeOnCross = GetSlope(bullOverBearCrossIndex + 1, bullOverBearCrossIndex, xTDBullishBuffer);
    }
}

//
// Check MA States and LH States ...
bool isLCUp = XCHMAIsLCFastOverSlow(1);
bool isMCUp = XCHMAIsMCFastOverSlow(1);
bool isSCUp = XCHMAIsSCFastOverSlow(1);
bool isSameMCLCHH = XCHLHIsSameLCMCHH(1);
bool isSameSCMCHH = XCHLHIsSameMCSCHH(1);
bool isSCHHIncreaded = XCHLHIsLCHHInreasedInLoopback(xMAPNumberOfItemsPerTick);
bool isSCLLIncreaded = XCHLHIsLCLLInreasedInLoopback(xMAPNumberOfItemsPerTick);
double lcDiff = xCHLHLcHHBuffer[1] - xCHLHLcLLBuffer[1];
double mcDiff = xCHLHMcHHBuffer[1] - xCHLHMcLLBuffer[1];
double scDiff = xCHLHScHHBuffer[1] - xCHLHScLLBuffer[1];
//
// Gholleh ...
bool isInPeak =
    //
    isLCUp
    //
    &&
    //
    isMCUp
    //
    &&
    //
    isSCUp
    //
    &&
    //
    isSCHHIncreaded
    //
    &&
    //
    isSCLLIncreaded
    //
    &&
    //
    lcDiff > mcDiff * 2 && mcDiff > scDiff * 1.3
    //
    ;

//
// Darreh ...
bool isInVale = 
//
// Check XTD Vales ...

// lcDiff > mcDiff * 2 && mcDiff > scDiff * 1.3
//
;
















//
// Method 1
// this Method works Based On SC Cycle and Get Verifications from Others ...
bool isMethod1HasSignal =
    //
    // Check LC Fast Cross Over SC Slow ...
    xCHMAScFastBuffer[1] > xCHMAScSlowBuffer[1] &&
    !(xCHMAScFastBuffer[2] > xCHMAScSlowBuffer[2]) &&
    //
    isMCLCVerified &&
    //
    !isLCMCHHSame &&
    !isLCMCHHSameInPast &&
    !isMCSCHHSame &&
    !isMCSCHHSameInPast;

//
// Method 1
// this Method works Based On SC Cycle and Get Verifications from Others ...
bool isMethod2HasSignal =
    //
    // Check LC Fast Over SC Slow ...
    xCHMAScFastBuffer[1] > xCHMAScSlowBuffer[1] &&
    xCHMAScFastBuffer[2] > xCHMAScSlowBuffer[2] &&
    //
    // Check Crosses Between SC Slow and minMCLC Value ...
    xCHMAScSlowBuffer[1] > minLCMC1 &&
    xCHMAScSlowBuffer[2] <= minLCMC2 &&
    //
    isMCLCVerified &&
    //
    !isLCMCHHSame &&
    !isLCMCHHSameInPast &&
    !isMCSCHHSame &&
    !isMCSCHHSameInPast
    //
    ;

//
// Method 3 ...
bool isMethod3HasSignal =
    //
    isSCFastCrossedOverSlow &&
    //
    xCHMAScFastBuffer[1] < maxLCMC1 &&
    //
    xCHMAScSlowBuffer[1] > minLCMC1 &&
    //
    xCHMAMcFastBuffer[1] <= xCHMALcFastBuffer[1] &&
    //
    isLCFastOverSlow &&
    //
    isLMFastOverSlow
    //
    ;

//
// Method 4 ...
// Using XCHLH in related to Crosses ...
bool isMethod4HasSignal =
    //
    isSCFastCrossedOverSlow &&
    //
    XCHMAIsSCFastUnderSlow(2) &&
    XCHMAIsSCFastUnderSlow(3) &&
    XCHMAIsSCFastUnderSlow(4) &&
    //
    !(
        //
        isMCFastUnderSlow &&
        isLCFastUnderSlow
        //
        ) &&
    //
    xCHMAScFastBuffer[1] < minLCMC1 &&
    //
    isLCMCLLSame &&
    //
    isMCSCLLSameInPast &&
    //
    xCHLHLCDiff1 > xCHLHMCDiff1 * 2 &&
    //
    (
        //
        xCHLHScHHBuffer[1] < xCHLHMcHHBuffer[1] &&
        xCHLHScLLBuffer[1] > xCHLHMcLLBuffer[1]
        //
        ) &&
    //
    !XCHLHIsMCHHDecreasedInLoopback(xMAPNumberOfItemsPerTick);
//
;

//
// Method 5 ...
bool isMethod5HasSignal =
    XCHMAIsMCFastCrossedOverSlow(1);

//
// Method 6 ...
bool isMethod6HasSignal =
    //
    // Signal Crossed Over Bearish ...
    XTDIsSignalCrossedOverBear(1)
    //
    &&
    //
    // Count Signal Crosses Not Big Than 1 ...
    XTDCountSignalOverBearCrossesInLoopback(xMAPNumberOfItemsPerTick) == 1
    //
    &&
    //
    // Check Slope of Signal Must be Greater tha Slope Of Bullish ...
    signalSlope > bullishSlope
    //
    &&
    //
    // Count Bull Cross Over Bear items Bigger than 0 ...
    bullishCrossOverBearishCount > 0
    //
    &&
    //
    // Check Signal Slope in Compare with Bull Cross Over Bear Slop ...
    signalSlope > bullishSlopeOnCross
    //
    &&
    //
    // MC HH Not Decreased ...
    !XCHLHIsMCHHDecreasedInLoopback(xMAPNumberOfItemsPerTick)
    //
    &&
    //
    !isInPeak
    //
    &&
    //
    isLCUp
    //
    &&
    //
    isMCUp
    //
    ;