“Trail Lock (Stop Order)” sCRIPT
The Script will place a stop-order at the price level, to which you have drag-and-dropped the script, or at the distance equal to Delta value from the price, if the value set in the “Delta” parameter is larger than 0.
The Script will place a BuyStop/SellStop order, if the script has been drag-and-dropped to the level, which is higher/lower than the current price.
Afterwards the Script will trail the order following the price, until it is triggered, and stop its operation.
If lot size is not set in the “Lot” parameter, then the Script will calculate the lot size as a difference between the total lot sizes of BuyStop and SellStop orders (locking orders) by itself.
The Script inputs:
extern int TakeProfit = 0; //level, at which a take-profit is set; if 0, then the take-profit will not be set extern int StopLoss = 0; //level, at which a stop-loss is set; if 0, then the stop-loss will not be set extern int Delta = 0; //distance from the price to order; if 0, then the order will be opened at the price level, to which you have drag-and-dropped the script by holding the left mouse button extern int StepMove = 1; //step (in points), at which order moves extern double Lot = 0.1; //lot size; if 0, then the Script will calculate the lot size by itself extern int Magic = 100; //unique order number
Trail Lock Stop Order