Detecting a script is running on chart or scanner  [SOLVED]

Questions about MultiCharts and user contributed studies.
bowlesj3
Posts: 2090
Joined: 21 Jul 2007
Has thanked: 197 times
Been thanked: 416 times

Detecting a script is running on chart or scanner

Postby bowlesj3 » 14 Aug 2017

Hi, I want to run some scripts on both the scanner and the chart and I want to turn off some of my script plots on the scanner. Is there a way for a script to know it is running on a chart or a scanner?

Thanks,
John

User avatar
ABC
Posts: 626
Joined: 16 Dec 2006
Has thanked: 119 times
Been thanked: 355 times
Contact:

Re: Detecting a script is running on chart or scanner  [SOLVED]

Postby ABC » 14 Aug 2017

John,

yes, you can detect if a study is running in the Scanner or on a chart via GetAppInfo( aiApplicationType ).

Regards,

ABC

bowlesj3
Posts: 2090
Joined: 21 Jul 2007
Has thanked: 197 times
Been thanked: 416 times

Re: Detecting a script is running on chart or scanner

Postby bowlesj3 » 14 Aug 2017

Thanks ABC,

I had a feeling it was such. I could not remember the command "GetAppInfo" so I could not search for my notes (shown below) and not having used the scanner before I suspected that attribute would not be there. I just checked and it wasn't. I also remember that "GetAppInfo" was not documented when I was first learning MC (I picked up the notes from a forum thread) so I figure I would be best to ask.

I just checked the Wiki.
https://www.multicharts.com/trading-sof ... GetAppInfo
It is right at the top so things have gotten better. Time to read it top to bottom. I am curious if all my notes are in the wiki.
"Returns a numerical value, representing the specified attribute of the calling application.
Usage
GetAppInfo(Attribute)
Parameters
aiLeftDispDateTime - specifies return of the date and time of the leftmost bar displayed in the current chart window GetAppInfo will return the DateTime value of the leftmost bar displayed on a chart; the integer portion of the DateTime value specifies the number of days since January 1st, 1900, and the fractional portion of the DateTime value specifies the fraction of the day since midnight.
aiRightDispDateTime - specifies return of the date and time of the rightmost bar displayed in the current chart window GetAppInfo will return the DateTime value of the rightmost bar displayed on a chart; the integer portion of the DateTime value specifies the number of days since January 1st, 1900, and the fractional portion of the DateTime value specifies the fraction of the day since midnight.
aiBarSpacing - specifies return of the number of spaces between the bars on a chart GetAppInfo will return a value, indicating the bar spacing of a chart.
aiHighestDispValue - specifies return of the highest price value that could be displayed in the current chart window GetAppInfo will return the highest price value that could be displayed on a chart.
aiLowestDispValue - specifies return of the lowest price value that could be displayed in the current chart window GetAppInfo will return the lowest price value that could be displayed on a chart.
aiSpaceToRight - specifies return of the right margin, in bars, of the current chart window GetAppInfo will return the right margin, in bars, of a chart.




aiOptimizing - specifies return of a numerical value, indicating whether the calling application is currently performing an optimization GetAppInfo will return a value of 1 only if the calling application is currently performing an optimization, and a value of 0 in all other cases.
aiStrategyAuto - specifies return of a numerical value, indicating whether the calling application is using Automated Trade Execution GetAppInfo will return a value of 1 only if the calling application is using Automated Trade Execution, and a value of 0 in all other cases.
aiStrategyAutoConf - specifies return of a numerical value, indicating whether the calling application is using Automated Trade Execution with order confirmation turned off GetAppInfo will return a value of 0 only if the calling application is using Automated Trade Execution with order confirmation turned off, and a value of 1 in all other cases.
aiIntrabarOrder - specifies return of a numerical value, indicating whether the calling application is running the signal with intra-bar order generation turned on GetAppInfo will return a value of 1 only if the calling application is running the signal with intra-bar order generation turned on, and a value of 0 in all other cases.
aiAppId - specifies return of a numerical value, used to identify the calling application GetAppInfo will return a unique non-zero integer identifying the calling application.
aiRealTimeCalc - specifies return of a numerical value, indicating whether the calling application's calculations are based on real-time data GetAppInfo will return a value of 1 only if the calling application's calculations are based on real-time data, and a value of 0 in all other cases.
Example
GetAppInfo(aiBarSpacing) will return a value, indicating the bar spacing of a chart
GetAppInfo(aiStrategyAutoConf) will return a value of 0 if the calling application is using Automated Trade Execution with order confirmation turned off; otherwise, will return a value of 1
GetAppInfo(aiRealTimeCalc) will return a value of 1 if the calling application's calculations are based on real-time data; otherwise, will return a value of 0
"


Return to “MultiCharts”