Alert Multicharts  [SOLVED]

Questions about MultiCharts and user contributed studies.
ctu1121
Posts: 135
Joined: 05 Jul 2012
Has thanked: 10 times
Been thanked: 4 times

Chart Alert Function  [SOLVED]

Postby ctu1121 » 22 May 2015

Hi there,
May I know if there is Alert function for Multicharts Chart.
For example, I open YM chart and setup alert. While YM is above 18300, then Multicharts will
popup a message or send me email to notify me YM is above 18300.

Thanks for your information.

Charles

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Chart Alert Function

Postby JoshM » 22 May 2015

May I know if there is Alert function for Multicharts Chart.
For example, I open YM chart and setup alert. While YM is above 18300, then Multicharts will popup a message or send me email to notify me YM is above 18300.
Yes, there is such a function. See the Alert() keyword. To check in your script whether the alerts are enabled the CheckAlert keyword can be used.

Here's how to use and enable alerts: using alerts - wiki and here's a code example: once per bar alert - wiki.

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Alert Multicharts

Postby filippo.milano » 14 Sep 2016

Hi,
i'm coding an alert just to receive an email and computer alert when conditions are on, but the push message on the video arrive every minute or 5 minutes, it dipends on the graph and also the mail arrive every 1/5 minute... i don't know what happens with my code it seems the alarm it's always on. Maybe someting wrong on my code, maybe i have to set off the alarm.

here the code:

Code: Select all

condition1 = time > 0800 and time < 2130 ;
if condition1 then
begin

condition2 = marketposition = 0 and ....;
if condition2 then
begin
buy ( "Long 1 contratto" ) this bar at Close;
Alert(text("Long 1 contratto Crude Oil"));
end;

condition3 = marketposition = 0 and ....;
if condition3 then
begin
sellshort ( "Short 1 contratto" ) this bar at Close;
Alert(text("Short 1 contratto Crude Oil"));
end;

condition4 = ... and CurrentContracts = 1;
if condition4 then
begin
buytocover 1 contracts on this bar at Close;
buy ( "Long 3 contratti" ) 2 contracts on this bar at Close ;
Alert(text("Long 3 contratti Crude Oil"));
end;


.....
Last edited by filippo.milano on 14 Sep 2016, edited 2 times in total.

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

Re: Alert Multicharts

Postby TJ » 14 Sep 2016

Hi,
i'm coding an alert just to receive an email and computer alert when conditions are on, but the push message on the video arrive every minute or 5 minutes, it dipends on the graph and also the mail arrive every 1/5 minute... i don't know what happens with my code it seems the alarm it's always on. Maybe someting wrong on my code, maybe i have to set off the alarm.

here the code:

condition1 = time > 0800 and time < 2130 ;
if condition1 then
begin

condition2 = marketposition = 0 and ....;
\if condition2 then
begin
buy ( "Long 1 contratto" ) this bar at Close;
Alert(text("Long 1 contratto Crude Oil"));
end;

condition3 = marketposition = 0 and ....;
if condition3 then
begin
sellshort ( "Short 1 contratto" ) this bar at Close;
Alert(text("Short 1 contratto Crude Oil"));
end;

condition4 = ... and CurrentContracts = 1;
if condition4 then
begin
buytocover 1 contracts on this bar at Close;
buy ( "Long 3 contratti" ) 2 contracts on this bar at Close ;
Alert(text("Long 3 contratti Crude Oil"));
end;


.....

Wiki is your best friend:
Triggering an alert once per bar
https://www.multicharts.com/trading-sof ... _bar_alert

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

Re: Alert Multicharts

Postby TJ » 14 Sep 2016

See posts #1, #2 & #5
[FAQ] How to Get Help
viewtopic.php?f=16&t=11713

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

Re: Alert Multicharts

Postby TJ » 14 Sep 2016

See post #7

[FAQ] This Bar on Close
viewtopic.php?f=16&t=10811

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Alert Multicharts

Postby filippo.milano » 14 Sep 2016

I just need the message and the email. I'm not going real with multicharts for the moment, but thanks.
Anyway, on the graph the message are correct but the alert (mail and pushup) are not, they come out every bar, i just need they come out excately when message come out on the graph.

Many thanks

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Alert Multicharts

Postby filippo.milano » 14 Sep 2016

maybe i should write something like this:

Code: Select all

condition1 = ... and marketposition = 0;
if condition1 then
begin
buy ( "Long" ) this bar at Close;
alertActive = true;

end;

If condition1 and alertActive = true then
begin
Alert(text("Long 1 contratto S&P"));
alertActive = false;
end;

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

Re: Alert Multicharts

Postby TJ » 14 Sep 2016

I just need the message and the email. I'm not going real with multicharts for the moment, but thanks.
Anyway, on the graph the message are correct but the alert (mail and pushup) are not, they come out every bar, i just need they come out excately when message come out on the graph.

Many thanks
If they come out every bar, but not exactly when you wanted it to,
then there is a problem in your logic.


You should try the "Alert" with simple test codes first.

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Alert Multicharts

Postby filippo.milano » 14 Sep 2016

I don't understand because the logic it's correct, also in the graph i see all ok but the alarm no...
i figured out that when the strategy set up on a new entry and generate it on the graph i can see all ok, the entry it's fine but the alarm start and every bar, after that, generate a new alarm...

I hope you can help me with the logic of the alarm...

Many thanks!

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

Re: Alert Multicharts

Postby TJ » 14 Sep 2016

I don't understand because the logic it's correct, also in the graph i see all ok but the alarm no...
i figured out that when the strategy set up on a new entry and generate it on the graph i can see all ok, the entry it's fine but the alarm start and every bar, after that, generate a new alarm...

I hope you can help me with the logic of the alarm...

Many thanks!
Your logic is too complicated and triggers false signal,
that is why you are getting alarm every bar.

Go to the link I gave you above.

COPY the code and do your testing from there.

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Alert Multicharts

Postby filippo.milano » 14 Sep 2016

I don't need an alarm every bars, or ticks, i need an alarm just when the conditions of the strategy are on then generate a sell or a buy and then generate an alarm to let me see that...
why the alarm goes every bar and come out?

Could you just see my code and exeplain me why the alarm goes out every bar?

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Alert Multicharts

Postby filippo.milano » 14 Sep 2016

Should i write something like this?

Code: Select all


Variables:
IntraBarPersist alertAlreadyGiven(False);

if (CheckAlert = True) then begin


if (alertAlreadyGiven = False) and ...(my condition) then begin

Alert(Text("Buy 1 contract!"));

alertAlreadyGiven = True;
end;


if (BarStatus(1) = 2) then
alertAlreadyGiven = False;

end;



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

Re: Alert Multicharts

Postby TJ » 14 Sep 2016

::
why the alarm goes every bar and come out?
Your alarm goes off BECAUSE your code tells it to go off.

Could you just see my code and exeplain me why the alarm goes out every bar?
* NO I CANNOT SEE IT * You have not posted the code.

Code: Select all

condition1 = ... and marketposition = 0;


I repeat my advice to you again -- COPY the example and start from there.

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Alert Multicharts

Postby filippo.milano » 14 Sep 2016

If i'm asking to help me TJ, it's just because ARE DAYS THAT I'M WORKING ON THIS!!!

Sorry TJ if i'm asking your help, but i'm not a mastermind!!!

I just need to know the logic of the alarm and this link (https://www.multicharts.com/trading-sof ... _bar_alert) that you gave me is not enough for me!

I tried to rewrite my code with this advise but it doesn't work!

Could you just please write me a code of example after watching my code just to let me understand...

Thanks a lot!

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Alert Multicharts

Postby filippo.milano » 14 Sep 2016

I just need to have an alarm when the strategy buy or sell a contract, not for every bar after this!!!

My logic it's correct, the logic of the alarm is crazy!!!

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Chart Alert Function

Postby filippo.milano » 14 Sep 2016

Hi JoshM,
sorry just a question, can you help me...

I don't understand the logic of the alarm... i just want an email when my strategy goes at market but this funcion alarm i don't know why send me thousand of message after a condition it's on...

an example of my code...

Code: Select all

if close > MA30 then begin
buy 1 contracts on this bar at close;
alert(text("1 contracts long"));
end;

If close < MA30 then begin
sell 1 contracts on this bar at close;
alert(text("1 contracts short"));
end;
Thanks in advance for your help

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Re: Alert Multicharts

Postby filippo.milano » 14 Sep 2016

Code: Select all

if close > MA30 then begin
buy 1 contracts on this bar at close;
alert(text("1 contracts long"));
end;

If close < MA30 then begin
sell 1 contracts on this bar at close;
alert(text("1 contracts short"));
end;
this is an example, so you can understand

filippo.milano
Posts: 44
Joined: 02 Jan 2015
Has thanked: 1 time

Alert email and sound

Postby filippo.milano » 14 Sep 2016

Hi everybody,
i have a problem... i just need an alarm when the buy or sell condition are on. Someone could help me?
This is an example of my code:

Code: Select all

if close > "moving average 30" then begin
buy 1 contracts on this bar at close;
alert(text("1 contracts long"));
end;

If close < "moving average 30" then begin
sell 1 contracts on this bar at close;
alert(text("1 contracts short"));
end;
I don't understand why i got an alarm every bar if i write to have a text alarm on the condition.
Maybe someone could help me, and let me know what it's wrong with my code with the correct code...

Many thanks a lot in advance.

Filippo

User avatar
CrazyNasdaq
Posts: 318
Joined: 02 Sep 2009
Location: ITALY
Has thanked: 97 times
Been thanked: 86 times

Re: Chart Alert Function

Postby CrazyNasdaq » 16 Sep 2016

Hi JoshM,
sorry just a question, can you help me...

I don't understand the logic of the alarm... i just want an email when my strategy goes at market but this funcion alarm i don't know why send me thousand of message after a condition it's on...

an example of my code...

Code: Select all

if close > MA30 then begin
buy 1 contracts on this bar at close;
alert(text("1 contracts long"));
end;

If close < MA30 then begin
sell 1 contracts on this bar at close;
alert(text("1 contracts short"));
end;
Thanks in advance for your help
The alert is sent for every tick which matches the condition

Code: Select all

if close > MA30 then begin
if you want the alert is sent only if the position is +1 "1 contract long", you have to specify more accurately the statement
for example:

Code: Select all

if close > MA30 then begin // this condition starts the trade long
buy 1 contracts on this bar at close;
if marketposition[1]= 0 and marketposition = 1 then
alert(text("1 contracts long")); // this condition start the alert if the position is Long
end;


Return to “MultiCharts”