Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 06:19:09 +0000



PlaySound Issue

View Count: 1442

[2015-10-18 08:04:33]
KhaosTrader - Posts: 128
Hi,

I have implemented the "Playsound function" in my study. It makes a sound every time there is a setup. Because I load several days worth of data, the alert sounds queue up and are played when the chart is loaded. I would like only the alert to play if it occurs in the last 2 bars drawn on the chart. How do I determine this? Is there a LastBarOnChart Number or something I can reference? Then I can see if the sc.Index is within a few bars of the last bar charted on the chart. In Easylangauge they have a "isLasBarOnChart" value, so I can do things like that. Not sure how to approach this problem here.. Any help would be appreciated, thanks.
[2015-10-18 08:45:13]
Sierra Chart Engineering - Posts: 104368
This page here should be helpful:
https://www.sierrachart.com/index.php?page=doc/doc_ACS_ArraysAndLooping.html

What you are interested in is sc.ArraySize

Also refer to:
https://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html#scSetAlert
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2015-10-18 10:23:59]
KhaosTrader - Posts: 128
I get a constant beepish sound, rather than my file being played...

I am using this line:
sc.PlaySoundW("c:\\!TradeAlert_Sounds\QCL.Long");


I look for sc.PlaySound, which is documented, but I am only seeing the PlaySoundW somehow...
[2015-10-18 10:34:51]
KhaosTrader - Posts: 128
Hi,

I corrected the string, it plays the right sound message, but it keeps repeating... i put this in to make it not play on historical, but still keeps playing over and over



    if (sc.DownloadingHistoricalData == 0)
    sc.PlaySound("c:\\!TradeAlert_Sounds\\QCL_Long.wav");

[2015-10-18 10:53:38]
KhaosTrader - Posts: 128
I tried this and it seems to work....

Let me know if this is a correct way of doing it please. I figured I only needed the first condition, but I added another condition and then it seems to work ok.


  if
      (
        (sc.DownloadingHistoricalData == 0) &&
        (sc.Index > sc.ArraySize -5)
        )
    {
      sc.PlaySound("c:\\!TradeAlert_Sounds\\QCL_Long.wav", 1);
    }


[2015-10-18 18:59:34]
Sierra Chart Engineering - Posts: 104368
Yes, this looks fine.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account