0% found this document useful (0 votes)
337 views2 pages

Global Variable Description

This document describes a DLL that allows storing and retrieving values as global variables in EasyLanguage that can be accessed across studies on the same chart or account. It includes functions to set and get integer, float, double, and string values in arrays. Sample studies are included to demonstrate setting values in an indicator on a 1-minute chart and getting them in a strategy on a 1-tick chart to generate trades. Users are warned there may be a one tick delay in retrieving values and not to use it for historical testing due to lack of time stamps.

Uploaded by

elgpak
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
337 views2 pages

Global Variable Description

This document describes a DLL that allows storing and retrieving values as global variables in EasyLanguage that can be accessed across studies on the same chart or account. It includes functions to set and get integer, float, double, and string values in arrays. Sample studies are included to demonstrate setting values in an indicator on a 1-minute chart and getting them in a strategy on a 1-tick chart to generate trades. Users are warned there may be a one tick delay in retrieving values and not to use it for historical testing due to lack of time stamps.

Uploaded by

elgpak
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

How it works: A DLL (Dynamic Link Library)

extension to EasyLanguage is a program written in C++, PowerBASIC or other programming language that can be accessed from within an EasyLanguage study. DLLs can perform actions that cannot be done easily or at all in EasyLanguage. Additionally, they might be used to speed up processing. This Global Variable DLL (GlobalVariable.dll) allows you to store values from Charting, RadarScreen or OptionStation. The stored values can be used in other studies within the same application (Charting, RadarScreen or OptionStation). You can set arrays of the following types: integers (whole numbers), float values (numbers with decimals), double values (double the significant figures of floats) and strings (text). There are 10,000 locations that can be set (0 to 9999) for each type. These global variable values have no associated time and date stamp. We do not recommend historically testing strategies based on this DLL. Also, there is only one array of each data type, if you use this in multiple techniques make sure you do not overwrite value locations. To make it easy to use this DLL, the ability to Set and Get global variables are wrapped in functions which you will probably want to use: Usage Examples: To Set Global Variables: Value1 = GVSetInteger( 0, 1500 ); {Where 0 is the array element location, and 1500 is the stored value} Value1 = GVSetFloat( 5, Close[1] ); {Where 5 is the array element location, and the close of one bar ago is the stored value. Note: Value1 is a dummy value used only to call the function.} Value1 = GVSetDouble( 5, Close[1] ); {Float allows for 7-8 significant figures, Double provides 15 significant figures} Value1 = GVSetString( 5, Some text goes here ) ; {String variables may be used, too }

To Get Global Variables: Value1 = GVGetInteger(0); { Assign to Value1 the integer value at element location 0 } Value1 = GVGetFloat(5); { Assign to Value1 the float value at element location 5 } Value1 = GVGetDouble( 5 ); {Assign to Value1 the Double value at element location 5 } MyStr = GVGetString( 5 ) ; {Assign to MyStr the string value at element 5 }

Included here with this Global Variable DLL, are two additional sample studies; an indicator that sets the global variables, and a strategy that gets the global variables. The indicator calculates a fast and slow moving average and passes those values to the strategy where it is generally assigned to a local variable. The strategy then looks for a the values to cross which generates a trade. The idea here is to use stored values from a minute chart, and use those values in a tick chart to be able to generate orders faster than using a minute chart alone. To begin, place the unzipped 'GlobalVariable.dll' file in your TradeStation/Program directory. Then import the Indicator, Strategy, and functions from the ELD file included in the zip file. Create two charts; a one-minute chart, and a 1-tick chart. Insert the GV_INDICATOR_SET indicator in the 1-minute chart and insert the GV_STRATEGY_GET strategy in the 1-tick chart. WARNING: Make sure that Strategy automation is NOT active. This Strategy may generate a large number of trades in a short time under certain circumstances. If you find an interesting way to use this DLL please share it with the other members of TradeStationWorld, by submitting your idea and study to the TradeStationWorld EasyLanguage Exchange. REMARKS: At times the Global Variables that are stored or retrieved may be 1 tick or more behind what you might expect. This is because there is no guarantee which indicator, strategy, or any other study will interact with the global variables first. Since values are stored or retrieved on a tick event, it may take one tick event to store and the next tick event to retrieve.
Inputs:FastLength(9) - A smaller

number of trailing bars for the Moving Average

calculation. SlowLength(18) a larger number of trailing bars for the Moving Average calculation
Entry/Plot Descriptions: When the Moving Average crosses

over the Moving Average on a

second chart that would be a potential Buy signal. When the Moving Average crosses under the Moving Average on a second chart that would be a potential Short signal
Suggested Modifications: You may want to change the bar intervals

of both charts, or use any

of the other indicators functions available.

You might also like