Jump to content
Medved Trader Forums

Mike Medved

Administrators
  • Posts

    1,543
  • Joined

  • Last visited

  • Days Won

    124

Posts posted by Mike Medved

  1. CapOrderType is the order type of the Capsule over which the mouse is hovering. Since there is no capsule, don't use it.

    I would suggest using instead

    PriceAtMouse<=Price?'Buy':'Sell'   for the main order and

    PriceAtMouse<=Price?'Sell':'Buy' for the legs?

    Also - I am not sure how you decided on your limit and stop prices both in main and in legs. That doesn't look like it works both for sells (if mouse is on left side of DOM) and buys (if mouse is on right). Are you sure about those?

  2. Jason, MT's Websocket API is mostly asynchronous.

    That means that you send a command and don't wait for immediate response to the command. The response will just come when it comes (usually pretty fast but still). You can match the command to the response by sending a unique reqID in the command and matching it to the reqID in the response.

    The part that processes responses and decides where to direct it does not really has to be multithreaded - it should be very fast. But once you receive and parse the response you can direct it to a separate thread or queue if you like. Although I would wonder if that's overkill. Usually such processing is fast enough and the events that happen are (comparatively) rare enough (that is, not 100s a second) that multithreading may not be needed.

  3. 3 hours ago, Hans said:


    Mike - in your last example, is it not necessary to specify Quantity in each of the Sell bracket legs? 

     

    No - it would be copied from the main leg of the order. In fact, most brokers I think don't allow quantities in sub-legs that are different from main.

  4. Actually, Niko, I should amend my previous answer.

    This waiting for an order to execute cannot be done on MT side. But it can be done on the broker side, if your broker supports it. So if your broker supports OTOCA orders, here is a hotkey

    image.png

     

     

  5. The limiting thing here is, the hotkey just executes, section by section. It cannot wait for one order to complete before continuing. There is no mechanism to do that.

  6. If instead of "Buy limit x% of account" you'd accept "Buy market x% of account" and then assume that it was bought at current Ask (for the "entry" part of the subsequent orders) - yes you can.

    Or - if you split it in two. One hotkey would do the "Buy limit x% of account". And the other (that you would execute once you see the buy go through) would set up the other two OCO orders.

  7. You cannot do that for several reasons.

    1. Limit order is definitely not guaranteed to fill in 5 seconds (which is the delay you set)...

    and

    2. Even if it did, the variables that are used in the hotkey are set at the beginning of the whole hotkey, and are not recalculated at the beginning of each section. So if you have no position at the start of the hotkey, the PosAbs will be 0 even if the first section executes an order and a position appears.

    What you would have to do is calculate the quantity and make it a variable in the variable section at the very start of the hotkey. Then use that variable in the subsequent sections. Same for the Paid price. And still have to take the (1) fact above into account.

  8. Hans, place a "Paintbar" indicator on the chart. Select the paintbar you created inside that indicator. There are also options on how to apply the paintbar, visually, to the chart. For your purpose, select the "Color Candles" method.

  9. What color would you want a doji candle to be?

    Let's say you want it always to be the positive color.

     

    Then you configure a paintbar that says "If Close>=Open then Positive Color else Negative Color."

    Put that on the chart, then make it color candles.

  10. Well. The options in the Compare Symbol is -

    Anchor and Fit - which shows the %

    Fit Scale to Overlap - which shows the Compare symbol fitted into the chart, with the Min/Max fitting.

    Share Scale no Fit - which makes the scale big enough to fit both.

×
×
  • Create New...