仕事が完了した
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
指定
This is how my current script works: I have a script (simple short script that has only 50 lines of coding) that place Sell Limit, Sell Market, Sell Stop orders with predetermined SL and TP with some other options like UseMoneyMgmt. (leave 0 to disable SL/TP) When SetEntryPrice is left 0, it opens market order, but when I put x.xxxx on SetEntryPrice , script will place 1 pending order (Sell Limit or Sell Stop order depend on what price I entered against current price at the time of running script). Example: At the time of executing this script, if current price = 1.25000, if I put OrderPrice = 1.25600, script will place pending Sell Limit order. If I put OrderPrice = 1.24300, script will place pending Sell Stop order. If I put OrderPrice = 0 (left this setting to 0), script will place Sell Market order immediately.
The script currently have these options:
extern double InitialLots = 0.1;
extern bool UseMoneyMgmt = false;
extern double RiskPercent = 2;
extern bool UseStop = true;
extern bool UseTakeProfit = true;
extern double StopLoss = 15;
extern double TakeProfit = 50;
extern string Note="0 in SetEntryPrice field means Market Order Sell";
extern double SetEntryPrice = 0.0000;
//the following options to be add for this job
Extern bool EnableExtraOrders = true (or false); // if set to false, script should run ‘AS IS’.
extern int PendingOrderPriceDist = 10 ; // (value in pips)
extern double LotSizeIncrementForSellLimitOrder= 0.1(or -0.3) ; // this setting can be plus or minus
extern double LotSizeIncrementForSellStopOrder= 0.2(or -0.4); // this setting can be plus or minus
This Job Request:
1) I would like to add script to add following options.
· PendingOrderPriceDist = 10; // 10 is user input and this number should be in pips.
· LotSizeIncrementForSellLimitOrder= 0.1 (or -0.1) ; // user input
· LotSizeIncrementForSellStopOrder= 0.2 (or -0.2); // user input
Note:
** This option is only applied when I run script to place MarketOrder (In otherwords, this option should only execute when I run script with SetEntryPrice = 0.0000 and EnableExtraOrders = true) These extra pending order's lotsize maybe larger or smaller than InitialLotSize.
** SL,TP for these pending orders should be same as Initial Market Order. So, TP & SL is set for Market order, these pending orders should be same as the Initial Market order’s SL and TP
** LotSizeIncrement should be always calculated from the Initial Market Order’s LotSize. So, if MarketOrder was used with InitialLotsize = 1, LotSizeIncrement should be calculated from 1. If UseMoneyMgmt= true, RiskPercent = 2, LotSizeIncrement should be calculated from the RiskPercent LotSize.
Example A: Current Price = 1.25000, Initial LotSize = 1 when I run script with extern double SetEntryPricePrice = 0.0000; extern int pendingOrderPriceDist = 10 ; extern double LotSizeIncrementForSellLimitOrder= 0.1 ; extern double LotSizeIncrementForSellStopOrder= 0.2 ; Script should place 1 lot Sell order immediately @ 1.25000 and also place 1.1 lot, Pending SellLimit order at 1.25100 and place1.2 lot, 1 pending SellStop order at 1.24900.
Example B: Current Price = 1.25000, Initial LotSize = 1 when I run script with extern double SetEntryPricePrice = 0.0000; extern int pendingOrderPriceDist = 10 ; extern double LotSizeIncrementForSellLimitOrder= -0.1; extern double LotSizeIncrementForSellStopOrder= -0.2; Script should place 1 lot Sell order immediately @ 1.25000 and also place 0.9 lot, Pending SellLimit order at 1.25100 and place 0.8 lot, 1 pending SellStop order at 1.24900.
2) When compile the script, I would like warning free. Currently, it has 1 warning à " return value of OrderSend should be checked" - When it is all done and I would like warning free.
I will provide source code for the script after job has assigned to the coder.