Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Tams

Adding Sound to Your Indicator (EasyLanguage)

Recommended Posts

This thread is about Adding Sound to your Indicator (EasyLanguage)

 

 

 

syntax:

 

PlaySound

 

Plays the specified wave (.wav) sound file.

 

Usage

 

PlaySound("PathFilename")

 

Where: PathFilename - a string expression specifying the path and filename of the wave file to be played

 

Example

 

Play ding.wav sound file located in the root directory of the C: hard drive:

 

PlaySound("C: \ding.wav");

 

 

 

 

source: EasyLanguage manual

Share this post


Link to post
Share on other sites

I was missing alerts for my strategy exit.

 

If it is intrabar and works in signal , that's very interesting :)

 

Because alert plays at the end of the bar... sometimes that's too late.

 

And repeat is quite boring.

Share this post


Link to post
Share on other sites

Right now the alert says "support 1 mn" every seconds during 1 mn...:crap:

 

Stressing, specially now with a terribly bullish market (2.60 % and NY opens in 1 hour)

 

This alert should be better if it starts only once in intrabar

 

I will test your solution

Share this post


Link to post
Share on other sites

Please TAMS , Next topic = regression channel :)

 

The chart shows the end run of a huge wave

 

Question =

 

Could it be possible to cross the higher trendline ?

 

The regression channel has the answer ?

 

Market is like a donkey trying to reach the carot line :roll eyes:

Untitled-1.thumb.jpg.27218675c9f731c258bdc875cc16fa49.jpg

Share this post


Link to post
Share on other sites
Please TAMS , Next topic = regression channel :)

...

 

 

I think there are already a few threads on that.

but you can always start a new thread.

 

;-)

Share this post


Link to post
Share on other sites

I've done that

 

// Alert

if Value1 > Value1[1] 		then
             PlaySound("D:\MyPath\Audio\support 1 mn.wav"); 
//		Alert( " Support" 		);

 

it is like this

 

you can configure the sound criteria in ALERT.

 

pls see attached.

 

Each time the condition is true it plays the sound like this during 1 mn

 

support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn support 1 mn...

 

:crap:

Share this post


Link to post
Share on other sites

The playsound is repeated...

because every time a tick came through, the conditional statement is evaluated.

if the condition is true... then the Playsound statement is executed.

 

to make the sound play once only, you have to add a few things...

 

 

input:
soundon(true);

var:
play.once(0);


if  Value1 > Value1[1]
and [color="Red"]soundon and play.once <> currentbar[/color] then
begin
playsound("C:\soundfiles\support 1 mn.wav");
play.once = currentbar; 
end;

Share this post


Link to post
Share on other sites

It still repeats on each tick instead of only the first one

 

It is a 1 mn chart

 

// Alert

if Value1 > Value1[1] and soundon and play.once <> currentbar 		then
begin
	PlaySound("D:\soundfiles\Support 1 mn.wav");
	play.once = currentbar; 
end;

Share this post


Link to post
Share on other sites
It still repeats on each tick instead of only the first one

It is a 1 mn chart

 

 

ARH... SORRY... I missed one little keyword.

I have highlighted it in red below:

 

 

input:
soundon(true);

var:
[b][color="Red"]intrabarpersist[/color][/b] play.once(0);


if  Value1 > Value1[1]
and soundon and play.once <> currentbar then
begin
playsound("C:\soundfiles\support 1 mn.wav");
play.once = currentbar; 
end;

Share this post


Link to post
Share on other sites

It works fine Tams

 

nice code

 

It is a small walk for a trader and and big one for the community :haha:

 

no really, we have a vocal signal at the same time the indicator plots

 

no x seconds delay or a stressing multiple vocal

 

REAL TIME

Share this post


Link to post
Share on other sites

Before I used

 

myIndicatorUp

myIndicatorDn

 

and set a different message in Tab alert setting

 

Now I use

 

myIndicator

 

with 2 different vocal alerts (Up + Dn or more)

 

I use omnipage vocal engine

 

If you don't have a vocal engine tell me the messages you need and I will create them and post them here

inputs: 
soundon(		1	),
Vocal.Up(		PlaySound("D:\Audio\Support 1 mn.wav")    ),
Vocal.Dn(		PlaySound("D:\Resistance 1 mn.wav") ),

var:
intrabarpersist play.once(		0	);

// Alerts

// Alert Support
if Value1 > Value1[1] and soundon <> 0 and play.once <> currentbar 		    then
begin	
	Vocal.Up ; 
	play.once = currentbar; 
end;

// Alert Resistance

if Value2 < Value2[1] and soundon <> 0 and play.once <> currentbar 		     then
begin
	Vocal.Dn ; 
	play.once = currentbar; 
end;

Share this post


Link to post
Share on other sites

Correction

 

inputs: 
soundon(		1	),
Vocal.Up(		PlaySound("D:\MC.Audio\Your.Vocal.Up.wav")    ),
Vocal.Dn(		PlaySound("D:\MC.Audio\Your.Vocal.Dn.wav") ),

var:
intrabarpersist play.once(		0	);

// Alerts

// Alert Support
if Value1 > Value1[1] and soundon <> 0 and play.once <> currentbar 		    then
begin	
	Vocal.Up ; 
	play.once = currentbar; 
end;

// Alert Resistance

if Value2 < Value2[1] and soundon <> 0 and play.once <> currentbar 		     then
begin
	Vocal.Dn ; 
	play.once = currentbar; 
end;

Share this post


Link to post
Share on other sites

Is The vocal in my signal correct ?

 

Because it plays before, after, without no reasons

 


{---------------- Long Side ----------------}
// Entrie

... (no change)

// Exits

if marketposition = 1 then begin

if  my.conditions and soundon <> 0 and play.once <> currentbar then    	
begin
	Sell ("L1") 1 contracts this Bar ;
	Vocal.Up ; 
	play.once = currentbar; 
end;

Share this post


Link to post
Share on other sites

I think that I know :doh:

 

When my first condition of exit is reached the signal appears on my screen

 

When my second condition of exit is reached the signal appears on my screen

 

(I have 27 exits...)

 

If the condition1 < condition2 and condition1 > stop then

 

each time the price moves around condition1 the vocal sounds

 

If I'm right is there a way to correct that ?

Share this post


Link to post
Share on other sites

with the play.once counter,

the sound will only play ONCE per bar.

 

if you have difference sounds and different conditions,

you can use diffferent counters.

 

e.g.

 

var:

play.once.up(0),

play.once.dn(0),

play.once.buy(0),

play.once.sell(0),

... etc.,

Share this post


Link to post
Share on other sites

OK Tams I'm out of my trade (News 14:30 May601K April639K US unemployment and the future plouf 30 points... how do you say that , "stop hunting" ?)

 

I v'e enter only the first exit

 

if I change play.once with play.once.up

 

I will still have each mn the condition reached

 

is there a way to stop the vocal during the x mn untill the second condition or stop is reached ?

Share this post


Link to post
Share on other sites
OK Tams I'm out of my trade (News 14:30 May601K April639K US unemployment and the future plouf 30 points... how do you say that , "stop hunting" ?)

I v'e enter only the first exit

if I change play.once with play.once.up

I will still have each mn the condition reached

is there a way to stop the vocal during the x mn untill the second condition or stop is reached ?

 

 

I am not sure if I understand what you want.

 

can you list out the operation one action at a time?

Share this post


Link to post
Share on other sites

Oups

 

Sorry Tams

 

It is 22:23 in your huge island and 14:54 in my "tiny" land

 

I was wondering if x > y and delta<= marmelade... so stupid

 

If fact, I don't know why this is vocal chaotic

 

{---------------- Long Side ----------------}
// Entrie

... (no change)

// Exits

if marketposition = 1 then begin

if  my.condition1 and soundon <> 0 and play.once <> currentbar then    	
begin
	Sell ("L1") 1 contracts this Bar ;
	Vocal.Up ; 
	play.once = currentbar; 
end;

if  my.condition2  then 				
	Sell ("L2") 1 contracts this Bar ;

if  my.condition3  then 				
	Sell ("L3") 1 contracts this Bar ;

Share this post


Link to post
Share on other sites
Oups

Sorry Tams

It is 22:23 in your huge island and 14:54 in my "tiny" land

I was wondering if x > y and delta<= marmelade... so stupid

If fact, I don't know why this is vocal chaotic

 

 

 

What do you mean by vocal chaotic?

men's voice changed to boys'?

 

jk...

 

do you mean the sound kept playing non-stop?

 

I have never tried sound in a strategy, I thought it should work the same.

 

have you added the intrabarpersist in front of the variable?

Share this post


Link to post
Share on other sites
What do you mean by vocal chaotic?

men's voice changed to boys'?

 

HaHaHa !

 

Sorry if My english is bad

 

Spricht du Deutsch / Francais / Italian / espanol ?

 

If not, I will still torture you in your langage

 

 

 

I think that I understand/appreciate your code

 

 

When my first condition of exit is reached the signal appears on my screen

 

When my second condition of exit is reached the signal appears on my screen

 

(I have 27 exits...)

 

between the both the vocal sounds oftenly

 

I was wondering that

 

Condition1 reached = signal on screen + vocal

 

After

 

If the condition1 < condition2 and condition1 > stop

 

and condition = OK then

 

each time the price = my condition1 the vocal sounds once in the minute

 

OUF ! my brain is smoking !!!

 

Is ther a way to correct that

 

//-----------------------------------------------------
	inputs:
//----------------------------------------------------

soundon(		1	),
Vocal.Up(		PlaySound("D:\Sell 1 minute.wav")  ),
Vocal.Dn(		PlaySound("D:\Cover 1 minute.wav") );

//----------------------------------------------------------------	  
		variables: 
//----------------------------------------------------------------

intrabarpersist play.once(	0	);

{---------------- Long Side ----------------}
// Entrie

... (no change)

// Exits

if marketposition = 1 then begin

if  my.condition1 and soundon <> 0 and play.once <> currentbar then    	
begin
	Sell ("L1") 1 contracts this Bar ;
	Vocal.Up ; 
	play.once = currentbar; 
end;

if  my.condition2  then 				
	Sell ("L2") 1 contracts this Bar ;

if  my.condition3  then 				
	Sell ("L3") 1 contracts this Bar ;
etc...

Share this post


Link to post
Share on other sites
OUF ! my brain is smoking !!!

Is ther a way to correct that

 

Je suis désolé mais je ne comprends pas.

Je comprends un peu.

Pouvez-vous parler plus lentement ?

 

I took one year of German and one year of French in high school.

That was a long time ago... LOL. Don't try me.

 

 

If you are applying the sound to a 1 min chart, you will get a lot of hits.

you can add one more counter:

 

var:

order.filled(false);

 

if soundon and play.once <> currentbar AND order.filled = false then...

 

 

once the order is filled, the sound will stop.

Share this post


Link to post
Share on other sites

Aouch that's a 100 pts toilet flush !!

 

The vocal plays "Sell S1 1 minute" during all the "7' S" and each beginning of a minute

 

But not always...

 

step by step I'm sure that we will find :cool:

 

I join a pix to explain why I need vocal aids

 

I plot Histogramm colored down to the price wich hides the Signal

 

Big problem...

 

Because I love colored waves

 

1 - 2 - 3 hop !

 

Even tho it's automatic trades I use manual mode to reverse or go out the trade

 

And it's very quick = a few seconds to decide

 

This is why, dear Tams, RealTime Vocals is absolutely "indispensable" (let's try your French ) :(

 

//-----------------------------------------------------
	inputs:
//----------------------------------------------------

soundon(		1	),
Vocal.L1(		PlaySound("D:\Sell L1 1 minute.wav")  ),
Vocal.L2(		PlaySound("D:\Sell L2 1 minute.wav")  ),
Vocal.S1(	PlaySound("D:\Cover S1 1 minute.wav") );
Vocal.S2(	PlaySound("D:\Cover S2 1 minute.wav") );

//----------------------------------------------------------------	  
		variables: 
//----------------------------------------------------------------

intrabarpersist play.once(	0	),
order.filled(		false	);

{---------------- Long Side ----------------}
// Entrie

... (no change)

// Exits

if marketposition = 1 then begin

if  my.condition1 and soundon <> 0 and play.once <> currentbar AND order.filled = false then    	
begin
	Sell ("L1") 1 contracts this Bar ;
	Vocal.S1 ; 
	play.once = currentbar; 
end;

if  my.condition2  then 				
	Sell ("L2") 1 contracts this Bar ;

if  my.condition3  then 				
	Sell ("L3") 1 contracts this Bar ;
etc...

Untitled-1.thumb.jpg.70c42c1a834746f2da150170efed1003.jpg

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.