Skip to content

Tutorial 206 | Using the OpenFileDialog class to access file in optimization app

T206-3

Speeded up image of an optimization

Tutorial 206 demonstrates the use of the OpenFileDialog class, wherby a user can select a file on their hard drive and download the contents of that file.
In this tutorial the file consists of a list of symbols that become part of the optimization.
Tutorial 206 is based on tutorial 100 and quicktip 37. Tutorial 100 demonstrated a simple optimization using the optimizer class. Quicktip 37 took the tutorial 100 program, which had a list of symbols to be used in the optimization ‘hard coded’ into the program, and instead made it so that the user to store the list of symbols into a txt file which the program would subsequently import.

Tutorial 206 extends the program further by taking the Quicktip 37 program and allowing the user to search for a file on their hard drive. The file is selected and the symbol data is imported.

T206-dialogThe import of a file is done using the OpenFileDialog class. When the ‘Start Optimization’ button is pressed the OpenFileDialog is created and a File Explorer window opens. When a file is selected, the OpenFileDialog FileOK event is fired. This method then takes the name of the file that was clicked and extracts the contents into a TokenList.

The tokenlist is used in the creation of the ‘job’ for the optimiser. All the symbols and added using a loop.

The microsoft web page that talks about  the OpenFileDialog class can be found here: https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.openfiledialog?view=windowsdesktop-8.0

In the tutorial, I convert the tutorial program into a function. A plot form the original program and the plot from an indicator that calls the tutorial 23 function can be seen in subgraph 3
In the tutorial, I convert the tutorial program into a function. A plot form the original program and the plot from an indicator that calls the tutorial 23 function can be seen in subgraph 3

Explanation of tutorial 206

Download the tutorial 206 program

If you wish to save yourself some typing, the tutorial programs are available for immediate download by clicking the ‘add to cart’ button below. You may pay using PayPal or a credit card. The price is $24.95

Free download of tutorial 206 trading app for Gold Pass members

Download the tutorial 206 TradeStation EasyLanguage Show me study free for Gold Pass members If you are a Gold Pass member you can download the tutorial code below, please make sure that you are logged in with your Gold Pass user name and password. This content is for members only.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.