Voltra Trend Arrow (Non-Repaint) MetaTrader 5 Expert Advisor

Voltra Trend Arrow (Non-Repaint) is an Expert Advisor (EA) designed to automate trading decisions based on trend identification. It uses historical price data to calculate average high and low points over a set period and determines when to enter buy or sell trades based on these calculations. The EA operates without repainting, meaning that once it identifies a trend and places a trade, the signal remains unchanged, providing consistency in its execution. Built with risk management tools such as stop loss and take profit, the Voltra Trend Arrow focuses on automating trade entries and exits based on clear trend signals.

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   //--- initialization of data counting variables
   min_rates_total = int(iPeriod + iFullPeriods);
   
   //--- setting up memory for array
   ArrayResize(arr, min_rates_total);
   
   //--- name for display in a separate window and tooltip
   string shortname;
   StringConcatenate(shortname, "trend_arrows(", string(iPeriod), ", ", string(iFullPeriods), ", ", string(Shift), ")");
   IndicatorSetString(INDICATOR_SHORTNAME, shortname);
   
   //--- setting precision of indicator values
   IndicatorSetInteger(INDICATOR_DIGITS, _Digits);

   //--- set index buffers for EA decision making
   SetIndexBuffer(0, TrendUp, INDICATOR_DATA);
   SetIndexBuffer(1, TrendDown, INDICATOR_DATA);
   SetIndexBuffer(2, SignUp, INDICATOR_DATA);
   SetIndexBuffer(3, SignDown, INDICATOR_DATA);
   
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   // Perform necessary cleanup on deinitialization
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   int rates_total = Bars(_Symbol, _Period);
   if(rates_total < min_rates_total)
      return; // Not enough bars to calculate

   int limit = rates_total - min_rates_total - 1;

   //--- Iteration through bars
   for(int bar = limit; bar >= 0 && !IsStopped(); bar--)
     {
      // Reset signals
      TrendUp[bar] = 0.0;
      TrendDown[bar] = 0.0;
      SignUp[bar] = 0.0;
      SignDown[bar] = 0.0;
      
      // Calculate the average high and low for trend signals
      double HH = AverageHigh(High, Time, bar);
      double LL = AverageLow(Low, Time, bar);

      // Determine trend signals
      if(Close[bar] > HH)
        {
         TrendUp[bar] = LL;
         if(!TrendUp[bar+1])
           {
            SignUp[bar] = TrendUp[bar];
            ExecuteBuy(); // Place Buy order
           }
        }
      else if(Close[bar] < LL)
        {
         TrendDown[bar] = HH;
         if(!TrendDown[bar+1])
           {
            SignDown[bar] = TrendDown[bar];
            ExecuteSell(); // Place Sell order
           }
        }
      else
        {
         // Carry forward trend if conditions met
         if(TrendDown[bar+1]) TrendDown[bar] = HH;
         if(TrendUp[bar+1]) TrendUp[bar] = LL;
        }
     }
  }
//+------------------------------------------------------------------+
//| Execute Buy Order                                                |
//+------------------------------------------------------------------+
void ExecuteBuy()
  {
   double lot_size = 0.1; // Set your desired lot size
   double ask_price = NormalizeDouble(Ask, _Digits);
   double stop_loss = NormalizeDouble(Bid - 50 * _Point, _Digits);
   double take_profit = NormalizeDouble(Ask + 100 * _Point, _Digits);
   
   //--- Check if there are already open Buy orders
   if(OrdersTotal() == 0)
     {
      OrderSend(_Symbol, OP_BUY, lot_size, ask_price, 3, stop_loss, take_profit, "Buy order", 0, 0, clrBlue);
     }
  }
//+------------------------------------------------------------------+
//| Execute Sell Order                                               |
//+------------------------------------------------------------------+
void ExecuteSell()
  {
   double lot_size = 0.1; // Set your desired lot size
   double bid_price = NormalizeDouble(Bid, _Digits);
   double stop_loss = NormalizeDouble(Ask + 50 * _Point, _Digits);
   double take_profit = NormalizeDouble(Bid - 100 * _Point, _Digits);

   //--- Check if there are already open Sell orders
   if(OrdersTotal() == 0)
     {
      OrderSend(_Symbol, OP_SELL, lot_size, bid_price, 3, stop_loss, take_profit, "Sell order", 0, 0, clrRed);
     }
  }
//+------------------------------------------------------------------+
//| AverageHigh                                                      |
//+------------------------------------------------------------------+
double AverageHigh(const double &High[], const datetime &Time[], int index)
  {
   // Calculates the average high
   double hhv, ret = 0.0;
   int nbars = index, max = int(iPeriod + iFullPeriods);
   boolp1 = false;

   for(int iii = 0; iii < max; iii++)
     {
      while(!isDelimeter(Period(), Time, nbars)) nbars++;
      if(!boolp1) boolp1 = nbars;
      arr[iii] = nbars;
      nbars++;
     }
   
   for(int count = int(iPeriod-1); count > 0; count--)
     {
      hhv = High[ArrayMaximum(High, arr[count-1] + 1, arr[count] - arr[count-1])];
      ret += hhv;
     }
   
   // Final calculation
   return NormalizeDouble(ret / iPeriod, 0);
  }
//+------------------------------------------------------------------+
//| AverageLow                                                       |
//+------------------------------------------------------------------+
double AverageLow(const double &Low[], const datetime &Time[], int index)
  {
   // Calculates the average low
   double llv, ret = 0.0;
   int nbars = index, max = int(iPeriod + iFullPeriods);
   boolp1 = false;

   for(int iii = 0; iii < max; iii++)
     {
      while(!isDelimeter(Period(), Time, nbars)) nbars++;
      if(!boolp1) boolp1 = nbars;
      arr[iii] = nbars;
      nbars++;
     }
   
   for(int count = int(iPeriod-1); count > 0; count--)
     {
      llv = Low[ArrayMinimum(Low, arr[count-1] + 1, arr[count] - arr[count-1])];
      ret += llv;
     }

   // Final calculation
   return NormalizeDouble(ret / iPeriod, 0);
  }
//+------------------------------------------------------------------+
//| isDelimeter                                                      |
//+------------------------------------------------------------------+
bool isDelimeter(ENUM_TIMEFRAMES TimFrame, const datetime &Time[], int index)
  {
   // Checks for time frame delimiters
   MqlDateTime tm;
   TimeToStruct(Time[index], tm);

   switch(TimFrame)
     {
      case PERIOD_M1: return (tm.min == 0);
      case PERIOD_M5: return (tm.min % 5 == 0);
      case PERIOD_M15: return (tm.min % 15 == 0);
      case PERIOD_H1: return (tm.hour == 0 && tm.min == 0);
      case PERIOD_D1: return (tm.hour == 0 && tm.min == 0);
     }

   return false;
  }

What is the Voltra Trend Arrow EA?

At its core, the Voltra Trend Arrow EA is built to recognize upward and downward trends in the market by calculating average high and low prices over a specified period. When certain conditions are met, the EA will either place a buy or sell trade automatically. This eliminates the need for constant monitoring and manual execution of trades, providing users with a fully automated trading experience.

See also  Eternal Pro DayTrading (Non-Repaint) MT4 Expert Advisor

How Does the Voltra Trend Arrow Identify Trends?

The Voltra Trend Arrow looks at the high and low prices over a given period. By calculating the average high and average low, the EA determines the potential direction of the market:

  • Upward Trends: If the current closing price is higher than the calculated average high, the EA interprets this as a bullish (upward) trend.
  • Downward Trends: If the current closing price is lower than the calculated average low, it’s seen as a bearish (downward) trend.

When Does the EA Place a Trade?

The EA uses these trend signals to decide when to place a trade. Here’s how it works:

  • Buy Signal: When the EA detects an upward trend, it places a buy order at the Ask price. The stop loss and take profit levels are set based on predefined parameters to manage risk and potential rewards.
  • Sell Signal: Conversely, when a downward trend is identified, the EA places a sell order at the Bid price. The same logic applies for managing risk with stop loss and take profit values.

This fully automated process ensures that trades are executed immediately when market conditions meet the specified criteria, without the need for human intervention.

Key Components of the Voltra Trend Arrow EA

Trend Detection

The EA calculates the average high and average low prices over a defined period. These averages help determine whether the market is trending up or down. By comparing the current market price to these averages, the EA identifies whether a trend is forming and responds accordingly.

Order Execution

When the EA detects a trend, it places either a buy or sell order, depending on the direction of the trend. Here’s what happens:

  • Buy Order: If the market is moving up, the EA will place a buy order.
  • Sell Order: If the market is moving down, the EA will initiate a sell order.
See also  Zylor Harami Premium V2.1 (Non-Repaint) MT 5 Indicator

For each trade, the EA also automatically sets a stop loss to limit potential losses and a take profit to lock in gains once the market moves favorably.

Risk Management

Proper risk management is essential for any trading system. The Voltra Trend Arrow EA includes built-in stop loss and take profit parameters. These help ensure that each trade is managed to control losses while maximizing potential gains. These settings can be adjusted to suit individual trading preferences, such as increasing or decreasing the distance between the entry price and the stop loss or take profit.

Time Frame Detection

The EA is designed to work with multiple time frames by identifying delimiters in the time series. In simple terms, it can adapt to different trading periods like minutes, hours, or days and adjust its calculations accordingly. This flexibility allows the EA to function across various trading strategies, whether it’s scalping on shorter time frames or position trading on longer ones.

How Does the Voltra Trend Arrow Handle Market Data?

The EA is designed to efficiently process and analyze real-time market data. Each time the market price updates (referred to as a tick), the EA recalculates the trends based on the latest data. This is done by reading price arrays such as the high, low, and close values from past candles (bars).

For instance, when a new tick comes in, the EA:

  1. Checks if there are enough data points to perform the trend calculation.
  2. Recalculates the average highs and lows.
  3. Determines whether the current price is higher or lower than these averages.
  4. Places a trade if the conditions are met.
See also  KI Nest Wave (Non-Repaint) MetaTrader 4 Expert Advisor

This entire process repeats with each new tick, allowing the EA to constantly adapt to changing market conditions.

Flexibility and Customization

The Voltra Trend Arrow EA comes with several customizable settings, which allow traders to tailor it to their individual strategies:

  • Period: You can define the number of bars the EA uses to calculate the average high and low.
  • Full Periods: Another setting that fine-tunes how many periods the EA should consider for trend detection.
  • Shift: This setting allows you to shift the indicator horizontally on the chart, which can be useful for backtesting and visual analysis.

These parameters make the EA flexible enough to suit a wide variety of trading styles and preferences.

Efficient Execution and Performance

The Voltra Trend Arrow EA is optimized for efficient performance. It only recalculates trend signals when necessary, ensuring minimal lag in execution. The EA also handles the data in time series format, which means that the most recent price data is always at the forefront of its calculations. This makes it well-suited for fast-moving markets where every tick matters.

Conclusion

The Voltra Trend Arrow EA provides a streamlined and automated way of executing trades based on clear trend signals. By focusing on price action and using average highs and lows to determine trends, it offers a systematic approach to trading. Although it does not guarantee profit (as no system does), its clear rules and automation make it a useful tool for traders who want to simplify their decision-making process and take emotion out of trading.

This EA allows users to focus on strategy rather than manual execution, and its built-in risk management tools help keep trading within safe limits. While it doesn’t claim to provide superior results, the Voltra Trend Arrow is an example of how automation can be applied effectively to the trading process.

Leave a Comment