Coding help - page 187

 
person77:
The alert is working great mladen.

Thank you very much.

1 - I tried changing the PlaySound to ("hallelujah.wav"); but it doesn't play the new wav file when triggered, still just the regular alert. How can I effect this?

2 - Is there way I can have the alert play repeatedly, say for 5 times in a row, so it will be sure to wake me if I'm napping?

I don't know why it does not accept the other wav file

If you have changed it in the code it should accept it

To repeat it 5 times you should place it in a loop, but that might cause some problems (if the sound file is too long)

 

hi mladen,

may i ask, if for example, the indicator has following parameters in sequence:

extern int IndicatorPeriod = 10;

extern int Priceused = PRICE_CLOSE;

extern string comment1 = "0-close, 1-high, 2-low etc.";

extern int timeframe =0;

extern string comment2 = "0-current timeframe";

extern double Level1 = 70;

extern double Level2 = 30;

extern color LinesColor1 = Green;

extern color Red;

extern bool showcolor = true;

extern bool alerts = true;

extern bool alertsMessage = true;

extern bool alertsSound = false;

extern string soundFile = "alert.wav";

then how to write iCustom call sentence correctly if i want to icustom use it? thanks for advice.

 
kenwa:
hi mladen,

may i ask, if for example, the indicator has following parameters in sequence:

extern int IndicatorPeriod = 10;

extern int Priceused = PRICE_CLOSE;

extern string comment1 = "0-close, 1-high, 2-low etc.";

extern int timeframe =0;

extern string comment2 = "0-current timeframe";

extern double Level1 = 70;

extern double Level2 = 30;

extern bool alerts = true;

extern bool alertsMessage = true;

extern bool alertsSound = false;

extern string soundFile = "alert.wav";

then how to write iCustom call sentence correctly if i want to icustom use it? thanks for advice.

The same way as in the previous example : you have to specify "" even for a parameter that is not used and the type is string. Please check the previous iCustom() call example (and how parameters are passed)

 

sorry mladen, i can only understand this

is it: ( i guess it should be wrong)

iCustom (Null, timeframe, "indicator name", IndicatorPeriod, Priceused, "", "", Level1, Level2, alerts, alertsMessage, alertsSound, "", modelineindex, i);

sorry repeat, if can delete this, may delete this one, please refer below.

 

sorry mladen, refer to #1862, i can only understand this

is it: ( i guess it should be wrong)

iCustom (Null, timeframe, "indicator name", IndicatorPeriod, Priceused, "", "", Level1, Level2, LinesColor1, color, showcolor, alerts, alertsMessage, alertsSound, "", modelineindex, i);

 
kenwa:
sorry mladen, i can only understand this

is it: ( i guess it should be wrong)

iCustom (Null, timeframe, "indicator name", IndicatorPeriod, Priceused, "", "", Level1, Level2, alerts, alertsMessage, alertsSound, "", modelineindex, i);

sorry repeat, please refer below.

Yes, but if you do it that way then the sound file will be "" (nothing). Use "alert.wav" for the last parameter

 

mladen,

is there any rules when to quote the left parameter name(soundFile, or just "",), when to quote the exact name on the right(alert.wav) need "alert.wav" or not, just alert.wav?, like the example of : extern string soundFile = "alert.wav"; any where teach or have more examples on icustom? thanks for advice again.

 
kenwa:
mladen, is there any rules when to quote the left parameter name(soundFile, or just "",), when to quote the exact name on the right(alert.wav) need "alert.wav" or not, just alert.wav?, like the example of : extern string soundFile = "alert.wav"; any where teach or have more examples on icustom? thanks for advice again.

If the parameter is used within the indicator, than it should have appropriate value. If the parameter is used only as a comment or an information for users (like the comment1 and comment2 parameters from your example) then you can use "" as a value that is passed to iCustom() call

 

hi mladen,for parameter used in the indicator, do i need "alert.wav", or just alert.wav,? thanks

 
kenwa:
hi mladen,for parameter used in the indicator, do i need "alert.wav", or just alert.wav,? thanks

It is a string parameter. You need "alert.vaw"

Reason: