How can I test in an indicator if a signal that is applied to a particular chart is turned ON or OFF ?
Each strat has indeed its own Id (aiAppId), but how may I check its status (on/off) from an indic ?
Thanks
How to test from an Indicator if a Signal is ON or OFF
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: How to test from an Indicator if a Signal is ON or OFF
Dear ym58,
You can do it only using Global Variables. If the signal is on, it sends a value to Global Variables, if the signalis off, it doesn't.
You can do it only using Global Variables. If the signal is on, it sends a value to Global Variables, if the signalis off, it doesn't.
Re: How to test from an Indicator if a Signal is ON or OFF
I thought about GV's, Dave, but it does not work 'real time' ... see :
#1 - strat is on, it sets GV to on, indicator sees the GV on ... good
#2 - strat is set off, it does not set GV to off, indicator still thinks strat is on because GV is still on ... not good
Do tou see any wayround to keep this GV updated 'realtime' ?
Thanks.
#1 - strat is on, it sets GV to on, indicator sees the GV on ... good
#2 - strat is set off, it does not set GV to off, indicator still thinks strat is on because GV is still on ... not good
Do tou see any wayround to keep this GV updated 'realtime' ?
Thanks.
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: How to test from an Indicator if a Signal is ON or OFF
Dear ym58,
Apparently it can be done only by changing the source code of Global Variables. This source code should be in open access.
General concept is:
1) Dll functions can be called when a study is created and turned on or off. The following methods should be used:
OnCreate
OnDestroy
2) A corresponding function should be defined in dll.
Example:
Here are the prototypes for the DLL functions that will be called on the Create and Destroy
events.
int __stdcall MYCREATEFUNC(IEasyLanguageObject *pEL);
int __stdcall MYDESTROYFUNC(IEasyLanguageObject *pEL);
Here is a typical directive construct that may be used to run the DLL functions above for an
EasyLanguage study.
#Events
OnCreate = MyCreateFunc;
OnDestroy = MyDestroyFunc;
#End
OnDestroy is called when the study is turned off or deleted.
Apparently it can be done only by changing the source code of Global Variables. This source code should be in open access.
General concept is:
1) Dll functions can be called when a study is created and turned on or off. The following methods should be used:
OnCreate
OnDestroy
2) A corresponding function should be defined in dll.
Example:
Here are the prototypes for the DLL functions that will be called on the Create and Destroy
events.
int __stdcall MYCREATEFUNC(IEasyLanguageObject *pEL);
int __stdcall MYDESTROYFUNC(IEasyLanguageObject *pEL);
Here is a typical directive construct that may be used to run the DLL functions above for an
EasyLanguage study.
#Events
OnCreate = MyCreateFunc;
OnDestroy = MyDestroyFunc;
#End
OnDestroy is called when the study is turned off or deleted.
Re: How to test from an Indicator if a Signal is ON or OFF
Dave,
I am not familiar AT ALL with DLL programming and/or GV's code improvements, nor do I know, besides, WHERE to post an improvement request.
I really wish I could find something simpler and more straightforward that would use standard features of GV's.
Any clue ?
I am not familiar AT ALL with DLL programming and/or GV's code improvements, nor do I know, besides, WHERE to post an improvement request.
I really wish I could find something simpler and more straightforward that would use standard features of GV's.
Any clue ?
- Dave Masalov
- Posts: 1712
- Joined: 16 Apr 2010
- Has thanked: 51 times
- Been thanked: 489 times
Re: How to test from an Indicator if a Signal is ON or OFF
Dear ym58,
Probably, there is an easier way to do this. However, we are not aware of it. If you are interested in custom programming services, we can do it for you at additional price.
Probably, there is an easier way to do this. However, we are not aware of it. If you are interested in custom programming services, we can do it for you at additional price.