Hi
I have a study where I have custom alarms for specific symbols with dedicated sounds for each.
I have 8 charts, each with a different symbol, each with the alert study.
I have an input that sets the alerts true/false and has you can imagine, if one needs to switch off temporarily all the alerts one needs to open 8 study settings and set to false 8 inputs. The same when we decide to set it to true.
I did request some button that would disable all alerts which would facilitate when we have many set on.
I just had an idea here and I'd like to know if it's possible to do it.
Using ELCollection functions or ADE, is it possible to set a true/false input that would set the alert input on the study used on the other charts? The idea here would be with a single input I could switch on/off all the others.
Thanks
Need your wisdom for idea that I had [SOLVED]
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Need your wisdom for idea that I had
It can be done.
I prefer to use GV, because it is built-in to MultiCharts.
1. Create a "GV Sender" indicator, with a "True/False" input parameter.
2. On each of your charts' indicators, add a "GV Receiver" feature.
The receiver will read the sender's input "Condition";
if the condition is "True", then playsound,
if the condition is "False", then don't playsound.
QED
I prefer to use GV, because it is built-in to MultiCharts.
1. Create a "GV Sender" indicator, with a "True/False" input parameter.
2. On each of your charts' indicators, add a "GV Receiver" feature.
The receiver will read the sender's input "Condition";
if the condition is "True", then playsound,
if the condition is "False", then don't playsound.
QED
- arnie
- Posts: 1594
- Joined: 11 Feb 2009
- Location: Portugal
- Has thanked: 481 times
- Been thanked: 514 times
Re: Need your wisdom for idea that I had
Am I missing something?
I only have 6 GV functions
Don't I need a boolean function so I can set a true/false input?
I only have 6 GV functions
Don't I need a boolean function so I can set a true/false input?
- Attachments
-
- gv.png
- (4.28 KiB) Downloaded 1205 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Need your wisdom for idea that I had
You can download a manual here.Am I missing something?
I only have 6 GV functions
Don't I need a boolean function so I can set a true/false input?
viewtopic.php?f=16&t=10094
Warning: Very dry reading.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
- arnie
- Posts: 1594
- Joined: 11 Feb 2009
- Location: Portugal
- Has thanked: 481 times
- Been thanked: 514 times
Re: Need your wisdom for idea that I had
Your example is not that hard to understand but the manual... well, that's another story.
The manual talks about the GVSetNamedBool function but MC does not have this one. Well the manual shows a lot of functions that MC don't have.
I'm certain that I'm missing something here.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
- arnie
- Posts: 1594
- Joined: 11 Feb 2009
- Location: Portugal
- Has thanked: 481 times
- Been thanked: 514 times
Re: Need your wisdom for idea that I had
my first attempt which obviously doesn't word as expected
Code: Select all
input:
Send_Receive (1),
Price1 (2000),
plot_it (true);
variables:
price_1 (0);
if Send_Receive = 1 then begin
price_1 = GVSetNamedBool("price1", plot_it);
end
else begin
if GVGetNamedBool("price1") then
plot1(price1);
end;
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Need your wisdom for idea that I had
I would use the KISS principle...my first attempt which obviously doesn't word as expected
::
adopt a numeric GV... use "1" as play sound, and "0" as don't play sound.
- Smoky
- Posts: 518
- Joined: 03 Dec 2010
- Location: Thailand
- Has thanked: 99 times
- Been thanked: 121 times
Re: Need your wisdom for idea that I had
Code: Select all
input:
Send_Receive (1),
Price1 (2000),
plot_it (true);
variables:
GVret (0);
if Send_Receive = 1 then begin
GVret = GVSetNamedBool("price1", plot_it);
end
else begin
if GVGetNamedBool("price1") = true then
plot1(Price1);
end;
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Need your wisdom for idea that I had [SOLVED]
Indicator 1:
Indicator 2:
Gives as output:
After adding both indicators to separate charts, I disabled indicator 2 (which by default was enabled; see input). As the output shows, this also caused indicator 1 to say it was "disabled". After turning indicator 2 back on, this indicator was enabled again as was indicator 1.
Code: Select all
// Indicator 1
Inputs:
AllEnabled(True);
if (CurrentBar = 1) then
GVSetNamedBool("allonoff", AllEnabled);
if (LastBarOnChart_s) then begin
if (GVGetNamedBool("allonoff")) then
Print("Indicator #1: enabled.")
else
Print("Indicator #1: disabled.");
end;
Code: Select all
// Indicator 2
Inputs:
AllEnabled(True);
if (CurrentBar = 1) then
GVSetNamedBool("allonoff", AllEnabled);
if (LastBarOnChart_s) then begin
if (GVGetNamedBool("allonoff")) then
Print("Indicator #2: enabled.")
else
Print("Indicator #2: disabled.");
end;
Code: Select all
Indicator #1: enabled.
Indicator #2: enabled.
Indicator #2: enabled.
Indicator #1: enabled.
Indicator #1: enabled.
Indicator #2: enabled.
Indicator #2: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #2: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #2: disabled.
Indicator #1: disabled.
Indicator #2: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #2: disabled.
Indicator #1: disabled.
Indicator #1: disabled.
Indicator #2: enabled.
Indicator #1: enabled.
Indicator #1: enabled.
Indicator #2: enabled.
Indicator #1: enabled.
Indicator #2: enabled.
Indicator #1: enabled.
Indicator #1: enabled.
- arnie
- Posts: 1594
- Joined: 11 Feb 2009
- Location: Portugal
- Has thanked: 481 times
- Been thanked: 514 times
Re: Need your wisdom for idea that I had
It's so beautiful when we see something working as expected
I add to my clock window a text which will act as a button so I can easily switch ON/OFF the alerts.
Now I need to see how the different time templates will react.
The send study is on a 24/7 template while the receivers have their own session template.
Truth be told, the alerts are to be ON 99% of the time but sometimes they can be quite annoying when you try to concentrate on something and the entire market decides to make new highs/lows at the same time.
Again, many thanks for your help
I add to my clock window a text which will act as a button so I can easily switch ON/OFF the alerts.
Now I need to see how the different time templates will react.
The send study is on a 24/7 template while the receivers have their own session template.
Truth be told, the alerts are to be ON 99% of the time but sometimes they can be quite annoying when you try to concentrate on something and the entire market decides to make new highs/lows at the same time.
Again, many thanks for your help
- Attachments
-
- alertson.png
- (92.13 KiB) Downloaded 1053 times
-
- alertsoff.png
- (88.58 KiB) Downloaded 1055 times
- arnie
- Posts: 1594
- Joined: 11 Feb 2009
- Location: Portugal
- Has thanked: 481 times
- Been thanked: 514 times
Re: Need your wisdom for idea that I had
So here is an example of the sender and of the receiver which triggers the alert for the NYSE Breath indicator.
SEND
RECEIVER
I decided to put the send on its own subchart since it's easier to manage the text.
The text on the receiver side serves only to check if both studies are in sync
SEND
Code: Select all
// 2014-09-12
// Sends the signal to switch ON/OFF the alerts on the other charts
Inputs:
PlayAlerts (True),
Position (0),
TextSpace (22),
FontName ("ms ui gothic"),
FontSize (12);
variables:
AlertTxt (-1);
if CurrentBar = 1 then begin
GVSetNamedBool("allonoff", PlayAlerts);
AlertTxt = text_new_self_s(date, time_s, Position, "");
text_setstyle(AlertTxt, 1, 0);
text_setsize(alerttxt, fontsize);
text_setfontname(alerttxt, fontname);
text_lock(alerttxt, true);
end;
if LastBarOnChart_s then begin
if BarStatus(1) = 2 then begin
text_setlocation_s(alerttxt, date, time_s, Position);
end;
if (GVGetNamedBool("allonoff")) then begin
text_setstring(alerttxt, "Price Alerts are ON" + spaces(textspace));
text_setcolor(alerttxt, green);
end
else begin
text_setstring(alerttxt, "Price Alerts are OFF" + spaces(textspace));
text_setcolor(alerttxt, red);
end;
end;
RECEIVER
Code: Select all
// 2014-09-12
// Receives the signal to switch ON/OFF the alerts
Input:
ShowAlertText (false),
AlertsLocation ("C:\Sounds"),
ShowLines (false),
HiLoColor (rgb(13,40,16)),
MidColor (rgb(13,40,16)),
MinutesOffSet (1), // The number of minutes the clock is displayed from the right of the chart
TicksOffSet (15); // The number of ticks the clock is displayed below top of the chart
Variables:
isAlertOff (-1),
StDate (false),
dailyHi (-999999),
dailyLo (+999999),
dailyCl (0),
dailyMid (0),
intrabarpersist myCurrentBar (0),
intrabarpersist haveHiAlert (false),
intrabarpersist haveLoAlert (false),
highTL (-1),
lowTL (-1),
midTL (-1),
AlertText (-1),
startDate (0),
startTime (0),
dayHigh (0),
dayLow (0),
minuteOffSet (ELTimeToDateTime(MinutesOffSet)), // Minutes to offset in DateTime format
tickOffSet ((MinMove / PriceScale) * TicksOffSet); // Number of ticks to offset3
If AlertEnabled = False And LastBarOnChart_S = True Then
isALertOff = Text_New_S(Date, Time_S, Low, "Enable alerts at Format Study > Alerts > Enable Alerts");
text_setfontname(isAlertOff, "arial black");
text_setsize(isAlertOff, 12);
text_setcolor(isAlertOff, white);
text_setstyle(isAlertOff, 1, 2);
once begin
if ShowAlertText = true then begin
AlertText = text_new_s(JulianToDate(airightDispDateTime), GetAppInfo(airightDispDateTime), GetAppInfo(aiHighestDispValue) - tickOffSet, "");
text_setstyle(alerttext, 1, 2);
end;
end;
if LastBarOnChart_s then begin
Text_SetLocation_s(alerttext,
JulianToDate(GetAppInfo(aiRightDispDateTime)),
DateTime2ELTime_s(GetAppInfo(aiRightDispDateTime) - minuteOffSet),
GetAppInfo(aiHighestDispValue) - tickOffSet);
if (GVGetNamedBool("allonoff")) then begin
text_setstring(alerttext, "Price Alerts\nare ON");
end
else begin
text_setstring(alerttext, "Price Alerts\nare OFF");
end;
end;
if date <> date[1] then begin
stDate = true;
dailyHi = -999999;
dailyLo = +999999;
startTime = time_s;
startDate = date;
end;
if stDate then begin
//reset Alert flag on beginning of new bar
if CurrentBar <> MyCurrentBar then begin
MyCurrentBar = Currentbar;
HaveHiAlert = false;
HaveLoAlert = false;
end;
// Set day's high, low and range
if High > dailyHi then begin
dailyHi = High;
if GVGetNamedBool("allonoff") = true then begin
if haveHiAlert = false and LastBarOnChart_s {and barstatus(1) = 2} then begin
haveHiAlert = true;
Alert(" Breath made new highs ");
PlaySound(AlertsLocation + "\BreathNewHighs.wav");
end;
end;
end;
if Low < dailyLo then begin
dailyLo = Low;
if GVGetNamedBool("allonoff") = true then begin
if haveLoAlert = false and LastBarOnChart_s {and barstatus(1) = 2} then begin
haveLoAlert = true;
Alert(" Breath made new lows ");
PlaySound(AlertsLocation + "\BreathNewLows.wav");
end;
end;
end;
dayHigh = dailyHi;
dayLow = DailyLo;
dailyMid = (dayHigh + dayLow ) *.50;
if ShowLines = true then begin
plot1(dayHigh,"High", HiLoColor);
plot3(dayLow,"Low", HiLoColor);
plot5(dailyMid,"Mid", MidColor);
end;
end;
I decided to put the send on its own subchart since it's easier to manage the text.
The text on the receiver side serves only to check if both studies are in sync
- Attachments
-
- receive.png
- (28.45 KiB) Downloaded 1035 times
-
- send.png
- (1.16 KiB) Downloaded 1034 times