Visual Order Processing – expert for MetaTrader 4

0
(0)
Views:
2612
Rating:



votes: 7

order_expert.zip
(225.eighty three KB)

Description:

Order_EA is an easy visible oriented program that makes use of drag & drop scripts to regulate order processing.

Take Profit and Stop Loss development strains are managed by the native pc - not the dealer's pc.

This permits options like "One cancels different" and automated closing of the oldest commerce with out closing all open trades.

I. Traditional MT4 Orders

  • A. Order Placement

    MT4 permits both Instant Execution or Pending Order. Stop Loss, and Take Profit may be entered with both sort of order placement. Pending Orders, Stop Loss, and Take Profit can then be manipulated with the graphical interface in the course of the lifetime of the order.
    For a Pending Order, the order is monitored by the dealer's pc and is positioned when the order worth is hit.
  • S. Stop Loss

    Stop Loss may be entered in two alternative ways: 1) a hard and fast cease, or 2) a trailing cease. A trailing cease will virtually all the time generate much less revenue than virtually another technique for closing an order. Fixed stops are available as an in depth second as a result of they have to be watched to comply with the present market actions. A shifting common (or another indicator) might be adopted manually to maintain the order in play so long as potential. Having mathematical factors alongside the development line to mark locations for the fastened Stop Loss typically works out greatest. Unfortunately, this requires fixed monitoring.
  • A. Take Profit

    Any Take Profit entered will in all probability be incorrect. It will probably be method brief of the particular turning level or can be a bit past the bounce level and the commerce will flip again for a loss. There is not any straightforward answer to this drawback with out fixed monitoring of the worth motion. Trailing Stops have been carried out to attempt to forestall a runaway loss. Unfortunately, pull-backs occur with virtually each worth motion and a Trailing Stop will in all probability shut the commerce too quickly.
  • A. Advantages

    This system depends on the dealer's pc and is all the time up and operating. Delay time could be very small and costs are most frequently executed inside a fraction of a pip.
  • W. Disadvantages

    The dealer's pc can see your Pending Order, Stop Loss, and Take Profit values and probably "attain" for the worth you could have entered. This most frequently exhibits up when a Stop Loss is hit whereas the precise worth continues to be distant. So many individuals have complained through the years that that is seldom an actual drawback.

Even although the dealer's pc processes every commerce you've gotten positioned, their system requires fixed monitoring to take into accounts the present "street map", pull-backs, flags, elementary bulletins, and so forth.

Even issues which are foreknown can't be programmed however have to be manually entered as they occur.

II. Software Controlled Orders

There is not any such factor as a totally automated buying and selling system in your residence pc that may work in addition to the human mind. Even people who work nicely for a short while will fail as a result of modifications in market circumstances. Almost all automated techniques enter on the incorrect time and supply a really small revenue together with an enormous cease-loss.

Several techniques can be found to alert the consumer when a gaggle of indicators align to supply a superb entry level. Most of those techniques depend on shifting common crossovers. The easy 200-EMA is one instance that typically works. Unfortunately, these methods are late in figuring out the entry level and can completely miss the exit level.

Therefore, this paper is to doc a system of putting and sustaining orders generated from human reasoning and mathematical factors generated by making use of human logic to the present worth motion.  While some indicators are useful in counting waves (reminiscent of zig-zag & MACD), software program implementation of those strategies typically fail to generate the right waves. Some indicators can show the present development as both up or down however none can appropriately draw development strains bracketing the motion.

Thus, the human mind, guided by expertise, coaching, guidelines, and correct charting software program designed to supply straightforward to visualise development, flags, channels, and so forth can determine entry factors, means factors, and targets for the profitable era of pips & revenue. These are buying and selling methods taught by Scott Barkley.

If you haven't had the right coaching to plan a commerce, together with entry level, targets, and cease loss motion – you have got already learn too far, shut this doc and check out one thing else.

What follows is an outline of this software program package deal.

III. Order Processing Software

This package deal consists of two elements:

  1. an Expert Adviser that screens trades, and
  2. scripts that may be dragged and dropped onto the chart to regulate the EA. This program depends on visible order manipulation – not numbers typed right into a field as with MetaTrader 4.

Input Parameters for Order_EA:

  • MagicNumber default(1125)
  • Lot default (0.05): The measurement of every lot for order entry.  Lot measurement is predicated on normal tons.
  • TakeProfitPip default(60) This worth could also be modified for every foreign money pair.
  • StopLossPip default(60) This worth could also be modified for every foreign money pair.
  • EnableTS default(True) A worth of "true" permits the primary Take Profit line hit to be transformed right into a Trailing Stop line. Only one Trailing Stop is on the market at a time. When the present worth is 10 pips again from the Take Profit line, a Trailing Stop is created 20 pips again from the present worth. Each pip the worth advances, the Trailing Stop is superior 2 pips, till inside 4 pips of the present worth. A worth of "false" disables this function and the Take Profit line reverts to a tough cease.

Expert Advisor: Order_EA

This program can run within the background for each foreign money pair you want to commerce.

Each of the parameters may be custom-made for the foreign money pair related to the EA. This EA is pushed from the strains positioned on the chart by the included scripts. When the present worth touches a line, the requested motion shall be taken. Note that this course of is slower than when a dealer is maintaining monitor of the order entry, cease loss, or take revenue. There could also be some slippage. Also, for this technique to perform, your pc have to be operating with the charts up and lively.

That stated, an EA can improve regular buying and selling past providers offered by the dealer. The following record of providers present how a number of easy modifications, corresponding to permitting the set off line to slope (comply with a development), can improve the buying and selling expertise. As one other instance; when an order is positioned above the present worth and one other order is positioned under the present worth, a "One Cancels Other" state of affairs is created. The first line hit deletes all Orders, Take Profit, and Stop Loss strains in the other way.

Stop Loss processing for EA:

The Stop Loss line will stay the place manually positioned until a set of method-factors are offered. Or, until the Order_Fill_21 strains are set. Each time the present worth reaches an outlined approach-level, the Stop Loss line will advance to the earlier method-level (or order entry) minus 4 pips. When the present worth passes every means-level by 4 pips, a brand new order might be entered together with a further Stop Loss.

For Order_Fill_21 strains, the primary Stop Loss is superior 21 pips and a brand new order (with Stop Loss) is entered.  Stop Loss strains path in a string at 4 pip intervals behind the lead (first) Stop Loss. Without means-factors or order fill strains, the Stop Loss won't be mechanically moved.  However, the fastened Stop Loss is usually a diagonal line following a shifting common or development line, in impact, making a "Trailing Stop".

Note that the primary Stop Loss encountered by the pair's worth motion will trigger the OLDEST order entry to be closed. This sequence will proceed till the final Stop Loss is encountered, at which era ALL remaining orders are closed. If there is just one Stop Loss line, all orders can be closed when the road is hit. The MetaTrader 4 Stop Loss line is horizontal and can shut all open trades when hit.

Visual Order Processing - expert for MetaTrader 4

Take Profit processing for EA:

The Take Profit line shouldn't be an absolute onerous cease as it's when a take-revenue line is outlined to MetaTrader 4. First off, the MT4 take-revenue closes all open trades on the similar time. Two choices can be found to Order_EA customers: 1) If EnableTS is about to "true" (default), the next paragraphs describe TP motion, 2) If EnableTS is about to "false", Order_EA will will shut the oldest order when the TP line is hit. The final TP line encountered will shut all remaining open orders.

With EnableTS set to true, Order_EA will let the revenue run till a 4-pip pull-again is encountered. Then, the oldest order entry can be closed first adopted by subsequent orders respecting their very own Take Profit and/or Stop Loss strains. Orders have to be closed within the order entered however they don't all should be closed on the similar time. The final Take Profit line hit will shut all remaining orders.

When the present worth reaches 10-pips from the Take Profit line, the Take Profit line can be transformed to a Trailing Stop line and can advance to inside 20-pips of the present worth. The Trailing Stop line will advance 2-pips for each pip worth motion advances – till the Trailing Stop is inside 4-pips of the present worth. The Trailing Stop line will stay inside 4-pips of the present worth, whilst the present worth advances properly past the previous Take Profit line.

There is just one Trailing Stop line. All remaining Stop Loss and Take Profit strains stay in play till the present Trailing Stop line is taken out by worth motion. Then the subsequent Take Profit line can create a Trailing Stop. When the final Take Profit line has been processed, all orders are closed.

Scripts:

Each script must be drug (with the left-mouse-button) from the Navigator pane to the chart window and dropped on the correct location as a lot of the scripts report the place the left-mouse-button was launched. A drop above the present worth signifies a "Buy" whereas a drop under the present worth is a "Sell". Buys are taken from the Ask worth quoted by the dealer.  Sells are taken relative to the Bid worth.

  1. Order_Immediate:

    Drop the script above the present worth to create a Buy or under the present worth to create a Sell. The order entry worth is the present market worth.  From that worth, a 60-pip Take Profit line and a 60-pip Stop Loss line are additionally created. Either of those two strains could also be moved to mirror present market circumstances. 60-pips was chosen to stop both the Stop Loss or Take Profit strains from being hit earlier than they are often moved to the right (calculated) positions.

    Note that these are "development strains", not horizontal strains. Thus, by grabbing both of the top factors, the road could also be moved to create a diagonal Single Line Trend Line. Deleting both the Stop Loss line or the Take Profit line will forestall this software program from taking correct motion. Deleting the Order Entry line with out deleting each the Stop Loss and Take Profit strains might create an issue. The Order_Fill_21 script requires the Take Profit line to be current. Also, Order_EA requires the Take Profit line to be current to permit motion of the Stop Loss line near the goal worth. However, if the Stop Loss line has been deleted, the commerce is in danger for an enormous loss as a trailing cease won't be created.

    If the speedy order isn't accepted, the Stop Loss and Take Profit strains won't be created. Reasons for rejection of the order  may be that a purchase was ask for when a promote already exists. Check the "Journal" tab within the Terminal window to see the rationale for rejection.

  2. Order_Pending:

    Drop the script above the present worth to create a Buy or under the present worth to create a Sell. The worth for the pending commerce is decided by the situation of the script drop. From that worth, a 60-pip Take Profit line and a 60-pip Stop Loss line are additionally created. Any of those strains could also be moved to mirror present market circumstances.

    Note that these are "development strains", not horizontal strains. Thus, by grabbing both of the top factors, the road could also be moved to create a diagonal "Single Line Trend Line". When the Order Entry line (purple=promote, inexperienced=purchase) is hit, an order is created. In the above instance, the promote line runs parallel to the bull-flag being constructed and can set off a promote order when worth motion drops under the promote line.

    Deleting both the Stop Loss line or the Take Profit line will forestall this software program from taking the related motion. Deleting the Order Entry line with out deleting each the Stop Loss and Take Profit strains merely leaves rubbish on the display. The Order_Fill_21 script requires each the Order Entry and the Take Profit strains to be current. Also, Order_EA requires the Take Profit line to be current to maneuver permit creation and motion of the Trailing Stop line near the goal worth. However, if all Stop Loss strains are deleted, the commerce is in danger for an enormous loss.

  3. Order_Waypoint:

    Order_Waypoints are to be dropped between the present order entry line and the Take Profit line. (Not carried out as of 1 December 2014)
  4. Order_Close_Old:

    The Order_Close_Old script could also be dropped anyplace on the chart window as the precise location is just not necessary.  This script will trigger the oldest order to be closed.
  5. Order_Close_All:

    The Order_Close_All script could also be dropped anyplace on the chart window as the precise location shouldn't be essential.  This script will trigger all open orders to be closed. All Stop Loss, Take Profit, and Buy/Sell strains may also be deleted.
  6. Order_SL:

    A horizontal Stop Loss line will probably be created on the worth the place the left-mouse-button is launched. This line could also be moved and rotated as essential to create the specified Stop Loss situation. This script is usually used when orders exist already and a Stop Loss must be hooked up to the order. Caution: positioned on the fallacious aspect of the present worth, this script will trigger the order to be instantly closed.
  7. Order_TP:

    A horizontal Take Profit line can be created on the worth the place the left-mouse-button is launched. This line could also be moved and rotated as essential to create the specified Take Profit situation. This script is usually used when orders exist already and a Take Profit must be hooked up to the order. Caution: positioned on the improper aspect of the present worth, this script will trigger the order to be instantly closed.
  8. Order_Fill_21:

    The Order_Fill_21 script could also be dropped anyplace on the chart. This script will create an order entry line each 21-pips from both the newest order worth or Order Pending line as much as the Take Profit line. These strains could also be moved or deleted as vital. If calculations for the Take Profit line are correct, the final order entry line ought to be deleted. Also, have in mind the extreme hit this function may cause to the margin account. Changing every horizontal line to a development line will not be a good suggestion.

    Each Order Fill line creates a brand new order when hit together with a horizontal Stop Loss line 4-pips again from the earlier (final) Stop Loss line. All Stop Loss strains are then superior by 21-pips. Thus the chart exhibits a collection of orders spaced each 21-pips adopted by a collection of Stop Loss strains with a 4-pip separation. (Not carried out as of 1 December 2014).

Source URL:https://www.mql5.com/en/code/12096

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?



Author: Amjad Rehan
I am from Pakistan and i have very much interest in trading and doing this business since 2010.