Fan sayfamıza katılın
Öyleyse bir link gönderin -
başkalarının da faydalanmasını sağlayın
Visual Order Processing - MetaTrader 4 için Uzman Danışman
- Görüntülemeler:
- 36069
- Derecelendirme:
- Yayınlandı:
- 2015.01.19 11:31
- Güncellendi:
- 2016.11.22 07:32
- Bu koda dayalı bir robota veya göstergeye mi ihtiyacınız var? Freelance üzerinden sipariş edin Freelance'e git
Order_EA is a simple visual oriented program that uses drag & drop scripts to control order processing.
Take Profit and Stop Loss trend lines are controlled by the local computer - not the broker's computer.
This allows features like "One cancels other" and automatic closing of the oldest trade without closing all open trades.
I. Traditional MT4 Orders
- A. Order Placement
MT4 allows either Instant Execution or Pending Order. Stop Loss, and Take Profit can be entered with either type of order placement. Pending Orders, Stop Loss, and Take Profit can then be manipulated with the graphical interface during the life of the order.
For a Pending Order, the order is monitored by the broker's computer and is placed when the order price is hit. - B. Stop Loss
Stop Loss can be entered in two different ways: 1) a fixed stop, or 2) a trailing stop. A trailing stop will almost always generate less income than almost any other method for closing an order. Fixed stops come in as a close second because they must be watched to follow the current market movements. A moving average (or some other indicator) can be followed manually to keep the order in play as long as possible. Having mathematical points along the trend line to mark places for the fixed Stop Loss often works out best. Unfortunately, this requires constant monitoring. - C. Take Profit
Any Take Profit entered will probably be wrong. It will be way short of the actual turning point or will be a bit beyond the bounce point and the trade will turn back for a loss. There is no easy solution to this problem without constant monitoring of the price action. Trailing Stops have been implemented to try and prevent a runaway loss. Unfortunately, pull-backs happen with almost every price movement and a Trailing Stop will probably close the trade too soon. - D. Advantages
This system relies on the broker's computer and is always up and running. Delay time is very small and prices are most often executed within a fraction of a pip. - E. Disadvantages
The broker's computer can see your Pending Order, Stop Loss, and Take Profit values and possibly "reach" for the value you have entered. This most often shows up when a Stop Loss is hit while the actual price is still far away. So many people have complained over the years that this is seldom a real problem.
Even though the broker's computer processes each trade you have placed, their system requires constant monitoring to take into consideration the current "road map", pull-backs, flags, fundamental announcements, and so on.
Even things that are foreknown cannot be programmed but must be manually entered as they happen.
II. Software Controlled Orders
There is no such thing as a fully automatic trading system for your home computer that can work as well as the human brain. Even those that work well for a short time will fail due to changes in market conditions. Almost all automatic systems enter at the wrong time and provide a very small profit along with a huge stop-loss.
Several systems are available to alert the user when a group of indicators align to produce a good entry point. Most of these systems rely on moving average crossovers. The simple 200-EMA is one example that sometimes works. Unfortunately, these systems are late in identifying the entry point and will totally miss the exit point.
Therefore, this paper is to document a system of placing and maintaining orders generated from human reasoning and mathematical points generated by applying human logic to the current price action. While some indicators are helpful in counting waves (such as zig-zag & MACD), software implementation of these methods often fail to generate the correct waves. Some indicators can display the current trend as either up or down but none can correctly draw trend lines bracketing the movement.
Thus, the human brain, guided by experience, training, rules, and proper charting software designed to produce easy to visualize trend, flags, channels, and so on can identify entry points, way points, and targets for the successful generation of pips & profit. These are trading strategies taught by Scott Barkley.
If you have not had the proper training to plan a trade, including entry point, targets, and stop loss movement – you have already read too far, close this document and try something else.
What follows is a description of this software package.
III. Order Processing Software
This package consists of two parts:
- an Expert Adviser that monitors trades, and
- scripts that can be dragged and dropped onto the chart to control the EA. This program relies on visual order manipulation – not numbers typed into a box as with MetaTrader 4.
Input Parameters for Order_EA:
- MagicNumber default(1125)
- Lot default (0.05): The size of each lot for order entry. Lot size is based on standard lots.
- TakeProfitPip default(60) This value may be changed for each currency pair.
- StopLossPip default(60) This value may be changed for each currency pair.
- EnableTS default(True) A value of "true" allows the first Take Profit line hit to be converted into a Trailing Stop line. Only one Trailing Stop is available at a time. When the current price is 10 pips back from the Take Profit line, a Trailing Stop is created 20 pips back from the current price. Each pip the price advances, the Trailing Stop is advanced 2 pips, until within 4 pips of the current price. A value of "false" disables this feature and the Take Profit line reverts to a hard stop.
Expert Advisor: Order_EA
This program can run in the background for every currency pair you wish to trade.
Each of the parameters can be customized for the currency pair associated with the EA. This EA is driven from the lines placed on the chart by the included scripts. When the current price touches a line, the requested action will be taken. Note that this process is slower than when a broker is keeping track of the order entry, stop loss, or take profit. There may be some slippage. Also, for this system to function, your computer must be running with the charts up and active.
That said, an EA can enhance normal trading beyond services provided by the broker. The following list of services show how a few simple changes, such as allowing the trigger line to slope (follow a trend), can enhance the trading experience. As another example; when an order is placed above the current price and another order is placed below the current price, a "One Cancels Other" situation is created. The first line hit deletes all Orders, Take Profit, and Stop Loss lines in the opposite direction.
Stop Loss processing for EA:
The Stop Loss line will remain where manually placed unless a set of way-points are provided. Or, unless the Order_Fill_21 lines are set. Each time the current price reaches a defined way-point, the Stop Loss line will advance to the previous way-point (or order entry) minus 4 pips. When the current price passes each way-point by 4 pips, a new order will be entered along with an additional Stop Loss.
For Order_Fill_21 lines, the first Stop Loss is advanced 21 pips and a new order (with Stop Loss) is entered. Stop Loss lines trail in a string at 4 pip intervals behind the lead (first) Stop Loss. Without way-points or order fill lines, the Stop Loss will not be automatically moved. However, the fixed Stop Loss can be a diagonal line following a moving average or trend line, in effect, creating a "Trailing Stop".
Note that the first Stop Loss encountered by the pair's price action will cause the OLDEST order entry to be closed. This sequence will continue until the last Stop Loss is encountered, at which time ALL remaining orders are closed. If there is only one Stop Loss line, all orders will be closed when the line is hit. The MetaTrader 4 Stop Loss line is horizontal and will close all open trades when hit.
Take Profit processing for EA:
The Take Profit line is not an absolute hard stop as it is when a take-profit line is defined to MetaTrader 4. First off, the MT4 take-profit closes all open trades at the same time. Two options are available to Order_EA users: 1) If EnableTS is set to "true" (default), the following paragraphs describe TP action, 2) If EnableTS is set to "false", Order_EA will will close the oldest order when the TP line is hit. The last TP line encountered will close all remaining open orders.
With EnableTS set to true, Order_EA will let the profit run until a 4-pip pull-back is encountered. Then, the oldest order entry will be closed first followed by subsequent orders respecting their own Take Profit and/or Stop Loss lines. Orders must be closed in the order entered but they do not all have to be closed at the same time. The last Take Profit line hit will close all remaining orders.
When the current price reaches 10-pips from the Take Profit line, the Take Profit line will be converted to a Trailing Stop line and will advance to within 20-pips of the current price. The Trailing Stop line will advance 2-pips for every pip price action advances – until the Trailing Stop is within 4-pips of the current price. The Trailing Stop line will remain within 4-pips of the current price, even as the current price advances well beyond the old Take Profit line.
There is only one Trailing Stop line. All remaining Stop Loss and Take Profit lines remain in play until the current Trailing Stop line is taken out by price action. Then the next Take Profit line can create a Trailing Stop. When the last Take Profit line has been processed, all orders are closed.
Scripts:
Each script needs to be drug (with the left-mouse-button) from the Navigator pane to the chart window and dropped at the proper location as most of the scripts record where the left-mouse-button was released. A drop above the current price indicates a "Buy" whereas a drop below the current price is a "Sell". Buys are taken from the Ask price quoted by the broker. Sells are taken relative to the Bid price.
- Order_Immediate:
Drop the script above the current price to create a Buy or below the current price to create a Sell. The order entry price is the current market price. From that value, a 60-pip Take Profit line and a 60-pip Stop Loss line are also created. Either of these two lines may be moved to reflect current market conditions. 60-pips was selected to prevent either the Stop Loss or Take Profit lines from being hit before they can be moved to the correct (calculated) positions.
Note that these are "trend lines", not horizontal lines. Thus, by grabbing either of the end points, the line may be moved to create a diagonal Single Line Trend Line. Deleting either the Stop Loss line or the Take Profit line will prevent this software from taking proper action. Deleting the Order Entry line without deleting both the Stop Loss and Take Profit lines may create a problem. The Order_Fill_21 script requires the Take Profit line to be present. Also, Order_EA requires the Take Profit line to be present to allow movement of the Stop Loss line close to the target price. However, if the Stop Loss line has been deleted, the trade is at risk for a huge loss as a trailing stop will not be created.
If the immediate order is not accepted, the Stop Loss and Take Profit lines will not be created. Reasons for rejection of the order might be that a buy was ask for when a sell already exists. Check the "Journal" tab in the Terminal window to see the reason for rejection. - Order_Pending:
Drop the script above the current price to create a Buy or below the current price to create a Sell. The price for the pending trade is determined by the location of the script drop. From that value, a 60-pip Take Profit line and a 60-pip Stop Loss line are also created. Any of these lines may be moved to reflect current market conditions.
Note that these are "trend lines", not horizontal lines. Thus, by grabbing either of the end points, the line may be moved to create a diagonal "Single Line Trend Line". When the Order Entry line (red=sell, green=buy) is hit, an order is created. In the above example, the sell line runs parallel to the bull-flag being built and will trigger a sell order when price action drops below the sell line.
Deleting either the Stop Loss line or the Take Profit line will prevent this software from taking the associated action. Deleting the Order Entry line without deleting both the Stop Loss and Take Profit lines simply leaves garbage on the screen. The Order_Fill_21 script requires both the Order Entry and the Take Profit lines to be present. Also, Order_EA requires the Take Profit line to be present to move allow creation and movement of the Trailing Stop line close to the target price. However, if all Stop Loss lines are deleted, the trade is at risk for a huge loss.
- Order_Waypoint:
Order_Waypoints are to be dropped between the current order entry line and the Take Profit line. (Not implemented as of 1 December 2014)
- Order_Close_Old:
The Order_Close_Old script may be dropped anywhere on the chart window as the exact location is not important. This script will cause the oldest order to be closed. - Order_Close_All:
The Order_Close_All script may be dropped anywhere on the chart window as the exact location is not important. This script will cause all open orders to be closed. All Stop Loss, Take Profit, and Buy/Sell lines will also be deleted. - Order_SL:
A horizontal Stop Loss line will be created at the price where the left-mouse-button is released. This line may be moved and rotated as necessary to create the desired Stop Loss condition. This script is mostly used when orders already exist and a Stop Loss needs to be attached to the order. Caution: placed on the wrong side of the current price, this script will cause the order to be immediately closed. - Order_TP:
A horizontal Take Profit line will be created at the price where the left-mouse-button is released. This line may be moved and rotated as necessary to create the desired Take Profit condition. This script is mostly used when orders already exist and a Take Profit needs to be attached to the order. Caution: placed on the wrong side of the current price, this script will cause the order to be immediately closed. - Order_Fill_21:
The Order_Fill_21 script may be dropped anywhere on the chart. This script will create an order entry line every 21-pips from either the latest order price or Order Pending line up to the Take Profit line. These lines may be moved or deleted as necessary. If calculations for the Take Profit line are accurate, the last order entry line should be deleted. Also, keep in mind the excessive hit this feature can cause to the margin account. Changing each horizontal line to a trend line may not be a good idea.
Each Order Fill line creates a new order when hit along with a horizontal Stop Loss line 4-pips back from the previous (last) Stop Loss line. All Stop Loss lines are then advanced by 21-pips. Thus the chart shows a series of orders spaced every 21-pips followed by a series of Stop Loss lines with a 4-pip separation. (Not implemented as of 1 December 2014).
Draws two labels: Open-Close and High-Low range of the last closed candle left of the current candle.
Vertical Time LinesPossible uses: Mark session open/close, mark time of regular news release, any other relevant time.
This Expert Advisor is based on one of 17 Proven Currency Strategies by Mario Singh.
TrailingThe Expert Advisor can be used for Trailing and hidden Take Profit/Stop Loss.