Jump to content
Medved Trader Forums

Question

Posted

I am new to Medved Trader, therefore I am not sure whether this feature has been implemented in MT or not. I would like to have a small side pane to the right of a chart (we may call it ChartTrader or whatever). In this ChartTrader, I would like to have a few essential shortcut buttons such as "BUY MARKET", "SELL MARKET", "GOING FLAT", etc. 

Different from shortcut buttons on DOM based windows, I would like to have a built-in stop loss order being sent to the broker once a market order is filled. The stop loss order is not set at fixed N ticks away from some price, instead it should be based on some simple user configured criteria (e.g., the lower low of the current bar and the previous bar as the stop loss sell order). 

If the button "GOING FLAT" is clicked, all unfilled orders should be cancelled, and an new order should be sent out to liquidate any position corresponding to the symbol on the chart. 

More fancy features can be added as well. For example, some customized "BUY IF" or "SELL IF" buttons can be created which are associated with some simple criteria (for example, buy 100 shares of SPY if Close[1] > Open[1] and Close[0] > High[1], where Close[1] stands for the close price of previous bar, Close[0] is the current price, etc.). Once those "BUY IF" or "
SELL IF" buttons are activated, it will keep checking for the simple criteria to meet to fire a buy market or sell market order. Again, a stop loss will be automatically sent out, whose stop price is determined by some simple formula based on OHLC prices of recent two or three bars. (I implemented these features (even much fancier) in NinjaTrader, however I need something can set orders to Fidelity).

I knew all these could be done using the MT Websocket API outside of MT. However if it could be implemented within MT itself, it would be easier to use and is more robust. At least, being able to set stop loss price based on the OHLC prices of recent bars is already an enhancement to many DOM based trading software).

  

 

5 answers to this question

Recommended Posts

  • 0
Posted

we don't have a panel on right side of the chart, but you can define Hotkeys that do that. On the hotkey definition, check the box for "Saved Order" and specify the button text and color.  The hotkey can do various computations, but not looking at candle data - it does not have access to that. 

we have a FLATTEN button already available though you could do it with hotkey as well. 

 

  • 0
Posted

Thanks for the replies. Did you suggest to use an indicator as below to keep computing the some value as below and use SetInterVar/GetInterVar to pass the value to a button (hotkey)?

// indicator snipper:

indicator("Lowest Low with SetInterVar", overlay=true)

lowest_low = math.min(low[0], low[1])

SetInterVar("LowestLowStopLoss", lowest_low)

 

// hotkey code snippet:

float StopLossPrice = GetInterVar("LowestLowStopLoss")

if (StopLossPrice > 0) {

    MarketBuy()

    StopLoss(StopLossPrice)

 

  • 0
Posted

I don't understand the "hotkey code snippet" - hotkeys are not like that. They don't use C# code.

in the hotkey you would use

intervar('LowestLowStopLoss')  - which would get you the value from the paintbar. Combine it in a formula to get whatever value you want.

I would also suggest using shorter name :)

Join the conversation

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

Guest
Answer this question...

×   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...