Home System Trading Post

Mastering Visual Order Processing with MetaTrader 4

Attachments
12096.zip (225.05 KB, Download 0 times)

Meet Order_EA, a straightforward visual tool that revolutionizes how we handle order processing in MetaTrader 4. This program leverages drag-and-drop scripts, making it easier than ever to manage your trades.

One of the standout features is that Take Profit and Stop Loss trend lines are managed from your local machine rather than the broker's server. This unique setup enables functionalities like "One Cancels Other" and allows for the automatic closure of the oldest trade without affecting all open trades.


I. Traditional MT4 Orders

  • A. Order Placement
    With MT4, traders can choose between Instant Execution or Pending Orders. You can set your Stop Loss and Take Profit with either method, and both can be adjusted using the graphical interface while the order is active. For Pending Orders, the broker monitors the trigger, executing the order once the price is reached.

  • B. Stop Loss
    There are two ways to set your Stop Loss: 1) fixed stop or 2) trailing stop. Trailing stops generally yield lower profits compared to other methods for closing trades. Fixed stops are a close second but require constant attention to follow market trends. Utilizing indicators like moving averages can help, but it demands continuous monitoring.
  • C. Take Profit
    More often than not, the Take Profit you set will miss the actual turning point, either being too low or just beyond the bounce point, leading to potential losses. Unfortunately, there’s no easy fix without vigilant monitoring of price action. Trailing Stops are an attempt to mitigate losses, but they often close trades prematurely due to frequent pull-backs.
  • D. Advantages
    This system relies on the broker's infrastructure, which means it's generally reliable, with minimal delays in execution.
  • E. Disadvantages
    However, keep in mind that your broker can see your Pending Orders, Stop Loss, and Take Profit values, which can lead to issues like Stop Losses being triggered unfairly. While this isn't a common problem, it's worth bearing in mind.

Even though your broker processes trades, always keep an eye on market conditions, pull-backs, and fundamental news that can impact your strategy. Some factors can't be programmed and require real-time intervention.


II. Software Controlled Orders

No fully automatic trading system can replicate the intuition and reasoning of a human trader. Even the most effective systems may falter due to changing market conditions, often entering trades poorly and resulting in minimal profit margins paired with significant stop-losses.

Several systems can alert you when key indicators align for a good entry point, but many rely on lagging signals like moving average crossovers. For example, a simple 200-EMA might work occasionally, but these systems often miss the best exit points.

This discussion outlines a method for placing and managing orders based on human reasoning and mathematical logic applied to current price action. While some indicators can help identify trends, none effectively draw trend lines that encapsulate market movements. Hence, the human mind—guided by experience, training, rules, and quality charting software—remains vital for pinpointing entry points and profit targets. These strategies have been effectively taught by Scott Barkley.

If you haven't received adequate training on planning trades, including entry points, targets, and Stop Loss adjustments, it might be best to stop here and seek out some foundational knowledge.

Now, let’s dive into the details of the software package.


III. Order Processing Software

This software package consists of two main components:

  1. An Expert Advisor that keeps tabs on your trades, and
  2. Scripts that can be dragged and dropped onto the chart for controlling the EA. This program emphasizes visual order manipulation instead of typing numbers into boxes, as is common in MetaTrader 4.

Input Parameters for Order_EA:

  • MagicNumber default (1125)
  • Lot default (0.05): This is the size of each lot for order entry, based on standard lots.
  • TakeProfitPip default (60): This can be customized for each currency pair.
  • StopLossPip default (60): This can also be customized for each currency pair.
  • EnableTS default (True): Setting this to "true" allows the first Take Profit line hit to convert into a Trailing Stop line. Only one Trailing Stop is allowed at a time, and it adjusts based on price movements.

Expert Advisor: Order_EA

This EA operates in the background for every currency pair you choose to trade. Each parameter can be tailored to the specific currency linked to the EA. It utilizes lines placed on the chart by the included scripts. When the current price touches a line, the designated action is executed. Note that this method might be slower than when a broker manages order entry, Stop Loss, or Take Profit, and slippage can occur. For optimal performance, your computer needs to be active and running the charts.

Despite this, an EA can significantly enhance your typical trading experience. For instance, allowing the trigger line to slope with the trend can optimize trading outcomes. If you place an order above the current price and another below, it creates a "One Cancels Other" scenario, where the first line hit will cancel out all opposite orders, Take Profits, and Stop Losses.

Stop Loss Processing for EA:

The Stop Loss line stays where it's manually placed unless defined way-points are set. Each time the current price reaches a specified way-point, the Stop Loss line advances to the previous way-point (or order entry) minus 4 pips. If the price passes each way-point by 4 pips, a new order will be placed along with an additional Stop Loss.

For Order_Fill_21 lines, the first Stop Loss advances 21 pips, and a new order (with Stop Loss) will be created. Stop Loss lines will trail in intervals of 4 pips behind the first Stop Loss. Without defined way-points or order fill lines, the Stop Loss will remain fixed. However, a diagonal Stop Loss can be created using a moving average or trend line, effectively functioning as a Trailing Stop.

Remember, the first Stop Loss encountered by the price action will result in the closure of the oldest order. This process continues until the last Stop Loss is hit, at which point all remaining orders will be closed. If only one Stop Loss line exists, all orders will close upon hitting that line. In contrast, the MetaTrader 4 Stop Loss line is horizontal and will close all trades when triggered.

Visual Order Processing MetaTrader 4


Take Profit Processing for EA:

The Take Profit line isn't a hard stop like the traditional MT4 take-profit, which closes all trades simultaneously. Users of Order_EA have two options: 1) If EnableTS is set to "true" (default), the following paragraphs detail TP action; 2) If EnableTS is "false," the EA will close the oldest order when the TP line is hit. The last TP line hit will close all remaining open orders.

With EnableTS set to true, the EA lets profits run until a 4-pip pull-back occurs, then it closes the oldest order first and subsequent orders according to their own Take Profit and/or Stop Loss settings. Orders must close in the order they were entered, but not all need to close simultaneously. The last Take Profit line hit will close all remaining orders.

When the price reaches 10 pips from the Take Profit line, it will convert to a Trailing Stop line, advancing to within 20 pips of the current price. The Trailing Stop line will move 2 pips for every pip the price advances until it is within 4 pips of the current price. This Trailing Stop remains active as the price surpasses the previous Take Profit line.

Only one Trailing Stop line is allowed at a time. All other Stop Loss and Take Profit lines will remain functional until the current Trailing Stop line is hit. After that, the next Take Profit line can trigger a new Trailing Stop. When the last Take Profit line is processed, all orders will be closed.

Scripts:

Each script needs to be dragged from the Navigator pane to the chart window and dropped at the appropriate location, as most scripts register where the left mouse button is released. Dropping above the current price indicates a "Buy," while dropping below indicates a "Sell." Buys are taken from the Ask price, while Sells are based on the Bid price.

  1. Order_Immediate:
    Drop the script above the current price for a Buy or below for a Sell, with the order entry price set to the current market price. A 60-pip Take Profit line and a 60-pip Stop Loss line are also created, which can be adjusted based on market movements. Note that these are trend lines, not horizontal lines, allowing for diagonal adjustments. Deleting either the Stop Loss or Take Profit line will hinder the software's functionality. Ensure to keep both lines present to avoid complications.
  2. Order_Pending:
    Just like Order_Immediate, drop this script above for a Buy or below for a Sell. The pending trade price is determined by where you drop the script, along with a newly created 60-pip Take Profit and Stop Loss line. Remember, these should also be trend lines. When the Order Entry line is triggered, an order will be placed. If either the Stop Loss or Take Profit line is deleted, the software won’t be able to execute the necessary actions.
  3. Order_Waypoint:
    Order_Waypoints should be placed between the current order entry line and the Take Profit line.
  4. Order_Close_Old:
    This script can be dropped anywhere on the chart to close the oldest order.
  5. Order_Close_All:
    Drop this script anywhere to close all open orders, as well as delete all Stop Loss and Take Profit lines.
  6. Order_SL:
    This script creates a horizontal Stop Loss line at the price where you release the left mouse button. It can be adjusted to set the desired Stop Loss condition, typically used when orders already exist.
  7. Order_TP:
    This script creates a horizontal Take Profit line at the release point of the left mouse button. Like Order_SL, it can be adjusted to set the desired Take Profit condition for existing orders.
  8. Order_Fill_21:
    Drop this script anywhere on the chart to create an order entry line every 21 pips from the last order price or Order Pending line up to the Take Profit line. Remember, this may put a strain on your margin account.

Related Posts

Comments (0)