|
Visual Traders Studio for MetaTrader System Requirements
What is an Element?
What is a Link?
What is the Tools Configuration Folder used for?
What is an Expert Advisor?
EA Specifics
How do I delete a link or element?
How come I don't see my new variable available from the Logic pulldown menu?
Can variables be set to MQL built in variables like close[0], close[1]
What is the "Failed to compare two elements in the array" error?
Vista and Windows 7 permission problems
Can a StopLoss or TakeProfit be set to an indicator value?
How do I get started?
How to contact us
Why can't I see my custom indicator?
Windows 7 Access
The MQL Shift Parameter used in almost all indicators.
The MQL Point variable
How do I open or close a trade in a QuickStart (QS) system?
Does my EA require function components such as OrderSend or OrderClose?
Adding variables or functions
Where is the crossover template?
What is the difference between a Function and an Element?
Can you ‘drill down’ from a higher to a lower level function diagram?
Do you have a working definition of the Function types?
What is a System?
The MQL Function Element is used to insert native MQL code. Typically when is this necessary?
About the Configure Logic Element tabs: Chart and Excel - What are these for? Do they work in the present release?
Can't see this variable
Can't see function
Only open one trade
What is the Property window for?
Trade Set Manager & Available Currencies
Problem with TimeTrade Manager
Can I trade CFD UK100 (FTSE) in FXCM MT4?
How might my Expert Advisor be effected if my broker changes the number of digits they support?
I'm getting 130 and 138 errors from OrderSend
How long do I need wait to receive VTS after I make my payment ?
Is this software very friendly to use ?
Can VTS support MQL5 ?
Does my purchase include the manual on how this software operates?
How should I get started with VTS?
Can you add pieces of code manually to that generated by the program?
Can VTS be used to modify existing indicators/EAs?
Can I tie multiple chart(s) timeframes to control signal generation?
Can I hide the indicators?
Alert Only
Does VTS produce MQL code?
Can I use Bollinger Bands as an indicator?
Is there a limitation on the number of conditions that can be implemented?
What is the different between those Variables ,Logics, Functions in the NEW tab, and those Variables Logics, Functions in the VARIABLE, LOGIC and FUN
What is the MQL Code element and how is it used?
Does your Software come with Videos?
Can VTS be used to build customized indicators for MT4?
How can I use VTS to print and comment functions?
I am not able to open MetaTrader or the MetaTrader Editor from the VTS application
Can VTS implement the indicators with "flexible" parameters?
Can VTS create code to close trades based on "XYZ" (some conditions I specify) and not just a number of pips once the trade has been opened?
“Build Error! A valid Tools Configuration Folder must be defined to build an Expert Advisor”
How do you configure the standard Heiken Ashi indicator to work with VTS?
Should the installation of VTS find its own folder of Mt4?
How to use the previous bar close value?
EA based on time of day
Can VTS build an EA that has a transaction delay in it?
Using the MagicNumber
Need EA to wait for the Cross
Can VTS implement (and how) indicator's crosses?
Q: Visual Traders Studio for MetaTrader System Requirements What are the system requirements for VTS? A: The system requirements for VTS are the same as the MetaTrader platform, so if you can run MetaTrader than you can run VTS. Q: What is an Element? What is an Element? A: An Element is a basic building block on a VTS drawing. There are 6 basic Elements types: Start Element Note Element Variable Element Logic Element Function Element End Element These are used to build all VTS systems. The VTS system then generates a MetaTrader Expert Advisor. Q: What is a Link? What is a Link? A: A Link is a line drawn between two Elements on the VTS drawing pad. A Link is drawn simply by clicking a mouse and dragging from one element to another. The Link determines the path of the system's logical execution. The Link will ultimately define the order of execution in the Expert Advisor. Q: What is the Tools Configuration Folder used for? What is the Tools Configuration Folder used for? A: The Tools Configuration Folder is used by VTS to find the path to the MetaTrader platform. VTS first converts a VTS drawing into Intermediate Trading Langauge (IDL) and then converts the IDL into proper MQL code. VTS then uses the MetaTrader platforms tools to compile the MQL code into an Expert Advisor. Q: What is an Expert Advisor? What is an Expert Advisor? A: An Expert Advisor is a mechanical trading system that runs on the MetaTrader platform. Q: EA Specifics More information about MetaTrader Expert Advisors ... A: An Expert Advisor is built by creating an MQL file, with an extension of mq4, and then compiling the MQL file into Expert Advisor code. The extension of the Expert Advisor file is ex4. If the Alpari version of MetaTrader was installed on your PC, the folder “C:\Program Files\ MetaTrader - Alpari UK\experts” will contain both mq4 and ex4 files. The mq4 file is a human readable file. If you double click an mq4 file, the “MetaEditor” application will start and load the mq4 file. The MetaEditor application is part of the MetaTrader platform. It is automatically installed when the MetaTrader platform is installed. The “MetaEditor” application is used to edit MQL code. It has many useful features found in most code editors, including intellisense, context help and an online library. While editing an mq4 file from within the MetaEditor, an Expert Advisor is built by clicking the “Compile” button. If there are no syntax errors, the MetaEditor application will build the ex4 file. The ex4 file is not a human readable file. It is binary code interpreted by the MetaTrader platform. So the by compiling the mq4 file, you are converting the MQL language, which is human readable text, into a binary file that can be read by a machine. When the MetaTrader platform is started, any ex4 files in the “experts” folders are shown to be available under the “Expert Advisors” folder from the Navigator window. The VTS application converts its drawings into MQL code. VTS automatically creates an mq4 file and places it in the MetaTrader platform’s “experts” directory. The mq4 file is then compiled into an ex4 file using the MetaEditor application. Both the MetaEditor and Terminal applications can be run from within VTS when VTS is configured correctly. Q: How do I delete a link or element? How do I delete a link or element? A: To delete an element from the pad, just select and press the delete key. To delete an element from the toolbox, right click and choose delete. This will only work for non read-only elements. Q: How come I don't see my new variable available from the Logic pulldown menu? How come I don't see my new variable available from the Logic pulldown menu? A: Variables and functions will not be available on menus until they are saved. You can save the item, or build the System (this will force a save). Q: Can variables be set to MQL built in variables like close[0], close[1] Can variables be set to MQL built in variables like close[0], close[1] A: Yes, go to the assignment tab of the variable and double click "enter a value" and put in the code For example: close[0] or even complex assignments, such as: open[0] - close[0] Q: What is the "Failed to compare two elements in the array" error? What is the "Failed to compare two elements in the array" error? A: To solve the problem, you just need to delete some files in the "data\systems" folder. The VTS data\systems folder is usually: C:\Program Files\iExpertAdvisor\Visual Trader Studio for MetaTrader\Data\Systems In this folder, there is a folder for each system. And in that folder there should be a single file (*.se) by the same name as the folder. Somehow, sometimes there are extra files in these folders which need to be deleted: For example, there should only be one file in the folder, with the same name as folder with an extension of *.se. Any other files should be deleted. We are addressing this bug in the next release. We realize this is a pain, if you'd like, you can zip up your whole data folder, send it to us and We'll fix it for you and send it back. Q: Vista and Windows 7 permission problems If you are having strange problems like your settings are not saved and EAs are not built, check the permission of the VTS installation folder. A: Make sure you can write to the folder where VTS was installed. VTS needs to write to this folder in order to run properly. Depending on the User Id that was used to install VTS and create the "Program Files" folder, some users have reported problems writing to the folder where VTS was installed. The default installation folder for VTS is: C:\Program Files\iExpertAdvisor You may have changed this folder when installing VTS, if so, apply these directions to the folder when you chose to install VTS. Please follow these directions to change the ownership and permissions of a windows folder: http://www.vista4beginners.com/Change-permissions-take-ownership Q: Can a StopLoss or TakeProfit be set to an indicator value? Can a StopLoss or TakeProfit be set to an indicator value? A: Yes, but it's not that easy (I will make it easier in a future release) Here are the steps: Suppose you want to use the ATR as a stoploss value: 1. From the function toolbox, drag the iAtr indicator on to the chart and configure it the way you like. 2. From the variables toolbox, drag the takeprofit variable on to the pad. 3. In the Properties window to the right, change the "Read Only" property of the takeprofit variable to False (You need to select the element to have its properties shown in the property window) 4. Configure the takeprofit variable by clicking the +. Change the scope type from extern to system. 5. Now you can use the assignment to tab to set any value in the takeprofit variable. 6. You could use the "variable" menu in the assigment tab to set the name of the variable for your Atr function, for example: _variAtr But, in this case, this number would be the wrong magnitude! takeprofit is a integer value like 20, or 200 iAtr is a price value like 0.0020 So, we need to divide the iAtr value by the MQL builtin function Point. This is what goes into the assignment for the takeprofit variable: _variAtr/Point See, not very easy. I'll make it "drag n' drop" easy in a future release ;) Q: How do I get started? How do I get started? A: It's so easy to build an EA with VTS that many traders don't realize they have already done it. The easiest way to get started is to choose a QuickStart system. Press the build button after opening and you've built an EA. If you selected a strategy template it is a function EA. If you selected a QuickStart EA, it has no "guts". the logic to open/close buy/sell orders is not defined. The Help File details the entire process: 1. Go to Help -> Getting Started 2. Expand the Getting Started menu 3. Follow the directions if the "Building Your First Trading System" menu. Q: How to contact us How do I contact your company A: The best way to contact us is through email at: support@iExpertAdvisor.com Q: Why can't I see my custom indicator? Why can't I see my custom indicators? A: You need to set the tool configuration folder and then restart VTS. Then your customs indicators will be available from the functions section. VTS searches the experts\indicators folder to find any custom indicators loaded for your MetaTrader platform. T Q: Windows 7 Access How do I set the correct permissions in Windows 7? A: Sincere thanks to Josh M. for these steps! Steps: 1) Open up setup and download VTS 2) After installation left click on VTS icon 3) Click properties 4) Click compatibility 5) Click on change settings for all users 6) Click on the tick for – run this program as administrator under privilege level 7) Click apply 8) Make sure that under compatibility you see that the above mentioned is ticked and greyed out 9) Click apply 10) Click ok 11) Bingo Q: The MQL Shift Parameter used in almost all indicators. What is the Shift Parameter? A: The shift parameter is used to identify a candle (or bar). Where shift=0 (zero) is the currently forming bar on the chart and shift=1 is the bar to the left, etc. Most users set the shift as 0 to get the latest, or most current value of the indicator. But when testing for a cross condition, the shift values of 0 and 1 are used to test for the cross. Q: The MQL Point variable What is the MQL built-in variable Point used for? A: Point is used to take a integer number and make it the same magnitude as one price tick, or point, on a chart. For example, if your integer value is 10, you multiply 10 times Point to get a value like 0.0010. This value can now be used for comparison against other price and indicators values. Q: How do I open or close a trade in a QuickStart (QS) system? How do I open or close a trade in a QuickStart (QS) system? A: To open a buy trade: QsOpenBuyLogic should return a "true" value. To open a sell trade: QsOpenSellLogic should return a "true" value. To close a buy trade: QsCloseBuyLogic should return a "true" value. To close a sell trade: QsCloseSellLogic should return a "true" value. So all you have to add to the QS functions is the Logic to determine a true or false condition. From the help document: “The signals generated by the Qsfunctions instruct the system to open or close a buy or sell position”. “If the applied logic is found to be True, the function will return a True value and the trading system will act on the trading signal”. Q: Does my EA require function components such as OrderSend or OrderClose? I am finalizing the building of my EA using the QsOpenBuyLogic /SellLogic/ QsCloseBuyLogic/ SellLogic Format in the program with my chosen indicators. What I am now wondering, does the EA require function components such as the OrderSend or OrderClose? A: You don't need to worry about OrderSend or OrderClose, they are taken care of by the QS framework. If QsOpenBuy returns a value of "true", the order will be opened, likewise for the other QS functions. Q: Adding variables or functions What is the difference by adding variables or functions inside and outside of the QS logics? A: They will only be available inside the drawing pad where they are created and dragged. Q: Where is the crossover template? Where is the crossover template? A: When you chose "new" to create a new system, a window appears in which you select the type of system to create. The first choice is "Custom", the second is "QuickStart" and right below is "Crossover". If you select "Crossover" and then press the "build" button, you have just created a working EA that opens positions based on a moving average crossover. Q: What is the difference between a Function and an Element? What is the difference between a Function and an Element? A: An element is any icon on the chart. A function is a kind-of element. (Like a dog is a kind-of animal). Q: Can you ‘drill down’ from a higher to a lower level function diagram? Can you ‘drill down’ from a higher to a lower level function diagram? A: Yes, a user-defined function (which is actually a drawing) can contain other user-defined functions. The user-defined function will be represented as an Element icon on the drawing - when you double-click the function icon, the drawing is opened. Q: Do you have a working definition of the Function types? Do you have a working definition of the Function types? A: The function types are: a. MetaTrader functions: indicators, etc., that are dragged onto the pad as an icon - they don't have a drawing. b. MQL functions: these too are icons, they contain "raw" MQL code - they don't have a drawing. c. User functions: when you drag a NEW function, it creates a drawing. After the function has been saved, it will be available from toolbox and the entire drawing can then be represented as an icon on the pad. Q: What is a System? What is a System? A: A system is a group of connected Elements. A system is the main drawing (usually in the first tab) and it holds all of the other functions, etc. All the others drawing are functions, there is only one system drawing. In a way, a system is just another function. We designed it this way, because in a future release we are going to make it possible to drag an entire system onto the pad! In other words, for example, you can have logic that tests the market condition (trend up, down, sideways) and then run a particular system for that market. I think this feature will prove to be extremely powerful. Q: The MQL Function Element is used to insert native MQL code. Typically when is this necessary? The MQL Function Element is used to insert native MQL code. Typically when is this necessary? A: Perhaps never, but it is a convenient way for us, or any MQL programmer, to provide functionality that you can just drop into VTS. Q: About the Configure Logic Element tabs: Chart and Excel - What are these for? Do they work in the present release? About the Configure Logic Element tabs: Chart and Excel - What are these for? Do they work in the present release? A: They do not work yet. They are place holders for other ways of defining logic. We are always looking for new ways for users to express their thoughts. Some people like drawings, others like words, etc. We'd like to provide multiple ways to express logic - actually, sometimes it depends on the logic - it may easier to describe as a drawing, but other conditions may be easier to express as words. Q: Can't see this variable When I add an indicator for, example iAdx, then when create a logic and click the button where I can access this new variable under var/functions, I cannot see this variable. A: When you save or build the entire system it will appear. Unsaved variables will not appear for selection under the variable menu of the Logic selection menu. Also, you can always type in the name of the variable into the "enter a value" text box. Q: Can't see function I am trying to use a function, I created it but I am not able to see it in the function group under the logic element, could you please tell me how to use the platform based functions A: Save the function using the "save" button - then it will appear under the function group. Q: Only open one trade It is my intent, as I just starting out, to only be in one trade per currency per time interval. As I was thinking through the logic of my EA programming, I believe that there may be a possibility for my EA to trigger multiple trades, given the expression of the indicators used. That having been said, is there a function or variable that would 1) check to see if there is a current trade open/in play (as in just bought or sold a currency with the expectation that it would move in a favorable direction), and not run through the other buy/sell logic components? A: Use the "OpenTrade Manager" to set MaxTrades to 1 (or MaxBuys and/or MaxSells). This will prevent the EA from opening more than 1 trade at anytime. You may also want to use the "TradeSignal" manager to set the signal to NEXT_SIGNAL_RULE_OPEN_NONE. This will prevent the EA from ever opening another trade - it would need to be re-attached to the chart. This is useful for "bouncy" signals. Q: What is the Property window for? Apart from giving access to the System Managers on the System tab , is the Property window of any value to me? A: At this time, there are two other things you can do: 1. Change the "read-only" value of an element (so it can, or cannot be modified) 2. Change the return value of a user function. We will be adding functionality here - exactly what? Not sure - some of it will surely be based on user requests. Q: Trade Set Manager & Available Currencies On the Trade Set Manager what is the purpose of defining the set of trades that the Expert Advisor will manage”. A: To prevent an EA from being applied to a currency pair for which it was not intended. Usually you'll attach an EA to a chart and it will trade the currency of chart. This feature is provided in case you want to attach the EA to a EURUSD chart, but only open trades for GBPUSD, for example. (This is not used often, BTW) Q: Problem with TimeTrade Manager I have a problem getting the time frame manager system to work. After I write an EA it runs well and back tests well but I notice that from my results that it is not trading in the time frames that I specified in the manager. A: This happens if the history data is not clean, the time rules of an EA may not test correctly. Q: Can I trade CFD UK100 (FTSE) in FXCM MT4? Can I trade CFD UK100 (FTSE) in FXCM MT4? A: If the broker supports the symbol, it will work. However you may need to type in the symbol if you want to define the symbol in the trade set. Otherwise just attach the EA to the Symbol's chart. Q: How might my Expert Advisor be effected if my broker changes the number of digits they support? How might my Expert Advisor be effected if my broker changes the number of digits they support? A: The only difference to the EA is with the stoploss and takeprofit. For a stoploss of 10 points: For the brokers who support prices of 4 digits the value would be 10 For the brokers who support prices of 5 digits the value would be 100 So if your broker changes from 4 to 5 digits, you usually only need to adjust your stops. I would try to provide a solution through VTS, but how do I know a user didn't actually want a 100 point stoploss for their 4 digit account? At some point the user needs to enter the stoploss- I think at that time they need to know the digits. I am open to suggestions. Q: I'm getting 130 and 138 errors from OrderSend I'm getting 130 and 138 errors from OrderSend A: The 138 error is just a re-quote error that occurs when the prices changes quickly. I don't think you need to worry about this error. The 130 error is an "invalid stops" error. It could be the stoploss, takeprofit, slippage or maybe even price parameter. On your demo account try setting the stoploss=100, t/p=300 and the slippage=3. Those t/p and s/l values should work for a mini or standard account. It's also possible that it could be the price value, but this is rare. I suggest you try a few different values and see what you find. (Sometimes testing like this is the best way to solve issues with a broker) Q: How long do I need wait to receive VTS after I make my payment ? How long do I need wait to receive VTS after I make my payment ? A: It is an automatic download. You can download VTS less than 15 minutes after ordering. Q: Is this software very friendly to use ? I would like to ask is this software very friendly to use ? A: Easy systems are really easy to build. Some complicated systems are also easy to build. But as some systems become more complex, this leads to more complexity in VTS. Some of this can be overcome by adding more features to VTS (which we do now, and plan to do for the future). Other system requirements may always be a bit complex. Q: Can VTS support MQL5 ? Can VTS support MQL5 ? A: We will support MQL5 when it is readily available. We are working with it now and would like to see a few releases so it begins to stabilize before we fully support it. Q: Does my purchase include the manual on how this software operates? Does my purchase include the manual on how this software operates? A: Yes, the help files are all included in the download package. Q: How should I get started with VTS? How should I get started with VTS? A: In VTS go to Help->Getting Started and follow the steps. Follow the section "Building Your First EA" - this shows step-by-step instructions. If you are anxious to just build an EA, then do this: Select New, then select "Indicator System" (this will build a VTS drawing) Click the build button (this will build an MT4 EA) Click the Platform button to open your MT platform Expand the experts tab and attach the EA to a chart. Now you have a running EA. You can modify the drawing and rebuild. I suggest reading the documentation as you go. Q: Can you add pieces of code manually to that generated by the program? Can you add pieces of code manually to that generated by the program? A: Yes, this is done using an MQL_code element. Q: Can VTS be used to modify existing indicators/EAs? Can VTS be used to modify existing indicators/EAs? A: Sorry VTS does not do that yet (version 2.0.37). Later this year, when we support MT5, we'll add support for reading in MQL files and creating a VTS drawing. I'm not sure how helpful it will be - if the MQL code is messy, the VTS drawing will be messy as well. Q: Can I tie multiple chart(s) timeframes to control signal generation? Can I tie multiple chart(s) timeframes to control signal generation? A: Yes, you can use multiple timeframes from multiple charts. Q: Can I hide the indicators? Can I hide the indicators that are used to generate the signals to avoid chart clutter?The indicators do not have to appear on the chart to be used by an EA, so don't worry about chart clutter. A: The indicators do not have to appear on the chart to be used by an EA, so don't worry about chart clutter. Q: Alert Only To supporting manual trading: How does your product support to build an EA that does all the logic, maybe even set-up the trade in the trade window of MT4 however it should not trigger a trade but provide a signal on the chart from the Wingding library like q or r, and provide a sound signal and write the position characteristics to a file. A: We don't have a feature to "alert only on a trade signal", but you can do this with any Expert Advisor by setting the checkbox "allow live trading" to false when attaching the EA. You could also use VTS to build an EA that issues an alert. Q: Does VTS produce MQL code? Does VTS produce code in case I would like to change things in the source code of the EA or indicator? A: Yes, VTS does produce MQL code that you can edit if needed. Q: Can I use Bollinger Bands as an indicator? I am wanting to know if I can use Bollinger Bands as an indicator. I do not see it on your list of indicators. A: Yes, you can. It's in the Functions ToolBox, under "indicators" and is called "iBands". Q: Is there a limitation on the number of conditions that can be implemented? Is there a limitation on the number of conditions that can be implemented? A: No, there is no limit to the number of conditions (or logic). Q: What is the different between those Variables ,Logics, Functions in the NEW tab, and those Variables Logics, Functions in the VARIABLE, LOGIC and FUN What is the different between those Variables ,Logics, Functions in the NEW tab, and those Variables Logics, Functions in the VARIABLE, LOGIC and FUNCTION tabs? A: The New tab is used for creating new elements. After an element has been created and saved, it is available on the other tab/s to be reused. Q: What is the MQL Code element and how is it used? What is the MQL Code element and how is it used? A: If you know how to write MQL code, you can use this element to add MQL code to a VTS system. (Or if your friend knows how to write MQL code, you can paste it into your VTS system using the MQL Code element) Q: Does your Software come with Videos? Does your Software come with Videos? A: Yes, they are available in the "Knowledge Base" tab of the ToolBox and also online. We are always adding new videos based on customer requests. Q: Can VTS be used to build customized indicators for MT4? Can VTS be used to build customized indicators for MT4? A: No VTS does not build custom indicators, but it can read values from custom indicators. We will offer a product to build indicators later this year. Q: How can I use VTS to print and comment functions? How can I use VTS to print and comment functions? A: The print and comment function are just designed to accept a string right now. These can be complicated functions, so we are adding a new helper function to build strings - this will be available in the next patch upgrade. Q: I am not able to open MetaTrader or the MetaTrader Editor from the VTS application I am not able to open MetaTrader or the MetaTrader Editor from the VTS application A: Have you set the VTS tools configuration folder to the folder of the MT platform that you'd like to use with VTS? If this is set, then they should open when clicked. Q: Can VTS implement the indicators with "flexible" parameters? Can VTS implement the indicators with "flexible" parameters? For an example - Stochastic's %K and %D parameters, can we make it be able to "key-in" by the user as the input of the EA, rather than set it fixed at the stochastic indicator function? A: Yes, just create a variable and check "extern" for the scope. Then use this variable can be used to configure the indicator. Q: Can VTS create code to close trades based on "XYZ" (some conditions I specify) and not just a number of pips once the trade has been opened? Can VTS create code to close trades based on "XYZ" (some conditions I specify) and not just a number of pips once the trade has been opened? A: Yes, it can. A QuickStart system has 4 functions: OpenBuy, OpenSell, CloseBuy and CloseSell. If any of these functions evaluate to true, the action takes place. So to close a trade, CloseBuy or CloseSell just need to return true. The logic may be based on any of the same parameters used to open a trade. If you leave the *close* functions undefined, then regular stoploss or takeproifit value will be used to close the trade. Q: “Build Error! A valid Tools Configuration Folder must be defined to build an Expert Advisor” I am near completion of building my EA, and when I click Build, I am getting a VTS Options box with and error message as follows: “Build Error! A valid Tools Configuration Folder must be defined to build an Expert Advisor” I have tried to click on the “Add” button, but it appears to want to open a file, not save one. A: We use the file "MetaEditor.exe" as a method to identify that a user has found the correct folder. If you navigate to your MT folder (wherever that may be) and select the "MetaEditor.exe" file, the form will allow you to select OK, and you will be all set. Q: How do you configure the standard Heiken Ashi indicator to work with VTS? How do you configure the standard Heiken Ashi indicator to work with VTS? What should I put in the input and output sections? A: For any custom indicator that you don't have the MQL code for, you just need to enter the parameters and lines that you use when attaching the indicator to a chart. I've pasted the instructions from the help file below. These notes are from the Help file section VTS Application->VTS Elements->Functions->Custom Indicators. Custom Indicators Adding a Custom Indicator to VTS * VTS will automatically search for custom indicators in the MetaTrader platform’s custom indicator folder. * The custom indicator folder is usually something like (This depends on where you chose to install MetaTrader): C:\Program File\MetaTrader4\experts\indicators * Any indicator found in the custom indicator folder will be available for selection from the VTS Function’s Toolbox under the menu Custom Indicators. * NOTE: If the folder Custom Indicators is not shown from within the VTS Functions Toolbox tab, it most likely because the MetaTrader tools directory has not yet been configured. * To make your custom indicator available for selection from the VTS Toolbox, simply copy the custom indicator file into the custom indicator folder. * The first time a custom indicator is used, the user will be prompted to define the custom indicator’s Input Variables and Output Lines. * Many VTS users do not have the MQL source code for their custom indicators; therefore it is necessary to manually enter the custom indicator’s Input Variables and Output Lines. Using a Custom Indicator – The ZigZag Example * As an example, we’ll define the Input Variables and Output Lines for the custom indicator ZigZag. The custom indicator ZigZag is included with the MetaTrader platform. * Open the MetaTrader platform and attach the custom indicator ZigZag to any price chart. (From the Navigator window of the MetaTrader platform, expand “Custom Indicators” menu and double-click ZigZag.) * When the indicator is attached to the price chart the following window, called the Indicator Configuration window, will appear. Leave this window open to help when entering the custom indicator’s Input Variables and Output Lines into VTS. * This is the Indicator Configuration window:. * Start a or open a Trading System in VTS. * Select the Functions Toolbox Tab and expand the Custom Indicators menu. * This is the Toolbox with the Custom Indicators menu expanded: * NOTE: If the folder Custom Indicators is not shown from within the VTS Functions Toolbox tab, it most likely because the MetaTrader tools directory has not yet been configured. * Select the ZigZag custom indicator and drag it onto the VTS drawing pad. * If the custom indicator has not been configured, selecting the configuration (+) button will display the Custom Indicator Definition window. * The Custom Indicator Definition allows entry of the indicator's Input Variables and Output Lines. * Note, the input variables for your custom indicator are best identified from the Indicator Configuration window shown when attaching the indicator to a MetaTrader price chart. * Select the Inputs tab to view the inputs. * The Indicator Configuration window for the ZigZag indicator shows three input variables: ExtDepth, ExtDeviation and ExtBackstep. * The data type of all three variables is Integer, as identified by the “123” symbol to the far left. * The default value for ExtDepth is 12. * The default value for ExtDeviation is 5. * The default value for ExtBackstep is 3. * To add an input variable, select the Add Input Variable button. * Return to the Custom Indicator Definition window and select the Add Input Variable button. The Custom Indicator Input Definition window will be shown. * Enter the values to define the Input variable ExtDepth: o Enter the Name as ExtDepth. o Select the Data Type as int. o Enter the Value as 12. o Select OK to save the values. * Repeat this procedure for the other input variables ExtDeviation and ExtBackstep. * To identify the various MQL data types, use the example below. Note the icon to the far left that defines the data type. In this example, the name of the data type is shown as the name of the variable. * To enter the output lines for the ZigZag indicator, refer back to the Indicator Configuration window. * Select the Colors tab to view the output lines. * The Indicator Configuration window for the ZigZag indicator shows one output line: Red. * To define the Red output line in VTS, return to the Custom Indicator Definition window and select the Add Output Line button. * The Custom Indicator Line Definition window will be shown. * Enter the value Red into the Line Name field and select OK. * The final configuration is shown below. * If entering values for a custom indicator with more than one output line, be sure to enter the values in the same order as shown in the Indicator Configuration window. * In the below example, note the number (in the # column) to the far left of the Color name. * The ZigZag indicator can now be dragged from the VTS Toolbox onto the VTS Drawing Pad just like any other indicator. The information entered through the previous windows is used to prompt the user for the correct configuration information for the custom indicator. * The Input Variables appear as input parameters. * The Output Lines appear as selection items for the mode parameter. * Note: If a mistake was made when entering any of the values, select the ? button from the bottom of the ZigZag element to return to the Custom Indicator Definition window. The iCustom MQL Function The information for the iCustom function is in the following table. double iCustom(string symbol, int timeframe, string name, ..., int mode, int shift) Calculates the specified custom indicator and returns its value. The custom indicator must be compiled (*.EX4 file) and be in the terminal_directory\experts\indicators directory. Parameters: symbol - Symbol the data of which should be used to calculate indicator. NULL means current symbol. timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe. name - Custom indicator compiled program name. ... - Parameters set (if necessary). The passed parameters and their order must correspond with the desclaration order and the type of extern variables of the custom indicator. mode - Line index. Can be from 0 to 7 and must correspond with the index used by one of SetIndexBuffer functions. shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). Sample: double val=iCustom(NULL, 0, "SampleInd",13,1,0); * What makes the iCustom function difficult to use is the fourth parameter. The ellipsis (…) indicates there can be zero to N number of parameters defined. The number depends on the specific custom indicator. * The mode parameter is used to get the value of the specific line output of the custom indicator. Many indicators have more than one line drawn on the chart. This value must be defined correctly to receive the value of the correct line. * The remaining parameters are straightforward. * Note: An indicator does not need to be shown on a price chart to be used by an Expert Advisor. Q: Should the installation of VTS find its own folder of Mt4? Should the installation of VTS find its own folder of Mt4? A: No, you need to manually tell VTS where MetaTrader is installed by setting the "Tools folder". The VTS Tools folder can be set at anytime. Just click "Add" on the Tools->Options->Configuration tab. VTS uses the MT tool "MetaEditor.exe" to build the EA. This folders tells VTS where to find "MetaEditor.exe". It is usually in the folder where the MT platform is installed, for example: c:\Program Files\MetaTrader 4\ The last step of the VTS build process is to use the "MetaEditor.exe" program to convert an MQL text file into an EX4 Expert Advisor. If VTS can't find "MetaEditor.exe", it shows an error message. Q: How to use the previous bar close value? I will be using a custom indicator, is it possible to have the previous bar close value of that indicator as an operand on the logic element? A: Yes, you would use the variable close[1]. (Where close[0] is the close value of the current bar). You could also use the MT function "iClose" with the shift parameter set to 1 (this is useful if you need the close value of a currency pair that is not the chart's currency pair) Q: EA based on time of day I am trying to write an expert advisor based on opening and closing positions at particular times during the trading day. In layman's terms - if the time of day is 0400 open a buy position. (no other criteria) A: The easiest way is to use a QS system and set the open logic (Buy and/or Sell) to test for the Hour using the MT function/variable "Hour": If Hour == 4 and for the close logic do the same: If Hour == 20 (There are many ways to do the same thing, so this is just one method.) Q: Can VTS build an EA that has a transaction delay in it? Can VTS build an EA that has a transaction delay in it? A: A delay can be added by configuring the logic in a certain way. In other words, if you "test" bars from "3 bars ago", that, in a way, implements a delay. For example, the High of the current candle is: High[0] the candle before that is: High[1] If you are on a 15 minute chart and write logic that uses: High[3] that's the High from 3 bars ago, or 3*15 minutes = 45 minutes ago. Q: Using the MagicNumber Is there some way or special configuration to the coding that VTS will do that would allow each EA to operating distinctly such that a trigger of a buy would not automatically close out an open order on another currency with another EA operating on it, etc.? A: This problem you describe is easily addressed using the concept of a "Magic Number". A magic number is a unique number assigned to a trade on the broker's server. (They can only be assigned programatically, via an EA). Any EA can use the magic number to manage a trade. For example, an EA can manage all EURUSD open trades with a magic number of 100. All VTS EA's have a magic number input so the EA can behave this way. However, if you have another EA, which does not respect the magic number, you can have problems. Q: Need EA to wait for the Cross System1 is a CrossoverSystem where I want the program to buy when the 5EMA passes through the 10SMA envelope. When testing the program it seems as if it buys/sells when price (bar/candle) gets out of the envelope, but I programmed it to wait until the 5EMA passes through the envelope. A: If you want to wait until the bar closes outside of the envelope, you should try using different values for the shift parameter. The shift parameter identifies the bar: where 0 is the currently forming bar, 1 is the next one to the left, etc. For a crossover, we usually compare the values of an indicator at shift=0 and shift=1. For your case, you should try shift=1 and shift=2 and then use the OPEN price value instead of the CLOSE. Q: Can VTS implement (and how) indicator's crosses? Can VTS implement (and how) indicator's crosses? For example; when stochastic above 70 level and %K cross above %D line for current bar and previous 2 bars. And .. when stochastic below 30 level and %K cross below %D line for current bar and previous 2 bars. A: Please look at the 'CrossOver" strategy. The trick is to use the correct "shift" parameter, where shift=0 is the current value, shift=1 is the value of the last bar, etc. |