GetAppInfo: Difference between revisions
From MultiCharts
no edit summary
No edit summary |
|||
Line 67: | Line 67: | ||
The highest price on the Y axis (price scale) is 2438 and the lowest price on the same axis is 2411 | The highest price on the Y axis (price scale) is 2438 and the lowest price on the same axis is 2411 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Using GetAppInfo to monitor an ATS === | |||
In the simplified example below, the GetAppInfo(aiStrategyAuto) is used to monitor the status of an [[:Category:AutoTrading|Automated Trading Strategy]]. If the ATS is turned off, a sound alert is given. | |||
<syntaxhighlight> | |||
// 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; | |||
</syntaxhighlight> | |||
[[Category:Environment Information]] | [[Category:Environment Information]] |