Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2009.09.25 06:55
Experts

Orders Guardian - expert for MetaTrader 4

| English Español Português 日本語 Deutsch

Views:
12753
Rating:
votes: 3

I. Introduction

MetaTrader provieds the functions to set a fixed TP, SL or trailing stop to an order. More often, we hope to use some other closing strategy, such as resistance, support lines, channels, etc. But this need users to keep staring at the chart and modifying the TP and SL times to time, which will be a hard working. OrdersGuardian is such an EA that will partly free you from the computer screen after opening orders. It has some simple closing strategy, including MA, envelopes, trendline, channels, parabolic SAR. It will close the order as the price reach to this curve or line you set.

II. Parameters

Varables Type Default Values Comments
Ordersstring"*"Orders' tickets to be monitored. "*" means all opened orders of current symbol, it can be tickets list separated by spaces, commas and other chars, for the EA will check each order whecher its ticket is this string's substr. All the orders in this list must be in the same direction, otherwise the EA can not work.
TP_Method
int
2TP strategy: 1 - Envelopes or MA (set TP_Env_Dev to 0 means MA), 2 - line objects, others - no TP.
EA will search line objects in the chart, which can be Trendline, Trendline by Angel or Equidistant Channel.
SL_Method
int
2 SL strategy : 1 - Envelopes or MA, 2 - line objects, 3 - Parabolic SAR, others - no SL.
ShowLines
bool
trueWhether to show TP and SL price line in the chart.
TP_LineColor
color
LimeGreenColor of TP price line.
TP_TimeFrame
int
0Timeframe of the indicator for calculating TP price, the unit is minute, 0 means the current chart timeframe.
TP_MA_Period
int
34Period for TP MA calculation.
TP_MA_Method
int
MODE_EMATP MA method.
TP_MA_Price
int
PRICE_CLOSEApplied price for TP MA.
TP_Env_Dev
double
0.2Percent deviation of TP envelopes line from MA, positive - the upper, negative - the lower, zero - MA curve line.
TP_Shift
int
0TP MA shift, MA line offset relate to the chart by timeframe.
SL_LineColor
color
RedColor of SL price line.
SL_TimeFrame
int
0Timeframe of the indicator for calculating SL price.
SL_MA_Period
int
34Period for SL MA calculation.
SL_MA_Method
int
MODE_EMASL MA method.
SL_MA_Price
int
PRICE_CLOSEApplied price for SL MA.
SL_Env_Dev
double
0.2Percent deviation of SL envelopes line from MA
SL_SARStepdouble0.02
Increment of SAR.
SL_SARMax
double0.5Maximum value of SAR.
SL_Shift
int
0SL MA shift



III. About line objects

  1. If there were more than one line object in the chart, taking a long order as example, the EA would search the nearest one above the current price as the TP trendline, and the nearest one below as the SL trendline.
  2. When EA running, user can adjust the position of trendline, and EA will calculate the new coordinates automatically.
  3. The EA searches the TL and SL trendline right after its starting, after which two line objects will not change, even if user move them above or below other lines, excpet restarting the EA.
  4. Changing the period of attached chart will cause EA restarting and then re-searching TP and SL objects.
  5. If users delect the working TP or SL objects, the EA would search a new one.
  6. When equidistant channel used, the upper line would be TP line and lower be SL in long orders, vice versa in short orders.
  7. Trendline in angel is not recommanded, for its position in the chart's price coordinate is not fixed and changes with the price or time axis.

IV. Notice

  • When SAR used as SL, the variable SL_Shift can not be zero, must >=1.
  • The TP and SL price is the price showed in chart, ie. bid price, no spread calculated.

V. Operation steps

  1. Open your orders.
  2. Place indicators or trendline to the chart as your TP or SL objects.
  3. Attach OrdersGuardian to the chart,set the parameters same as your indicators (setting ShowLines's value true is recommended), and leave "Allow live trading" unchecked on the common tab. Click OK button, there should be a cross in the top-right corner of the chart.
  4. Press down the "Expert Advisors" button, the cross will became an unhappy face, which means the EA is working properly, but will not close any orders.
  5. If the TP and SL price line displayed in the chart are same as your planned, press F7, select the checkbox of "Allow live trading", and the unhappy face icon will change into a smiling one, so the EA is now starting monitoring your orders.



Equidistant Channels as TP and SL


Envelopes as TP


Moving Average as SL


Parabolic SAR as SL


Trendline as TP and SL

Heiken Ashi ZoneTrade Heiken Ashi ZoneTrade

This script is based on the 4th dimension of the Bill Williams chaos trading system. The advancement is that this script takes advantage of the Heiken Ashi candles.

 ComFracti_v2 , Comfracti_final ComFracti_v2 , Comfracti_final

Update 2009.10.25

Min/Max Bands Min/Max Bands

Indicator showing the Min/Max values for the last X bars

GG-RSI-CCI GG-RSI-CCI

This indicator informs you about the trend and offers a good entry possibility.