This script, designed for the MetaTrader platform, aims to automatically manage and place trading orders.
Here's a breakdown of what it does, in plain language:
-
Initialization: When the script starts running, it doesn't perform any specific setup actions.
-
Order Management: It tries to close all previously opened positions in the market and then will attempt to place two buy-stop orders in the market.
- The script closes the order identified by its 'ticket' number, and then try to send one buy-stop.
- Then it will try to modify this buy stop order to change the entry level of the pending order.
-
Deinitialization: When the script is stopped or removed from the chart, it doesn't perform any specific cleanup actions.
//+------------------------------------------------------------------+
//| BadOrders.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//----
double asdf;
double ticket, t2;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
//This section closes any positions opened on the last tick
OrderSelect(1,SELECT_BY_POS);
OrderClose(OrderTicket(),1,Bid,8,Red);
ticket=OrderSend(Symbol(),OP_BUYSTOP,1,Bid+100*Point,3,0,0,"asdfasdf",16384,0,Green);
t2=OrderSelect(ticket,SELECT_BY_TICKET);
OrderModify(OrderTicket(),Bid-100*Point,0,0,0,Green);
//OrderClose(OrderTicket(),1,Bid,8,Red);
//OrderSend(Symbol(),OP_BUYSTOP,1,Bid-100*Point,3,0,0,"asdfasdf",16384,0,Green);
//----
return(0);
}
//+------------------------------------------------------------------+
Comments