CODING

MQL5 Experts

Specification

// Expert Advisor Example for MT4

#include <Trade\Trade.mqh>

// Global Variables
int gi_44 = 0;
int gi_48 = 0;
int gi_52 = 0;
int gi_56 = 0;
double g_price_564 = 0.0;
double g_price_568 = 0.0;
double g_price_572 = 0.0;
double g_lots_588 = 0.0;

// Entry Point
void OnTick()
{
  // Define Variables
  int l_cmd_0;
  double l_price_4;

  // Get Last Order
  l_cmd_0 = OrderType();

  // Check if no order is open
  if (l_cmd_0 == OP_BUY || l_cmd_0 == OP_SELL)
    return;

  // Check if we are not in position
  if (PositionSelect(Symbol()))
  {
    if (PositionGetDouble(POSITION_TYPE) == POSITION_TYPE_BUY)
    {
      // Set Close Price for Buy Order
      l_price_4 = Bid;

      // Close Buy Order
      OrderClose(PositionTicket(), PositionLots(), l_price_4, 3);
    }
    else
    {
      // Set Close Price for Sell Order
      l_price_4 = Ask;

      // Close Sell Order
      OrderClose(PositionTicket(), PositionLots(), l_price_4, 3);
    }

    // Reset Global Variables
    gi_44 = 0;
    gi_48 = 0;
    gi_52 = 0;
    gi_56 = 0;
    g_price_564 = 0.0;
    g_price_568 = 0.0;
    g_price_572 = 0.0;
    g_lots_588 = 0.0;
  }
  else
  {
    // Set Lots for Order
    g_lots_588 = Lot;

    // Check if Buy Order should be placed
    if (gi_44 == 0)
    {
      // Place Buy Order
      gi_44 = OrderSend(Symbol(), OP_BUY, g_lots_588, Ask, 3, 0, 0, "My EA", 16388, 0, Green);
    }
    else if (gi_48 == 0)
    {
      // Place Buy Order
      gi_48 = OrderSend(Symbol(), OP_BUY, g_lots_588, Ask, 3, 0, 0, "My EA", 16388, 0, Green);
    }
    else if (gi_52 == 0)
    {
      // Place Buy Order
      gi_52 = OrderSend(Symbol(), OP_BUY, g_lots_588, Ask, 3, 0, 0, "My EA", 16388, 0, Green);
    }
    else if (gi_56 == 0)
    {
      // Place Buy Order
      gi_56 = OrderSend(Symbol(), OP_BUY, g_lots_588
// Check if Sell Order should be placed
if (gi_44 == 0)
{
  // Place Sell Order
  gi_44 = OrderSend(Symbol(), OP_SELL, g_lots_588, Bid, 3, 0, 0, "My EA", 16388, 0, Red);
}
else if (gi_48 == 0)
{
  // Place Sell Order
  gi_48 = OrderSend(Symbol(), OP_SELL, g_lots_588, Bid, 3, 0, 0, "My EA", 16388, 0, Red);
}
else if (gi_52 == 0)
{
  // Place Sell Order
  gi_52 = OrderSend(Symbol(), OP_SELL, g_lots_588, Bid, 3, 0, 0, "My EA", 16388, 0, Red);
}
else if (gi_56 == 0)
{
  // Place Sell Order
  gi_56 = OrderSend(Symbol(), OP_SELL, g_lots_588, Bid, 3, 0, 0, "My EA", 16388, 0, Red);
}

Responded

1
Developer 1
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Similar orders
I have a custom EA that works fine in the live market trading, but when doing a back test in the strategy tester , it does not open sell orders. There are no errors or warnings; it just doesn't open sell orders. I've checked every possible reason that might be the reason why it does not open sell orders, but I can't find anything, especially since it works fine in the real market and it opens both buys and sells
The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform
Hi, I have an indicator from my friend, I want to copy it to my own MT5 can you do that for me. Here is the link
I'm looking for someone to help me create an arbitrage trading robot that can trade on any decentralized exchange and forex market. I already have some source code to a strategy but would like to enhance it to make it profitable and automated
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
I have an EA and want to add few new logic to fetch profit taking factors and other values from an external master data and use it in existing EA
Hello Every one, Good day, I want from someone professional to create an EA is working on Mt5, This EA is working by depend on some indicators, and all those indicators must be working on MACD window, not on the chart, for more details please read my attached pdf file carefully. Many Thanks
I'm looking for an expert MQL5 developer that can create an EA that's based on my price action trading strategy with no indicators. The EA must analyze trades based on my price action rules, enter trades based on my price action rules, manage trades based on my price action rules and exit trades based on my price action rules
hi hi there i have an strategy on tradingview and i want to automate it like metatrader EA so i want the strategy to open and close trade automaticlly on tradingview
We are looking for an experienced Expert Advisor Developer who can build a customized MT5 Expert Advisor for us. The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform. Skills required: - Strong understanding of

Project information

Budget
30+ USD
For the developer
27 USD