Jump to content
Medved Trader Forums

Attach stop loss order to hotkey


3acor

Recommended Posts

Hey,

Is there a way to attach a stop order when sending an order using hotkeys?

For example, I place a trade on the chart using hotkeys to buy 100 shares.
I would like the hotkey to automatically attach a stop loss order of 100 shares that I myself place and send it on the chart.

 
Thanks !
Link to comment
Share on other sites

Sorry maybe I didn't clarify properly.

I meant that in the hotkey, I place an order to buy 100 shares of XYZ at a limit price of Ask+0.1. 
What I do after is that I press F3 on the chart, which I set it in a way that when pressing F3, I drop a stop order on the chart which I then chose which price I want. 

Could it be possible that in the hotkey, on top of sending an order of buying 100 shares of XYZ at a limit price of Ask+0.1, I can attach a stop order(without it being sent, just being dropped on the chart) of 100 shares which I then send it by clicking a price of my desire on the chart, instead of having to press F3?

Link to comment
Share on other sites

Oh sure. here is the code (you can copy/paste it into MT:

{
  "PreHotkey": false,
  "UniqueID": "UATTPX0RAKYQKTCHYNTDVA==",
  "ShortDesc": "Limit+drop Stop",
  "ButtonText": "L+DropStop",
  "ButtonColor": "147, 255, 153",
  "LongDesc": "",
  "Enabled": true,
  "IsSavedOrder": true,
  "ActiveWinType": 63,
  "JSON": {
    "Command": [
      {
        "Disabled": false,
        "Order": {
          "Drop": "false",
          "Send": "true",
          "ConditionalType": "None",
          "Legs": [
            {
              "OrderType": "Limit",
              "Action": "Buy",
              "Quantity": "100",
              "LimitPrice": "Ask+ 0.01"
            }
          ]
        }
      },
      {
        "Disabled": false,
        "Order": {
          "Drop": "true",
          "Send": "false",
          "ConditionalType": "None",
          "Legs": [
            {
              "OrderType": "StopMarket",
              "Quantity": "100",
              "Action": "Sell"
            }
          ]
        }
      }
    ]
  },
  "LastUpdatedTicks": 0,
  "NumOrders": 2
}

OR Visually it is:
image.png

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Is there a way to automatically attach the stop loss order a certain percentage from the current market price and have the stop loss order be above the market price if I am Short and below the market price if I am Long?

Link to comment
Share on other sites

lets say you want the stop order 5 cents above the ask or below the bid depending on direction. you can set it to be 
Pos < 0 ? Ask + 0.05 : Bid - 0.05

So if you are Short, position will be less than zero, so the stop will be Ask+0.05.  

if you are Long, position will be greater than zero, so the stop will be Bid-0.05.  

Link to comment
Share on other sites

use of POS and PosAbs would require for the hotkey to be hit after you are in a position.

If you want it to be combined with the entry, you would have to do a OTA order so the logic would be different. The Quantity would be the same for both orders and you would just set the price to be the offset.  But in that situation you would know if you are going short or long - would not have to code for it, no?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...