• Attention Forex Brokers, FX Companies & Hedge Funds.

    forum.forex is available for Acquisition

    Enquire

Trend-Following EA with Technical Indicators and Risk Management

taseeer

Well-known member
The attached expert advisor is a trading algorithm for the EURCHF currency pair. It uses a variety of technical indicators to determine when to enter and exit trades, including the iWPR, iATR, iRSI, GetEFF, and GetMM indicators. The algorithm also uses a variety of risk management techniques, such as stop losses and take profits.

Here is a more detailed explanation of how the algorithm works:

  1. The algorithm first checks if the current day of the week is a Sunday or Friday. If it is, the algorithm will not trade, as these days are typically less volatile.
  2. If the current day of the week is not a Sunday or Friday, the algorithm will then check if the current hour is within the trading window. The trading window is defined by the StartHour and EndHour variables. If the current hour is within the trading window, the algorithm will then begin to analyze the technical indicators.
  3. The algorithm first calculates the iWPR indicator. The iWPR indicator is a momentum indicator that measures the strength of a trend. The algorithm then calculates the iATR indicator. The iATR indicator is a volatility indicator that measures the average true range of a currency pair over a specified period of time. The algorithm then calculates the iRSI indicator. The iRSI indicator is a momentum indicator that measures the strength of a trend relative to its recent price history. Finally, the algorithm calculates the GetEFF indicator. The GetEFF indicator is a trend filter that measures the strength of a trend relative to its recent price history.
  4. The algorithm then uses the values of the technical indicators to determine whether to enter a long or short trade. If the iWPR indicator is above a certain value and the iRSI indicator is above 50, the algorithm will enter a long trade. If the iWPR indicator is below a certain value and the iRSI indicator is below 50, the algorithm will enter a short trade.
  5. The algorithm also uses a variety of risk management techniques. The algorithm uses a stop loss to limit the amount of money that can be lost on a trade. The algorithm also uses a take profit to limit the amount of money that can be made on a trade.
  6. The algorithm finally checks if the current equity is greater than the gd_260 variable. If it is, the algorithm will close all of its trades and wait for the next day to trade.
 

Attachments

Back Strategy Tester Report
CueMaster_EA.png
 
Here is a more detailed explanation of the GetEFF and GetMM indicators:

  • The GetEFF indicator is a trend filter that measures the strength of a trend relative to its recent price history. The GetEFF indicator is calculated using the following formula:
GetEFF(ai_0, a_applied_price_4 = 0, ai_8 = 10, a_period_12 = 5, a_period_16 = 5, a_ma_method_20 = 0, ai_24 = 0)

where:

  • ai_0 is the current bar index
  • a_applied_price_4 is the applied price (0 for close price, 1 for open price, 2 for high price, 3 for low price, 4 for median price, 5 for typical price)
  • ai_8 is the period for the first moving average
  • a_period_12 is the period for the second moving average
  • a_period_16 is the period for the third moving average
  • a_ma_method_20 is the moving average method (0 for SMA, 1 for EMA, 2 for WMA)
  • ai_24 is the mode (0 for absolute value, 1 for percentage)
The GetEFF indicator returns a value between 0 and 100. A higher GetEFF value indicates a stronger trend.

  • The GetMM indicator is a trend filter that measures the strength of a trend relative to its recent price history. The GetMM indicator is calculated using the following formula:
GetMM(ai_0, int a_period_4, double ad_8, int ai_16)
where:

  • ai_0 is the current bar index
  • a_period_4 is the period for the moving average
  • ad_8 is the threshold value
  • ai_16 is the mode (0 for long, 1 for short, 2 for flat)
The GetMM indicator returns a value of 0, 1, or 2. A value of 0 indicates that the trend is up, a value of 1 indicates that the trend is down, and a value of 2 indicates that the trend is flat.
 
Back
Top Bottom