Announcement

Collapse
No announcement yet.

Send market order with profit target and stop loss

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Send market order with profit target and stop loss

    Hi there,

    is it possible to send three orders at once? A market order once filled would send the profit taking stop and a stop loss simultaneously. If not, what would be the best alternative?

    Many thanks

  • #2
    Hello KingSerk,

    Thank you for the post and question the eSignal Forum. Yes, it is possible to send the three orders, however it would required that you use the Money Management Planner to do so. What you do is simply associate the MMS to your primary order and when it executes the other two would execute as well.

    AveryH
    eSignal Support

    Comment


    • #3
      Hi Avery,

      my profit and stop loss would be a percentage of the fill price e.g +/- 0.2%. The MMS doesn't allow percentage targets. I would also be implementing the strategy on 30+ charts at once so I would need something mechanical.
      Last edited by KingSerk; 11-13-2015, 07:08 AM.

      Comment


      • #4
        multi order placement

        Hi

        That can also be achieved using EFS-AT however it requires
        -very good programming skills and
        -good understanding of event driven processing

        Initially you need to place a single market order

        OrderId = Trade.BuyMarketOrder(...)

        In your code you need to add a function which will be called when your position will be filled/changed

        function onPositionUpdate(positionID)
        {
        // Executes when the price, qty or the PL value of a position changes.
        // The function receives the position ID that was updated from the EFS trading engine.

        // filter out events not related to your chart

        if (Connection.isConnected()
        && Position.connection(positionID) == Trade.getCurrentConnectionID()
        && Position.symbol(positionID) == getSymbol()
        && Position.account(positionID) == Trade.getCurrentAccount())
        {

        //check that your buyMarket order was filled
        if (OrderId != null && Order.state(OrderId) == Order.STATE_FILLED)
        {
        ....
        // get the fill price
        nEntryPrice = Position.price(positionID);

        // place your profit target order calculating appropriate targets and stops
        LimitOrderId = sellLimitOrder(nEntryPrice + nTargetTicks * nMinTick);
        // place your stop order
        StopOrderId = sellStopOrder(nEntryPrice - nStopTicks * nMinTick);

        .....
        }


        // add more code

        to check for execution of Stop or Limit Order to place appropriate cancellation of the remaining order

        ....

        }


        I hope the above idea is helpful

        Regards
        Adam

        Comment


        • #5
          Oh wow! A million thanks Adam! This is wonderful! Thank you!

          Comment

          Working...
          X