How to know on witch charts indicator indicator is apply

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

How to know on witch charts indicator indicator is apply

Postby arjfca » 24 Nov 2012

Hello

I got an indicator that is applied on 2 instruments. A simple test to show an inside bar is done. Mow, I want to add a voice message. I need to know on witch Instrument the indicator as detected an inside bar. Once detected, I save the value in a Global Variable. Actually I got the same message for both Instrument. I need to know witch one as been detected.

- How can I know witch data (data1 or data2 is in use)

Hope I'm clear....

Martin

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

Re: How to know on witch charts indicator indicator is apply

Postby TJ » 24 Nov 2012

Hello

I got an indicator that is applied on 2 instruments. A simple test to show an inside bar is done. Mow, I want to add a voice message. I need to know on witch Instrument the indicator as detected an inside bar. Once detected, I save the value in a Global Variable. Actually I got the same message for both Instrument. I need to know witch one as been detected.

- How can I know witch data (data1 or data2 is in use)

Hope I'm clear....

Martin
Look up

getsymbolname

User avatar
arnie
Posts: 1594
Joined: 11 Feb 2009
Location: Portugal
Has thanked: 481 times
Been thanked: 514 times

Re: How to know on witch charts indicator indicator is apply

Postby arnie » 24 Nov 2012

Hello

I got an indicator that is applied on 2 instruments. A simple test to show an inside bar is done. Mow, I want to add a voice message. I need to know on witch Instrument the indicator as detected an inside bar. Once detected, I save the value in a Global Variable. Actually I got the same message for both Instrument. I need to know witch one as been detected.

- How can I know witch data (data1 or data2 is in use)

Hope I'm clear....

Martin
Maybe add an input where you select the symbol which will then be used to trigger your voice alert...

Code: Select all

input:
Symbol ("ES");

if Symbol = "ES" then begin...
...
Alert("ES made an inside bar");
Playsound(text("C:\MCalerts\SnPMadeInsideBar.wav"));
end
else
if Symbol = "NQ" then begin
Alert("NQ made an inside bars");
Playsound(text("C:\MC_Sounds\NasMadeInsideBar.wav"));
end
else...
...

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: How to know on witch charts indicator indicator is apply

Postby arjfca » 24 Nov 2012

Hello

I got an indicator that is applied on 2 instruments. A simple test to show an inside bar is done. Mow, I want to add a voice message. I need to know on witch Instrument the indicator as detected an inside bar. Once detected, I save the value in a Global Variable. Actually I got the same message for both Instrument. I need to know witch one as been detected.

- How can I know witch data (data1 or data2 is in use)

Hope I'm clear....

Martin
Maybe add an input where you select the symbol which will then be used to trigger your voice alert...

Code: Select all

input:
Symbol ("ES");

if Symbol = "ES" then begin...
...
Alert("ES made an inside bar");
Playsound(text("C:\MCalerts\SnPMadeInsideBar.wav"));
end
else
if Symbol = "NQ" then begin
Alert("NQ made an inside bars");
Playsound(text("C:\MC_Sounds\NasMadeInsideBar.wav"));
end
else...
...

Hello Arnie

Congrat for your Input on MC. Your request about adding a way to draw a straight trend line as been added in the latest version

About my code: I' using this as a personal indicator for a 1Hour scale charts while I'm working on another worspace charts. If an Inside period is detected, it collect the data and save it in a global variable. Since I'm working with two instrument on my workspace, I need to find a way to save the info under a proper global variable

For the moment, I did use GetSymbolName to get the proper value. It workfine, only problem is that it is not versatile. The global variable is read by Excel and it is thigh to the named Instrument not to Market1. Market2

Code: Select all

If TestforIB then begin
If time_s >= 000000 and time_s <=100000 then begin
If IB then begin
If PlaySoundForIB then Playsound("G:\Users\Utilisateur\Documents\Bourse\Sound\One_Hour_Valid_IB.wav");
Value1 = GVSetNamedString(("IBLongEntry" + "_" + getsymbolname) ,NumtoStr((High),5));
Value1 = GVSetNamedString("IBShortEntry" + "_" + getsymbolname ,NumtoStr((Low),5));

ID = text_new(date,time,high , "IB" );
value1= text_setlocation(ID, date,time, (h + pipvalue *2));
value1 = text_setstyle(id,2,1);
value1 = Text_setcolor(ID,blue);
Value1 = Text_SetSize(id, 6);
end;
end; // If time`>0
end;
What the code do
1' Look if the bar is an inside bar within a time frame between 01 am and 10 am
2' a) If detected, play a recorded voice message
B) Save The data in a global named String. The variable name is relevant to the actual symbol that MC is running on
c) attach also the time start and end of the bar under test

Once detected, I hear the voice message. If I want to send order, I click on a Excel button that will be use to capture my entry price by reading the appropriate global variable string. Here is the non versatile problem occur. Since in Excel, I need to specify the name of the global variable string to look for, I need to know the market under review

My Excel code to read the returned value is:

Code: Select all

Sub GetIB_Entry()
IB_LongEntry_M1_STR = GV_GetNamedString("IBLongEntry_EUR.USD", "99999999")
IB_ShortEntry_M1_STR = GV_GetNamedString("IBShortEntry_EUR.USD", "99999999")
IB_LongEntry_M2_STR = GV_GetNamedString("IBLongEntry_GBP.USD", "99999999")
IB_ShortEntry_M2_STR = GV_GetNamedString("IBShortEntry_GBP.USD", "99999999")

End Sub
IN Excel, you see that I need to specify the named of the market "IBLongEntry_EUR.USD" in my Global variable name instead of using a generic name like Instrument_1.

I always try to code for an easy exportation or application in another chart instrument. I Did not succeed yet with this part.

Martin


Return to “MultiCharts”