Alert when Autotrading Drops?

Questions about MultiCharts and user contributed studies.
mefTrader
Posts: 141
Joined: 23 Jun 2011
Has thanked: 9 times
Been thanked: 7 times

Alert when Autotrading Drops?

Postby mefTrader » 17 Apr 2012

Is it possible to generate an alert when autotrading drops?

When "SA" is selected and goes green I want to be able to generate an alert when it gets disconnected i.e goes back to grey from green. Is this possible?

I am using MC7.0 Release4953

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Alert when Autotrading Drops?

Postby TJ » 17 Apr 2012

Is it possible to generate an alert when autotrading drops?

When "SA" is selected and goes green I want to be able to generate an alert when it gets disconnected i.e goes back to grey from green. Is this possible?

I am using MC7.0 Release4953
see this
viewtopic.php?f=5&t=9890

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Alert when Autotrading Drops?

Postby JoshM » 19 Apr 2012

And with MC 8.0 beta 2, it's also possible to code the Alert directly into the signal, so that the additional indicator isn't necessary any more:
Alerts in Signals (Strategies)

There are now alerts available for signals (strategies). You can use sounds, visual or email alerts to get notified about orders and position changes. More info here -https://www.multicharts.com/pm/viewissue.php?issue_no=MC-319.
Source: MC Blog

mefTrader
Posts: 141
Joined: 23 Jun 2011
Has thanked: 9 times
Been thanked: 7 times

Re: Alert when Autotrading Drops?

Postby mefTrader » 19 Apr 2012

Here is what I have used (Code referred to by TJ and I have an added an email Alert use a custom dll and BLAT - search for BLAT on these forums to find out where you can get it)

Code: Select all

if (LastBarOnChart_s = True) then begin

atsStatus = GetAppInfo(aiStrategyAuto);
//mp = MarketPosition(0) * CurrentContracts;

{ If your broker (IB, ZF, Pats) supports it, you might want to replace the line above with the
line below. However, keep in mind that:
"If Automated Trading was manually turned off by the user, the value returned
by the keyword stops changing, and may remain unequal to '0'." (Source: Helpfile)
mp = MarketPosition_at_Broker;
}

// If the current ATS Status differences from the previous, and the previous
// status was ON, give an alert
if (atsStatus <> PrevATSStatus) and (PrevATSStatus = 1) then begin

// If there was a MarketPosition on the previous update, we need to raise a big alarm
//if (PrevMP <> 0) then
PlaySound("C:\Temp\atsOffWithOpenMP.wav");
text_to_write = getsymbolname +", AutoTrading Has been disconnected! ";
subj = "Alert! : "+getsymbolname +", AutoTrading Has been disconnected! ";
msg = " START c:\blat -to "+TraderList+" -subject "+DoubleQuote+subj+DoubleQuote+" -body "+DoubleQuote+text_to_write+DoubleQuote;
//Print(msg);
value1 =callShell(msg);

// ... else a lighter alert would be needed
//else
// PlaySound("C:\Temp\atsOffNoMP.wav");

end;

PrevATSStatus = atsStatus;
//PrevMP = mp;

RecalcLastBarAfter(RecalcAfter);
end; //: LastBarOnChart_s = True

mefTrader
Posts: 141
Joined: 23 Jun 2011
Has thanked: 9 times
Been thanked: 7 times

Re: Alert when Autotrading Drops?

Postby mefTrader » 19 Apr 2012

I am using MC7 still - hence why I have done it this way


Return to “MultiCharts”