Strategy auto trading alerts  [SOLVED]

Questions about MultiCharts and user contributed studies.
AAY
Posts: 56
Joined: 29 Nov 2013
Has thanked: 9 times
Been thanked: 30 times

Strategy auto trading alerts

Postby AAY » 04 Feb 2014

Hello,

I would like to get email notification for every filled order in auto trading. What is the best way to do this? I could use 'alert' at the same time when strategy places an entry order, but this is a limit order, and I need alerts only if order is actually filled. Same with exits. Is there a way to get alerts only for fills?

Thanks.

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Strategy auto trading alerts

Postby MAtricks » 04 Feb 2014

.
Last edited by MAtricks on 09 Feb 2014, edited 1 time in total.

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

Re: Strategy auto trading alerts

Postby Henry MultiСharts » 04 Feb 2014

Hello AAY,

That is possible to check the market position change and current contracts change to generate the alert only when there is an actual fill.

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Strategy auto trading alerts

Postby MAtricks » 04 Feb 2014

Just poking at this now.. I think this will work for you:

Code: Select all

//Alert
Inputs:
TradeAlert( "X Strategy Fill" ) ;

Variables:
IntrabarPersist MPos( 0 ),
IntrabarPersist LastMPos( 0 ) ;

MPos = I_MarketPosition ;

if MPos<>LastMPos then Alert( TradeAlert ) ;
LastMPos = MPos ;

AAY
Posts: 56
Joined: 29 Nov 2013
Has thanked: 9 times
Been thanked: 30 times

Re: Strategy auto trading alerts  [SOLVED]

Postby AAY » 05 Feb 2014

Just poking at this now.. I think this will work for you:
Yes, this works. Thank you MAtricks.

User avatar
MAtricks
Posts: 789
Joined: 09 Apr 2012
Has thanked: 286 times
Been thanked: 288 times

Re: Strategy auto trading alerts

Postby MAtricks » 09 Feb 2014

Another individual was asking about something similar so I wrote this piece up for them and thought maybe you'd have use for it as well:

Code: Select all


Inputs:
LE( 1 ), //0 = do not use. 1 = use
LX( 1 ), //0 = do not use. 1 = use
SE( 1 ), //0 = do not use. 1 = use
SX( 1 ) ; //0 = do not use. 1 = use

variables:
IntrabarPersist MPos(0),
IntrabarPersist LastMPos(0);

MPos = I_MarketPosition ;

if LE>0 and LastMPos<=0 and MPos>0 then
Alert( "Long Entry" ) ;
if LX>0 and LastMPos>0 and MPos<=0 then
Alert( "Long Exit" ) ;
if SE>0 and LastMPos>=0 and MPos<0 then
Alert( "Short Entry" ) ;
if SX>0 and LastMPos<0 and MPos>=0 then
Alert( "Short Exit" ) ;

LastMPos = MPos;
Last edited by MAtricks on 10 Feb 2014, edited 1 time in total.

AAY
Posts: 56
Joined: 29 Nov 2013
Has thanked: 9 times
Been thanked: 30 times

Re: Strategy auto trading alerts

Postby AAY » 09 Feb 2014

Another individual was asking about something similar so I wrote this piece up for them and thought maybe you'd have use for it as well:
My code, based on your original reply, is already very similar to this. Thanks anyway!


Return to “MultiCharts”