Trend FM strategy

Trend FM strategy

// Entry conditions
bool isAboveSMAs = (Close > smaClose) && (Close > smaHigh) && (Close > smaLow);
bool isBelowSMAs = (Close < smaClose) && (Close < smaHigh) && (Close < smaLow);

// Get the previous daily high/low
double prevDailyHigh = iHigh(Symbol(), PERIOD_D1, 1);
double prevDailyLow = iLow(Symbol(), PERIOD_D1, 1);

// Check if the Parabolic SAR changes direction (swing point)
bool isSARUp = (parabolicSAR < Close );
bool isSARDown = (parabolicSAR > Close );

// Buy condition
if (isSARDown && isAboveSMAs && (Close > prevDailyHigh)) {
// Place a buy order
// OrderSend(...); // Your buy order logic
}

// Sell condition
if (isSARUp && isBelowSMAs && (Close < prevDailyLow)) {
// Place a sell order
// OrderSend(...); // Your sell order logic
}

Read More

Share:

Latest News