How to get mail when autotrading is turned off  [SOLVED]

Questions about MultiCharts and user contributed studies.
franksv
Posts: 8
Joined: 13 Jan 2011
Location: Norway
Contact:

How to get mail when autotrading is turned off

Postby franksv » 21 Aug 2012

I can see on the wiki that i can get a sound alert when autotrading is turned off,but How do I get a mail or alert in window?
Here is the Code for Sound alert

Code: Select all

// Example: using the GetAppInfo(aiStrategyAuto) to monitor for an Automated Trading
// Strategy that gets turned off.

Variables:
IntraBarPersist PrevATSStatus(0), // Holds the status of the ATS at the previous update
atsStatus(0); // Holds the current ATS status

if (LastBarOnChart_s = True) then begin

atsStatus = GetAppInfo(aiStrategyAuto);

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

PlaySound("C:\Temp\atsTurnedOff.wav");

end;

PrevATSStatus = atsStatus;

RecalcLastBarAfter(15); // Update every 15 seconds, even if the data feed stops updating

end;

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

Re: How to get mail when autotrading is turned off

Postby TJ » 21 Aug 2012

I can see on the wiki that i can get a sound alert when autotrading is turned off,but How do I get a mail or alert in window?
Here is the Code for Sound alert
...
do you mean when broker connectivity is off?

see post #13
viewtopic.php?f=16&t=6845

franksv
Posts: 8
Joined: 13 Jan 2011
Location: Norway
Contact:

Re: How to get mail when autotrading is turned off

Postby franksv » 21 Aug 2012

Hey TJ

Your last post was not much help.I tried the following in the strategy but for some reason it did not work. Also enabled Alert in Strategy.
I did not even get alert.
If I for some reason loose connection from MC to any gateway.
--------------------------

// Example: using the GetAppInfo(aiStrategyAuto) to monitor for an Automated Trading
// Strategy that gets turned off.

Variables:
IntraBarPersist PrevATSStatus(0), // Holds the status of the ATS at the previous update
atsStatus(0); // Holds the current ATS status

if (LastBarOnChart_s = True) then begin

atsStatus = GetAppInfo(aiStrategyAuto);

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

Alert(text(Autotrading is turned off);

end;

PrevATSStatus = atsStatus;

RecalcLastBarAfter(15); // Update every 15 seconds, even if the data feed stops updating

end;



Return to “MultiCharts”