DOM indicator

Questions about MultiCharts and user contributed studies.
djmoura
Posts: 7
Joined: 15 Apr 2013

DOM indicator

Postby djmoura » 28 Jun 2013

Is there any example code on how to use DOM indicator to cancel my order and sell (if on buy position) or buy (if on sell position) if it achieves my profit target but does not fill it? i.e.: buy @1600.25 sell price achieves target @1603.25 but is not filled, then it cancels the existing sell order and sells at market.
Thank you.

djmoura
Posts: 7
Joined: 15 Apr 2013

Re: DOM indicator

Postby djmoura » 30 Jun 2013

This is my current try:

Code: Select all

Vars:
ProfitTargetPts(100);
BuyPT(0), // profit targeted price
domask(0);

if dom_isconnected then
begin
domask = dom_askprice(0);
end;

BuyPT = EntryPrice(0) + ((ProfitTargetPts/12.5) * 0.25);

If Marketposition(1)<>0 and BuyPT = domask then // profit target touched
If Marketposition(1)<>0 and BuyPT - 0.25 = domask then // back 1 tick and position remained
Sell from entry ("Buy") next bar at market;

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: DOM indicator

Postby Henry MultiСharts » 01 Jul 2013

Hello djmoura,

If you need current ask and bid price - you can get them from the status line using InsideAsk and InsideBid reserved words, instead of accessing them from the DOM.
That is possible to convert unexecuted limit/stop orders to market orders after X seconds. Please check Unfilled Strategy Order Replacement options.


Return to “MultiCharts”