Scripts: SetBuyLimitOrder

 

SetBuyLimitOrder:

The script is developed for placing a BuyLimit order with fixed trigger levels, Stop Loss and Take Profit levels in points from the current price.

Author: Nikolay Kositsin

 

Why in the

uint SetBuyLimitOrder
 ...if(result.retcode==TRADE_RETCODE_DONE)

isn't used

TRADE_RETCODE_PLACED

?

 
ias:

Why in the

is not used

?

If memory serves me correctly, I wrote these scripts based on code samples from the help, I just copied a code fragment from there and checked it. Everything worked fine and I didn't dwell on it anymore!
 

From the reply:

Rosh2010.09.14 09:322010.09.14 09:32:28 #

...

OrderSend() is intended for sending trade requests to the trade server. What a trade request is - it is a certain trade order:

  • to buy or sell immediately on the market (the request can be executed or not depending on the order type and execution conditions for this instrument/order);
  • place a pending order to buy or sell on condition (pending Stop and Limit orders) - the order can be placed or rejected;
  • cancel a previously placed order to buy or sell on condition (delete pending Stop and Limit orders) - the cancellation order may be executed or rejected due to blocking of the order or an error in the order;
  • modify levels of pending orders (Open price, Stop Loss and Take Profit) - an order to modify may be executed or rejected due to blocking of the order or an error in the order;
  • modify Stop Loss and Take Profit levels for open positions - the modification order may be executed or rejected due to blocking of the order or an error in the order.

I understood that for (pending Stop and Limit orders) - the order can be placed or rejected - correct-TRADE_RETCODE_PLACED?

 

to correct:

instead of-//---- Open BUY position and make a check of the result of the trade request
should -//---- Set BuyLimit order and make a check of the result of the trade request