INTELLISCRIPT
This section applies to members using the IntelliChart Desktop.
The Desktop IntelliScript is a programming feature that allows users to draft and create their own Customized Alerts and Indicators. The IntelliScript is designed for the advanced chartist, with some programming experience.
This section applies to members using the IntelliChart Desktop.
The Desktop IntelliScript is a programming feature that allows users to draft and create their own Customized Alerts and Indicators. The IntelliScript is designed for the advanced chartist, with some programming experience.
The Desktop IntelliScript is a programming feature that allows users to draft and create their own Customized Alerts and Indicators. IntelliScript is designed for the advanced chartist, with some programming experience. The IntelliScript is similar to the C or Pascal language. It is not a full-blown programming language, but suitable to be considered as a much more simplified version of it. The functions and syntax used in the IntelliScript are really close to a script language.
For clients who do not have any programming experience, we recommend referring to a basic tutorial on C, paying attention to the following sections within the tutorial:
- Variable declaration, including different types of variables, like Boolean, String, Int, Float, etc.
- Variable value assignment.
- IF statements and how to define a condition (A condition would return true or false).
- WHILE statements.
- What is a function, what are parameters passed in a function, and the return value of a function (or if the function does not return any value).
You can find the above-mentioned 5 points on programming in almost any language such as Visual Basic and Java. However, we do recommend reviewing the C programming language, as we believe it is the closest.
Basic Concepts of IntelliScript
- What is IntelliScript?
The IntelliScript is designed to build alerts, strategies, and indicators based on both historical and real-time data. You can write your own expressions using "IF THEN" conditional branch, "WHILE" loops, variable declarations, buy/sell signals, as well as many other means. You will be able to quickly reference all of the available indicators and even build your own indicators.
- How does the IntelliScript run?
- Real-time Data Calculation
Each time when a new ticker price changes on the chart, this will trigger all the IntelliScripts attached to the chart to execute for the last price bar on the chart. If the condition you defined in the script is satisfied, you will get a corresponding signal on the chart for the last price bar, which is also defined by you in the script.
- Historical Data Calculation
First we must suppose you select the option "Generate Historical Alert" checkbox within the IntelliScript editor or activate this option by right clicking in a chart and select "Generate Historical Alerts" once a script is attached to a chart. Once selected, this script will run from the first bar to the last bar, one bar at a time. If the condition you defined in the script is satisfied, you will get a corresponding signal on the chart, which is also defined by you in the script.
Please keep in mind when using the IntelliScript to draft your own signals, there will be a difference between real-time generated signals versus historical generated signals. Real-time generated signals are generated using tick by tick data (unless you have checked the option "Calculate on Close Only" in the IntelliScript editor). So a signal can be generated in the middle of a real-time bar. However, for historical signals, we do not have tick by tick data for each of the historical bars so historical signals are only calculated using the close price of each bar. Depending on your syntax, this difference is likely to cause differences in the performance comparison.
- What is a Data Series?
A Data Series is defined by the combination of a symbol and its Time Scale and Period.
For example, when you open a chart for "EUR/USD 10-minute 2-day" and when you export the data, you will get a data stream similar to:
"Date","Time","O","H","L","C"
10/29/2003,1030,1.1685,1.1702,1.1685,1.17
10/29/2003,1040,1.17,1.1702,1.1694,1.17
10/29/2003,1050,1.17,1.1707,1.1693,1.1695
......
......
......
10/31/2003,1010,1.1613,1.1634,1.1613,1.1628
10/31/2003,1020,1.1628,1.1651,1.1628,1.164
10/31/2003,1022,1.164,1.1642,1.1636,1.1636
We call this stream of data one unique Data Series. Both Customized Indicator and Customized Alert calculations are essentially based on this span of data. Note a Data Series for "EUR/USD 10-minute 2-day" is different from a Data Series for "EUR/USD 15-minute 2-day". A Data Series for "EUR/USD 10-minute 2-day" is more obviously different from a Data Series for "USD/CHF 10-minute 2-day".
Generally you attach an IntelliScript to a chart, but internally, the IntelliScript is attached to the Data Series underlying the chart. In other words, when you attach an IntelliScript to a "EUR/USD 10-minute 2-day" chart, in reality, this IntelliScript is attached to the Data Series "EUR/USD 10-minute 2-day". This also means if you open two charts and both of them are showing "EUR/USD 10-minute 2-day", if you attach an IntelliScript to one of the charts, you will see that this IntelliScript is actually attached to both of these charts. Also understand that since the script is attaching to the Data Series, if you attach the Data Series "EUR/USD 10-minute 2-day" and have no such chart opened, if the script's conditions are met, you will still receive an alert notification.
- How many IntelliScripts can be attached to each Data Series and vice versa?
You can write an unlimited number of IntelliScripts, all of which can be saved within the IntelliScripts organizer. Each IntelliScript can be attached to an unlimited number of Data Series. Each Data Series can also have an unlimited amount of IntelliScripts attached.
- What are Position Controls?
By default, you can only have one opened position at a time. For example, if your IntelliScript generates a buy entry position 10 minutes ago, then even if another buy entry position is satisfied now on the chart, you will not see this second buy entry position. At this point, only a sell entry or a buy exit position can be generated. However, keep in mind you can adjust the script and add a special parameter to enable a continuous buy entry position.
- What is the scope of a variable?
The scope of a variable is defined by using one of the three declaration keywords: Share, Global, or Local. Here are the differences between them:
- Share: when a variable is declared as a share variable, every single IntelliScript can access this variable. For example, suppose you make the following declaration:
Share myVarShare
Even if you attach this script to "EUR/USD 1-minute 2-hour", you can still reference myVarShare's value in a different script attached to "USD/CHF 5-minute 12-hour".
- Global: when a variable is declared as a global variable, only the Data Series in which the script is attached can access this variable. Suppose you make the following declaration:
Global myVarGlobal
If you make this declaration in a script and attach this script to "EUR/USD 1-minute 2-hour", then you can only reference the value of myVarGlobal in all the scripts attached to the same Data Series "EUR/USD 1-minute 2-hour". You cannot reference the value of myVarGlobal in a script attached to a different Data Series, such as in a script attached to "USD/CHF 1-minute 2-hour".
- Local: as the name indicates, local variables can only be accessed within the particular script in which the variable is declared.
For example, suppose you make the following declaration:
Local myVarLocal
If you attach this script that has this declaration to "EUR/USD 1-minute 2-hour", then you can only reference this variable in this script only. You cannot reference the value of myVarLocal in a different script, even if this second script is attached to the same Data Series "EUR/USD 1-minute 2-hour".
- How do I display the result of a variable?
Once a script is attached to a chart, go to "IntelliScript Organizer", select "Organizer" tab, select the script from the list in "My IntelliScript", then select the chart (currency, time/interval combination) from the list, then in the window of "IntelliScript Status", you can see the value of each defined variable in real time.
- How do I use a Contract?
By default, with one default contract, you can not add two continuous buy entries or two continuous sell entries, basically a buy transaction has to be followed by a sell transaction. When executing IntelliScript, this logic is enforced. So, even if your script would generate two continuous buy entries, the second one would be blocked and not generated. The purpose of contract is for the situation that you find this logic unfavorable. In that case, you use multiple contracts. Still within each contracts, the same logic applies. There is no such thing as getting in and out of a contract. Once you add signals with contract specified, that signal is associated with that contract and the logic would enforce for each contract. So, you maybe able to generate 2 continuous buy signals on the chart provided the two signals are associated with 2 different contracts. Most people find using default contract is enough.
- What do the signals (triangles & arrows) mean on the charts?
Here is a Basic description of what the IntelliScript alert signals represent:
Up Arrow: Buy Candle
Blue Triangle: Buy Alert Price
Down Arrow: Sell Candle
Red Triangle: Sell Alert Price
Grey Arrow Down: Exit Candle for Buy position
Grey Arrow Up: Exit Candle for Sell position
Grey Triangle: Exit Price
The meaning of the tiny double arrows such as this on the chart is where a triggered alert will indicate the actual trade price for buy/sell signals. Keep in mind that when back testing, the script is only calculated once at bar close time; remember at bar close the open/high/low/close price are all available. For AddBuyEntry, AddSellEntry, you can specify at price. That is why the trade price does not always have to be close price. If you do not specify the particular price, it would be close price. These arrows are appearing based on the syntax used in the script, however they do not figure into the backtest results when reviewing past performance.
IntelliScript Feature Tabs
This section will describe the functions of each tab and highlight the important options.
- Alert: The alert tab is used to create your syntax using IntelliScript. There are several drop-down menus to add various commands and functions to your script. Also, there are four check boxes under "Set Alert Properties":
- "Calculate on Close Only" ¨C This option will only generate a signal at the close of the candle.
- "Alert First Instance Only" ¨C Will only generate an alert the first time the criteria is reached, but still display each buy/sell on the chart.
- "Generate Historical Alert" ¨C This option will generate historical alerts on the current chart, based on your syntax.
- "Send Email at Buy/Sell ¨C This option will send an email alert to your Default MailList when a Buy/Sell signal is generated on the chart.
The button "As Default" we allow you to keep these above options checked for future use.
Once you have finished entering your script, you can use the "Compile" button to check your script for any syntax errors. If there is a syntax error, you will see the error message along with the line (ln.) and column (Col.) numbers in red on the bottom of the IntelliScript feature. The line and column values allow you to quickly see where the syntax error is located.
- Indicator: Here you can create your very own custom indicators. The Indicator tab also features the same useful drop-down menus as the Alert tab to assist you in generating your script.
Note, you may also call this box up by going to the charting software's main window and select "IntelliScript", then you will see a drop down menu, from there, please choose "Add Customized Indicator" This will launch the IntelliScript window.
Here are the steps on how to complete adding a custom indicator are outlined below:
- Enter what you would like to call the indicator line in the "Name:" text box.
- Select the Price Channel you would like to use from the "Channel:" drop down list.
- Select the color you would like this indicator to be viewed on the chart from the "Color:" drop down list.
- Enter the value that this indicator will represent in the "Value:" text box.
- Chose an IntelliScript name for this indicator on the right side, above the "Expression" box. This name is the name for the IntelliScript and will be how you edit and manage the indicator (versus the name box which will be what the line is called when drawn on the chart).
- Once you have finished select the "Add" button. This will populate the "Expression" text area with the script for your new indicator.
- If there will be no further additions to the Expression, select the "Compile" button to check the syntax.
- Select the chart of interest from the drop down list at the bottom and then select the "Attach" button to attach the indicator to your chart.
- Organizer: The Organizer tab allows you to view the scripts you created (under My IntelliScript Strategies) as well as attach them to different pairs/time frames as (see steps 7 and 8 just above here in the Add Customized Indicator section). You can also import and export alerts using this tab.
To export an alert on the Organizer tab:
- Then highlight the name of the Alert in question in that first column called "My IntelliScript".
- Just below that section, select "Export", you will be prompted to name a file to which you wish to export the alert. Once you have selected a name, choose, "Save". The file will be saved as an .alt file.
To import an alert on the Organizer tab:
Select "Import." You will then be prompted to browse to the name of the alert file to which you wish to import. The file will be in the format of an .alt file. Once you have selected the file, follow the Windows onscreen menus to "Open". Once you open the file, it should import into the software and will appear in the "My IntelliScript" section. You can then attach to the charts of your choice.
- Email: Here is where you need to enter your email address or cell phone address to receive alerts. Please note:
- There is a maximum of 3 email addresses that may be entered in the Mail List.
- Only one email address may be entered in the "To:" field.
- Only one email address may be entered in the "CC:" field.
- Only one email address may be entered in the "BCC" field.
Please follow these steps to add your email addresses:
- Open the IntelliScript window and click on the tab labeled "Email".
- Enter your email address in the "To:" field and select the "Add" button, as demonstrated below.
If you want you can send the email to two other addresses, just type in the email addresses in the "CC:" and "BCC:" fields.
If datafeed Interrupted: If the data stops updating on the chart, you run a program or send yourself an email.
Run: The first option is to "Run" , when you choose that you can either type in the program you wish to be launched, or you can click on the button "..." to browse to make your selection.
Send Email: The second option is to ¡®Send Email¡¯ If you choose to "Send mail when datafeed interrupted", then there are 2 possible email alerts that will be sent:
- Email with subject "Update stopped..." is received: This email will be sent out when there has not been data update for 60 seconds, so this message is more serious than the other one.
- The other email that can be received is subject: "Streamer Stopped" It simply means 10 continuous try( about 10-15 seconds) to get real time quote data has failed, there might be an intermittent problem with the streamer or the streamer is extremely busy at the moment.
Disclaimer: If you prefer to receive your emails and alerts without the Disclaimer, then be sure to check the box "Send Email without Disclaimer".
- Hist. Debug: The IntelliScript Debug feature is a useful tool to help debug your script. It simulates the process in which the script runs through the historical data and lets you see the steps and expression values when the script runs. Please note that in order to debug your script, the script must be correct in its syntax and successfully attached to a Data Series. Please take a look at Figure 1. Debugger Overview as you read through these instructions:
1.1
To use the Debugger tool, you first select the Data Series to which you have scripts attached. Then in box labeled #1, it will display the list of scripts attached to this Data Series. Please note the debugger will run through all the scripts attached to this Data Series.
1.2
The checkboxes under the "Stop at:" section displays the list of breakpoints you can check. If you check the boxes next to "Buy Entry" and "Sell Entry", then the debugger will stop whenever a Buy Entry is generated or a Sell Entry is generated.
1.3
When you click on the "Restart" button, the debugger will start from the beginning of the Data Series. Then you can click on the "GO" button, which will stop at the next breakpoint, which is specified in the "Stop at:" section as explained in the previous paragraph. If you click on the "Step" button, the debugger will stop at every bar in the Data Series.
2
Box #2 labeled "Script Source" displays the expression for your script in which the debugger is currently displaying.
3
Box #3 labeled "Debug Status" displays the values for certain lines of your expression that are currently running.
4
Next to the box labeled "Watch:", you can enter expressions or variables used in your script. For example, you can enter "EMA(Close, 5)" in the Watch, then box #4 will display EMA(Close, 5)
5
Lastly box #5 "Values" will display the value for expression EMA(Close, 5) at the particular breakpoint where the debugger is running.
Figure 1. Debugger Overview.
- Syntax Help: This tab is a review of the basic IntelliScript concepts and syntax examples seen earlier in this manual.
- Syntax Reference: Allows you to search for a function or use the drop down menu to view all the functions available in IntelliScript. Each function page includes the definition of the function as well as a working example of how it is used in IntelliScript.
- Help: Provides you with a shortcut to the instruction manual directly from the IntelliScript feature.
- FAQ: This tab is a compilation of frequently asked syntax examples. Please feel free to copy an example and modify it to match your strategy.
You can set up an alert to let you know when 2 different indicators intersect, this would be a Crossover Alert.
Here is an example to help explain the steps in setting a Crossover alert.
Disclaimer: The following examples do not reflect real trade strategies. They are designed for syntax demonstration purpose only.
Example: I want the chart to alert me when 5-period EMA crosses with the 10-period EMA on the EUR/USD 5-minute 12-hour chart.
- Add both the 5-period EMA and 10-period EMA indicators on the EUR/USD 5-minute 12-hour chart.
- Use your mouse to left click on the colored square, located to the left of the EMA(5), as shown in Figure 1 Set Cross Over Alert. Then click on option "Set Cross Over Alert with". You will see a menu offering a choice of indicators that are actively on the chart for which you can choose one to be used in a crossover alert/signal. Select EMA(10) in this case. See Figure 1 Set Crossover alert image below.
Figure 1. Set Crossover alert.
- The IntelliScript feature will pop up with the cross over syntax already in place in the Expression box, see Figure 2. Apply Crossover Alert.
- You can enter a name for this IntelliScript next to the box "Name:" For example, we have entered "EMA Crossover" in the screenshot below.
- Now you will to activate and apply this IntelliScript Crossover Alert by attaching it to the EUR/USD 5-minute 12-hour Data Series. Select "EUR/USD(5min. 12hr.)" next to the "Attach" button if this is not already selected. Click on the "Attach" button. Please check the bottom left corner of the IntelliScript window to see the Status of your actions. You will need to wait until this Status bar reads: "Calculation is complete. The script is attached to the chart." Once you see this, you can close the IntelliScript feature by clicking on the "Close" button.
Figure 2. Apply Crossover Alert.
IntelliScript Price Alerts
This section explains how to use the IntelliScript to draft a very simple alert.
Disclaimer: The following examples do not reflect real trade strategies. They are designed for syntax demonstration purpose only.
Example: I want the chart to alert me add a buy entry signal when the current MACD(12,26,9) on a 2-hour USD/JPY chart goes from negative to positive across the zero line.
- First you need to open the IntelliScript's Alert window you have two options:
- Go to the main window and select Click on "IntelliScript", then from the drop down menu select "Add Customized Alert"
- Inside a chart, select the "A" icon, it looks like this:
- The syntax for this example requires an IF statement. You can add the basics of an IF statement by clicking on the "IF THEN" button in the "Add Advanced Script to Expression" section.
-
The MACD(12,26,9) > 0 is the condition for the IF statement. So now move your mouse to the big box below the "Expression" section, and click on the position to the right of the open parenthesis. See Figure 1. Setting up a simple Alert.
Figure 1. Setting up a simple Alert.
- Now you need to add the indicator MACD(12,26,9) to the Expression. In the "Add Indicator to Expresion" section, under the dropdown menu under "Select Indicator", find "MACD" and click on it. Then select "Close" under the "Apply to" menu. Enter 12, 26, and 9 in the boxes below the "Parameters" menu. Enter 0 under the "Displacement" menu. Now click on "Add". Below, you can review Figure 2. Setting up a simple Alert
continued.
- The MACD(12,26,9) is now added to the expression. Type "> 0" next to the syntax MACD[0](Close, 12, 26, 9). Then complete the rest of the syntax so the Expression box will display:
IF (MACD[0](Close, 12, 26, 9) > 0) THEN
AddBuyEntry
ENDIF
IF (MACD[0](Close, 12, 26, 9) <0) THEN
AddSellEntry
ENDIF
- Type a name for this alert next to the "Name:" field (just above the Expression box).
- If you want to generate historical alerts, please check the box "Generate Historical Alert" in the "Set Alert Properties" section.
- Now you want to activate this IntelliScript by attaching it to the USD/JPY 2-hour 10-day Data Series. Select "USD/JPY(2 hr. 10 day)" next to the "Attach" button (if USD/JPY(2 hr. 10 day) does not appear in the drop down, go to Step 9). Click on the "Attach" button. Please check the bottom left corner of the IntelliScript window see the Status of your actions. You will need to wait until this Status bar reads: "Calculation is complete. The script is attached to the chart." Once you see this, you can close the IntelliScript feature by clicking on the "Close" button.
Please wait until the status line in red color on the bottom shows: "Calculation is complete. The script is attached to the chart." Now you can close the IntelliScript feature by clicking on the "Close" button.
Figure 2. Setting up a simple Alert
continued.
-
- (Optional Step): If the Data Series USD/JPY(2 hr. 10 day) does not appear as specified in Step 8 above, then you will need to use the Organizer tab. First, click on the "Save" button under the "Alert" tab. Now click on the "Organizer" tab. See Figure 3. Adding Alert to other symbols and time scales.
- (Optional Step): The alert name "MACD Alert" should appear under "My IntelliScript". Highlight "MACD Alert".
- (Optional Step): In the "Attach Symbol/Time Scale" section, select "USD/JPY" in the first dropdown menu and "2 Hour" in the second dropdown menu. Click on the "Add>>" button. Now Data Series "USD/JPY(2 hr. 10 day)" should appear in this section.
- Click on "Close" to exit the IntelliScript tool.
Figure 3. Adding Alert to other symbols and time scales.
Now you have learned how to create price alerts, crossover alerts, and customized alerts. This next section explains how to use the IntelliScript tool to send emails and send SMS messages to your cell phone.
For any alert drafted using IntelliScript, being sent out via email, there is a limit of 3 email addresses. The alerts will only reference the addresses listed in the mail list defined in the mail list as defined in the "Email"
tab. You can list one email address in the "To:" field, one email address in the "CC:" field, and one email address in "BCC:" field, totaling 3 addresses.
Disclaimer: The following examples do not reflect real trade strategies. They are designed for syntax demonstration purpose only.
- Default Email List
To send an email or SMS message using the alerts from the IntelliScript, you must enter your email address in the default mailing list. For any alert drafted using IntelliScript being sent out via email, there is a limit of 3 email addresses. The alerts will only reference the addresses listed
in the mail list as defined in the "Email" tab. You can list one email address in the "To:" field, one email address in the "CC:" field, and one email address in "BCC:" field, totaling 3 addresses. If you draft syntax and use the "SendMail" command, this command will only send mail to those listed in the mail list defined in "Email" tab. Important things to note:
- There is a maximum of 3 email addresses that may be entered in the Mail List
- Only one email address may be entered in the "To:" field
- Only one email address may be entered in the "CC:" field
- Only one email address may be entered in the "BCC" field
Please follow these steps to add your email addresses:
- Open the IntelliScript window and click on the tab labeled "Email".
- Enter your email address in the "To:" field and select the "Add" button, as demonstrated below.
- If you want you can send the email to two other addresses, just type in the email addresses in the "CC:" and "BCC:" fields.
- Send Emails for Price Alert
If you have price alerts added (alerts added by clicking in the chart, not through the IntelliScript), to receive an email when a price alert is generated, you simply follow the instructions listed above for "Default Email List" to enter your email address. Then check the box "Send email when Price Alert achieved" located on the "Email" tab within the IntelliScript. See the image below:
- Send Emails for Buy/Sell Positions
If you have created a customized alert by drafting syntax from the "Alert" tab, to receive emails when a buy/sell position is generated, check the box "Send Email at Buy/Sell" in the "Set Alert Properties". Please note the alert from which you wish to generate email alerts needs to be active, meaning the alerts syntax needs to be visible in the "Expression" box.
Please note by checking this option, the IntelliScript tool will send emails to the email addresses defined in the Default Email List section when one of the following conditions is generated as defined in your IntelliScript syntax:
AddBuyEntry
AddBuyExit
AddSellEntry
AddSellExit
- Send Emails by Writing Syntax in IntelliScript
This option gives you the most flexibility for sending emails from your IntelliScript. You call the "SendMail" function anywhere in your syntax when you wish to send an email at that condition. The SendMail function will only work if you entered an email address in the Default Email list (see above for directions). The syntax for "SendMail" is:
SendMail "RSI over 80"
The syntax example below will send an email whenever the RSI reaches over 80. You will enter such syntax in the "Expression" box under the "Alert" tab.
IF RSI[0](Close, 14) > 80 THEN
SendMail "RSI over 80"
ENDIF
Important Notes:
- Entering email address in the syntax will not be recognized.
- This software does not support the ability to send more than 3 email messages simultaneously.
- Send SMS Messages to Your Cell Phone
Note most cellular phones from the United States can receive text messages through text email. This is probably true for cellular phones in most other countries in the world. You can check to see if your current cell phone plan already includes such a service. If it does not, you may add such a plan at a low monthly fee, please check with your cell phone provider for text messaging services.
Below is a sampling of email addresses:
Major US providers:
Sprint PCS:
Voice Stream (T-Mobile):
AT&T (M Life):
Nextel:
Verizon:
1231231234@messaging.springpcs.com
1231231234@voicestream.net
1231231234@mobile.att.net
1231231234@messaging.nextel.com
1231231234@vtext.com
Major Canadian providers:
Telus Mobility:
Rogers AT&T (Canada):
1231231234@msg.telus.com
1231231234@pcs.rogers.com
Please substitute your real phone number where 1231231234 is written above. Instead of entering a real email address in IntelliScript, enter your cell phone text email address. This way, when an alert is generated, you will receive a text message on your cell phone!
The IntelliScript tool is designed for users with computer programming experience. Below is a compilation of Frequently Asked Questions (FAQs), created for your convenience.
- Q1: How do I program an alert that will send me an email alert and/or a message to my cell phone?
For example, generating a buy when TMA (5) crosses above the SMMA (10) and vice-versa (a sell)?
(Note: To receive these alerts to your cell phone or email address, you must enter the addresses under "To" on the "Email" tab of the IntelliScript feature.)
A1: Example:
IF CrossUP(TMA[0](Close, 5) , SmoothedMA[0](Close, 10)) THEN
AddBuyEntry
SendMail "TMA5 crossed above SMMA 10"
ENDIF
IF CrossDOWN(TMA[0](Close, 5) , SmoothedMA[0](Close, 10)) THEN
AddSellEntry
SendMail "TMA5 crossed below SMMA 10"
ENDIF
- Q2: How would I create a custom indicator?
A2: Custom indicators are created by specifying the Indicator name, the channel you wish it to reside, the color you wish to represent the indicator on your chart of choice and the value the indicator will use.
Below is an example of a custom indicator using EMA(10) of the DPO (20):
//Indicator EMADPO
Indicator EMADPO
EMADPO.Channel=1
EMADPO.Color="Black"
EMADPO.Value=EMA[0](Detrend_Price_Oscillator[0](Close, 20), 10)
EMADPO.Draw
- Q3: How do I program a crossover to generate a buy signal when the current bar close is 20 pips or greater than the line being crossed?
For example when WMA (5) crosses above the WMA (20) and the currency is 20 pips or greater above the WMA 20. How can I program the reverse for a short order WMA 5 cross down WMA 20?
A3: Example:
IF CrossUP(WMA(close, 5), WMA(Close, 20)) and Close > WMA(Close, 20) + Point(20) THEN
AddBuyentry
Endif
/*Close < WMA(Close, 20) - Point(20) or Close < WMA(Close, 5) - Point(20)*/
IF CrossDOWN(WMA(close, 5), WMA(Close, 20)) and Close < WMA(Close, 20) - Point(20) THEN
AddSellentry
Endif
- Q4: How can I program a "trailing" stop?
A4: Using a trailing stop allows you to let profits run while cutting losses at the same time. Below is an example of a 50-pip trailing stop:
local short_trailing=0
local buy_trailing=0
IF isBuyPosition() THEN
if GetTradeBarIndex(0) =0 then
buy_trailing=max(LastTradePrice[0], price)
endif
if GetTradeBarIndex(0) >0 then
buy_trailing=HHV(high[1],GetTradeBarIndex(0)-1)
endif
IF buy_trailing-low > Point(20) THEN
AddBuyExit AT buy_trailing - Point(50)
ENDIF
ENDIF
IF isSellPosition() THEN
if GetTradeBarIndex(0) =0 then
short_trailing=min(-LastTradePrice[0], price)
endif
if GetTradeBarIndex(0) >0 then
short_trailing=LLV(low[1],GetTradeBarIndex(0)-1)
endif
IF high-short_trailing > Point(20) THEN
AddSellExit AT short_trailing + Point(50)
ENDIF
ENDIF
- Q5: How can I set up a sell or buy alert when two indicators reach a certain level? How can I also include a trailing stop of say 20 pips?
For example, generating a sell when RSI (14) crosses over 70 and ADX (14,14) is greater than 25 with a trailing stop of 20
A5: To create this script a trailing stop is drafted first. Using a trailing stop allows you to let profits run while cutting losses at the same time. Below is an example of a 20 pip trailing stop:
local short_trailing=0
local buy_trailing=0
IF isBuyPosition() THEN
if GetTradeBarIndex(0) =0 then
buy_trailing=max(LastTradePrice[0], price)
endif
if GetTradeBarIndex(0) >0 then
buy_trailing=HHV(high[1],GetTradeBarIndex(0)-1)
endif
IF buy_trailing-low > Point(20) THEN
AddBuyExit AT buy_trailing - Point(20)
ENDIF
ENDIF
IF isSellPosition() THEN
if GetTradeBarIndex(0) =0 then
short_trailing=min(-LastTradePrice[0], price)
endif
if GetTradeBarIndex(0) >0 then
short_trailing=LLV(low[1],GetTradeBarIndex(0)-1)
endif
IF high-short_trailing > Point(20) THEN
AddSellExit AT short_trailing + Point(20)
ENDIF
ENDIF
To complete the script, add the following to the end of above codes for the RSI cross alerts for a sell alert and a buy alert:
IF CrossUP(RSI[0](close, 14), 70)) and ADX[0](Close, 14, 14) > 25 THEN
AddSellentry
Endif
IF CrossDOWN(RSI[0](close, 14),30)) and ADX[0](Close, 14, 14) > 25 THEN
AddBuyentry
Endif
- Q6: How can I create an alert that will let me know if a candle changes by 10 or more pips?
A6: Example:
IF High[0] - Low[0] > Point(10) THEN
AlertOnly "Change Over 10 Points"
ENDIF
- Q7: I have created a custom Indicator which is attached to a 15-min 10-day GBP/USD chart to read a bar from 1-hr 30-day data series. The syntax I have used is as follows:
tp=GetTimePoint(0)
Midnight1=GetHour(tp) + 1
Midnight0=24+midnight1
C=getValue("GBP/USD, 1hr. 30 day", Close[Midnight1])
O=getValue("GBP/USD, 1hr. 30 day)", Close[Midnight0])
However, the getValue returns closing price from the 15-min chart instead of one-hour chart! Why is this happening?
A7: In many cases it is very important to pay particular attention the syntax that needs to be used for each command option available in the IntelliScript. The above command uses the correct commands, however the use of parenthesis or commands are incorrectly used. When the syntax is properly configured it will compile correctly and yield the desired results. For this request, here is the proper syntax to use:
local tp=GetTimePoint(0)
local Midnight1=GetHour(tp) + 1
local Midnight0=24+midnight1
Local C=getValue("GBP/USD, 1 hr. 30 day", Close[Midnight1])
Local O=getValue("GBP/USD, 1 hr. 30 day", Close[Midnight0])
- Q8: How do I add a filter of 10 pips, so I only get an alert when and if the price breaks above an indicator, then keeps moving by 10 pips?
A8: This example shows the answer using the Chaos Fractal indicator:
IF crossup(close[1], Chaos_Fractal_UP[1](Close) + Point(10)) THEN
AddBuyEntry
ENDIF
IF crossdown(close[1], Chaos_Fractal_DOWN[1](Close) - Point(10)) THEN
AddSellEntry
ENDIF
- Q9: How can I retrieve last weeks' high?
For example, when using a 1 hr 20 day chart.
A9: Retrieving this data requires using the "local" and "getvalue" IntelliScript commands.
The "Local" command allows you to declare a local variable in the chart. These variables remain accessible only within the particular script in which it is included.
The "getValue" command returns the value of the expression set forth in the script. This function enables you to retrieve the value from a different data series than the one to which the script is attached.
The script for retrieving last weeks high, using a 1hr 20 day chart would be written as follows:
Local wkhigh
wkhigh=getValue("eur/usd ,1 wk. 10 yr.", high[1])
HLine myhigh=wkhigh
- Q10: How can I set up my charts so that every time an indicator crosses above or below the '0' line it will give me an alert?
A10: The following example uses DPO (16), you can substitute any indicator that uses a '0' line:
IF CrossUP(Detrend_Price_Oscillator[0](Close, 16), 0) THEN
AlertOnly "DPO UP"
ENDIF
IF CrossDOWN(Detrend_Price_Oscillator[0](Close, 16), 0) THEN
AlertOnly "DPO DOWN"
ENDIF
- Q11: How can I apply a buy signal when an indicator crosses below a specific value and take profit of 15 pips later? How can I apply a sell signal when an indicator goes above a specific value and take profit 15 pips later?
A11: The IntelliScript does feature specific commands for taking profit for both the buy and sell. These are "BuyTakeProfit" and "SellTakeProfit". To set these to take the profit at 15 pips, the Point command is used.
The following example illustrates the above case using RSI (9) as the indicator:
BuyTakeProfit Point(15)
SellTakeProfit Point(15)
IF CrossDOWN(RSI(Close, 9), 25) THEN
AddBuyEntry
ENDIF
IF CrossUP(RSI(Close, 9), 75) THEN
AddSellEntry
ENDIF
- Q12: How do I program an alert based on two conditions (two indicators)? For example, generating a buy when the price crosses over BLG_UP(20,2) and CCI (20) is greater than 100.
A12: In this example, we will use the AND function:
IF CrossUP(Price[0],BLG_U[0](Close, 20, 2)) AND CCI[0](Close, 20)> 100 THEN
AddBuyEntry
ENDIF
- Q13: How can I create a custom indicator to plot the highest high for the last 20 periods, as well as the lowest low over the last twenty periods?
A13: The IntelliScript features a user-friendly method when creating your own indicators making it hassle free.
Simply launch the IntelliScript Organizer and select the tab labeled Indicator. In the area labeled "Create Customized Indicator, you may assign a Name, select the channel to place your indicator, the color you would like it to appear in, as well as what this indicator will do in the Value box. Once you have entered your changes, the script will be shown in the window under "Expression"
Here is an example of a script referencing high and low for the request above:
//Indicator Ind1
Indicator Ind1
Ind1.Channel=0
Ind1.Color="Yellow"
Ind1.Value= HHV(High, 20)
Ind1.Draw
//Indicator Ind2
Indicator Ind2
Ind2.Channel=0
Ind2.Color="Green"
Ind2.Value=LLV(Low, 20)
Ind2.Draw
- Q14: I would like to create an alert when two indicators come within 6 pips of each other.
For example when WMA(34) and WMA(100) are within 6 pips of each other.
A14: Example:
IF ABS(WMA(Close, 34) - WMA(Close, 100)) <= Point(6) THEN
AlertOnly "WMA in Range"
ENDIF
- Q15: How can I create an alert for the Heikin Ashi to alert me when the bar changes color?
A15: Example:
IF HA_Close[0](Close) > HA_Open[0](Close) THEN
AlertOnly "Heikin Ashi is Blue"
ELSE
AlertOnly "Heikin Ashi is Red"
ENDIF
- Q16: I would like to write my own Daily Pivot Points calculated from midnight to midnight. Is this possible to do in the IntelliScript?
A16: Example script for the Daily Pivot Points calculated from midnight to midnight that will be shown on hourly and smaller time frames:
Local midnighttp, midinx
Global dayO=-1
Global dayC=-1
Global dayH=-1
Global dayL=-1
If getBarTime(1)<getBarTime(2) then //midnight
midnighttp=GetTimePoint(0)-86400000
midinx=GetIndexByTimePoint(midnighttp)
If midinx>0 then
dayC=close[1]
dayO=open[midinx]
dayH=HHV(high,midinx)
dayL=LLV(low,midinx)
Endif
Endif
If dayH>0 then
Local MyPivot=(dayH+dayL+dayC)*0.333
Local S1 = MyPivot - (dayH - MyPivot) //S1 Line
Local S2 = MyPivot - (dayH - dayL) //S2 Line
Local S3 = dayL - (dayH - dayL) //S3 Line
Local R1 = MyPivot + (MyPivot - dayL) //R1 Line
Local R2 = MyPivot + (dayH - dayL) //R2 Line
Local R3 = dayH + (dayH - dayL) //R3 Line
HLine MyS1 = S1
MyS1.Color = "Blue"
HLine MyS2 = S2
MyS2.Color = "Blue"
HLine MyS3 = S3
MyS3.Color = "Blue"
HLine MyR1 = R1
MyR1.Color = "Red"
HLine MyR2 = R2
MyR2.Color = "Red"
HLine MyR3 = R3
MyR3.Color = "Red"
HLine MyLastHigh = dayH
MyLastHigh.Color = "Black"
HLine MyLastLow = dayL
MyLastLow.Color = "Black"
Endif
To complete the script, check the box for "Generate Historical Alerts" under "Set Alert Properties" on the "Alert" tab before attaching to a chart.
- Q17: When I draw support and resistance lines using the "add line" tool, is there any way these lines can be recognized using the IntelliScript code?
A17: You may reference lines on the chart within code using the IntelliScript. To do so, right mouse click on the line of your choice and assign a label. You may then use the line label preceded by an underscore within your code to reference this specific line. For example, if a trend line has been labeled ABC, to refer to this line in your code use this syntax: _ABC.
Disclaimer: The following examples do not reflect real trade strategies. They are designed for syntax demonstration purpose only..
- Example 1:
Purpose:
Generate a buy alert when 5-period EMA crosses from below 10-period EMA to above 10-period EMA.
Expression Syntax:
IF CrossUp(EMA(Close, 5), EMA(Close, 10)) THEN
AddBuyEntry
ENDIF
Points to note:
EMA(Close, 5): This statement says that the EMA is calculated using the Close price of each bar and 5 is the EMA period. A further example MACD(high, 12, 26, 9) says that the MACD is calculated using the High price of each bar and 12, 26, and 9 are the three parameters for this MACD.
AddBuyEntry: This command* will generate a buy position by painting an arrow pointing upward on the chart. The corresponding sell position is command AddSellEntry.
*In programming language a "Command" is an action type of statement. In this case it is a specific order to the IntelliScript software from you, the user.
An "IF
THEN
ELSE
ENDIF" structure is the basic structure for most alert conditions. The basic syntax for this statement is:
IF (condition) THEN
command
ENDIF
In this structure, condition** is a statement that evaluates if the statement is either true or false at a given time. When a condition is true, the command is executed. An extension of this structure is the "ELSE" statement:
IF (condition) THEN
command1
ELSE
command2
ENDIF
In this extension structure, when a condition is true, command1 is executed; when the condition is false, command2 is executed.
** In programming, the condition is a type of statement that controls the flow of the IF-THEN-ELSE statement, or alert in this case, based on whether certain conditions are met. The statement is normally set up in the form: If (specific condition is met) Then (do this action) Else (do this if the condition is not met).
CrossUp(EMA(Close, 5), EMA(Close, 10)): This statement uses the special CrossUp function, which is true if its first parameter crosses from below the second parameter to above the second parameter. The opposite function is CrossDown(EMA(Close, 5), EMA(Close, 10)).
- Example 2:
Purpose:
Generate a buy alert when the K-line of Slow Stochastic (with 5, 6, and 10 as the parameters) crosses from below the D-line of Slow Stochastic to above the D-line, and generate a sell alert when the same K-line crosses from above the same D-line to below the D-line.
Expression Syntax:
IF (SlowK(Low, 5, 6, 10) > SlowD(Low, 5, 6, 10)) THEN
AddBuyEntry
ELSE
AddSellEntry
ENDIF
Points to note:
This example demonstrates the "ELSE" extension structure. Please refer to Example 1 for more information on the "IF
THEN
ELSE
ENDIF" structure
SlowK(Low, 5, 6, 10): this statement says that the Slow Stochastic's K-line is calculated using the Low price of each bar and 5, 6, and 10 are the three parameters for the K-line.
- Example 3:
Purpose:
Generate a buy entry alert when the upper Bollinger Band crosses with the previous bar's high price, and close the buy entry alert (a buy exit alert) when the lower Bollinger Band crosses with current bar's low price.
Expression Syntax:
IF (BLG_U[0](Close, 20, 2) < high[1]) THEN
AddBuyEntry
ENDIF
IF (BLG_L[0](Close, 20, 2) > Low[0]) THEN
AddBuyExit
ENDIF
Points to note:
Up until now we have assumed that each condition requires the indicator calculated on the current bar. If an alert requires the indicator calculated on the previous bar, we then need to use the "displacement" parameter.
High[1]: This statement refers to the high price of the previous bar. [0] indicates the current bar. Note that [0] can be omitted. [1] indicates the previous bar. [2] indicates you want to use the second bar to the left of the current bar.
BLG_U[0](Close, 20, 2): This statement says that the Bollinger Band's upper band is calculated using the close price of each bar and 20 and 2 are the two parameters for the Bollinger Band. In this expression, we once again introduced the displacement parameter [..]. By default, this parameter is omitted in the syntax, which means the indicator is applied to the current bar. BLG_U[0](Close, 20, 2) is equivalent to BLG_U(Close, 20, 2).
AddBuyExit: This command will close the previous buy entry position. The corresponding sell position's command is AddSellExit.
- Example 4:
Purpose:
Generate a buy entry alert when the upper Bollinger Band crosses with the previous bar's high price. Set a stop loss for this buy entry alert if the current price is 75 pips below the buy entry price.
Expression Syntax:
Global MyBuyStop = -1
IF (BLG_U[0](Close, 20, 2) < high[1]) THEN
AddBuyEntry
ENDIF
MyBuyStop = LastTradePrice[0] - .0075
IF (Close < mybuystop) THEN
AddBuyExit AT MyBuyStop
ENDIF
Points to note:
This alert introduces to us how to declare variables and how to set stop losses.
Global MyBuyStop = -1: This statement makes the initial declaration for variable MyBuyStop. Note that the word "MyBuyStop" is arbitrary. One can create any single word after the Global keyword as the variable name. We introduce the word Global as the necessary language to be used in the declaration of the variable. The syntax for Global is:
Global variableName = expression
The above statement has two effects: 1. Declare variable named variableName; 2. Initialize this variable with the value evaluated by expression, in the example above, expression is -1..
LastTradePrice: This keyword evaluates to the entry price of the last buy or sell position. Note that the displacement parameter is applicable to this keyword, LastTradePrice. Another example is LastTradePrice[1] which evaluates to the entry price of buy or sell position just prior to (one position to the left of) the last generated entry price of buy or sells position.
AT: By default, commands AddBuyEntry, AddBuyExit, AddSellEntry, AddSellExit, or AlertOnly cause the event to happen at the price when the condition is met. We refer to these 5 commands as the addCommand. The AT keyword enables the above commands to occur at the price following the AT keyword or expression. The formal syntax for AT is:
addCommand AT expression
The list of available addCommand is:
AddBuyEntry
AddSellEntry
AddBuyExit
AddSellExit
AlertOnly
In programming, a variable is uniquely named by the programmer (you the user) and is a structure that holds data, or your statement in this case. It holds the data assigned to it until a new value is assigned.
- Example 5:
Purpose:
Generate a sell entry alert when the lower Bollinger Band crosses with the previous bar's low price. Set a stop loss for this sell entry alert if the price goes 30 pips above the sell entry price. Exit the sell entry alert if the price goes 75 pips below the sell entry price.
Expression Syntax:
Global MySellStop = -1
Global MySellProfit = -1
IF (BLG_L[0](Close, 20, 2) > Low[1]) THEN
AddSellEntry
ENDIF
MySellStop = ABS(LastTradePrice[0]) + Point(30)
MySellProfit = ABS(LastTradePrice[0]) - Point(75)
IF (LastTradePrice[0] <0 and Close[0]> MySellStop) THEN
AddSellExit AT MySellStop
ENDIF
IF (LastTradePrice[0] <0 and Close[0] < MySellProfit) THEN
AddSellExit AT MySellProfit
ENDIF
Points to note:
This example shows us how to set a stop loss for a sell position and how to exit the sell position if the profit target is reached.
ABS(LastTradePrice[0]): A sell position is the opposite of a buy position. Therefore, LastTradePrice for a sell position will always evaluate to a negative value. In order to return its positive value, we can use the ABS(x) function, which returns the absolute value of the input. For example, ABS(-10) is equal to 10. ABS(20) is equal to 20.
Point(75): Here we introduce a special short-cut function so that this same alert can be applied to JPY related currency pairs as well as other pairs. For JPY related currency pairs, this function 0.75. For all other currency pairs, this function evaluates to 0.0075.
- Example 6:
Purpose:
Draws a customized indicator which displays as two colors. If the close price is greater than the open price, the indicator is displayed as a blue line; otherwise, the indicator is displayed as a red line. The value of the indicator is the percentage difference of each bar's close price and open price in reference with the close price.
Expression Syntax:
// Define a customized indicator called "MyInd"
Indicator MyInd
MyInd.Channel = 1
IF Close > Open THEN
MyInd.Color = "Blue"
MyInd.Value = (Close - Open) / Close * 100
ELSE
MyInd.Color = "Red"
MyInd.Value = (Open - Close) / Close * 100
ENDIF
MyInd.Draw
Points to note:
// When a line of script is started with these two forward slashes, it means this line is ignored by the IntelliScript engine. This is called commenting. It is a convenient way to add your note in your script.
Indicator MyInd: This is how you define the name of your customized indicator. The name of the indicator can be any word you create. The declaration's formal syntax is:
Indicator indicatorName
MyInd.Channel = 1: This syntax tells the chart in which channel to draw this indicator. When the channel is equal to 0, the indicator is drawn in the same channel as the price bars (the Price Channel). When the channel is equal to 1, the indicator is drawn in the first lower channel below the Price Channel.
MyInd.Value = (Close - Open) / Close * 100: To assign the calculations to the customized indicator, you use the .Value property.
MyInd.Color = "Blue": This syntax assigns a blue color to the customized indicator. The available colors are "Yellow", "Green", "Black", "Purple", "Blue", and "Red"
MyInd.Draw: Only if you write this syntax in the end, this customized indicator will be drawn on the chart.
- Example 7:
Purpose:
Send an email when an alert is generated.
Expression Syntax:
IF CrossUP(EMA(Close,5) , EMA(Close,10)) THEN
AddBuyEntry "EMA Cross Up"
SendMail "EMA Cross UP", "johnsmith@yahoo.com"
ENDIF
IF CrossDown(EMA(Close,5) , EMA(Close,10)) THEN
AddSellEntry "EMA Cross Down"
SendMail "EMA Cross Down", "MailList"
ENDIF
Points to note:
AddBuyEntry "EMA Cross Up": This syntax shows you that you can add your own popup messages when a buy entry position is added to the chart. You can substitute any text you want inside the two double quotes.
SendMail "EMA Cross Up", "johnsmith@yahoo.com": This syntax shows you that you can send an email when an alert is generated. The first double quotes contain the subject for the email. The second double quotes contain the email address. Note instead of writing an email address every time when you write the script, you can configure a list of email addresses under the Organizer tab in the Default Email List section. Then you can simply use "MailList" as the second parameter.
- Example 8:
Purpose:
Generate a buy alert when 5-period EMA crosses from below 10-period EMA to
above 10-period EMA and the EUR/USD 1-Hour chart is currently in a buy
position at the same moment. Generate a sell alert when 5-period EMA crosses
from above 10-period EMA to below 10-period EMA and the EUR/USD 1-Hour chart
is currently in a sell position at the same moment. Please read "Points to
Note" below to learn more details.
Expression Syntax:
Local OneHourEURTradePos
OneHourEURTradePos = getValue("EUR/USD,1 Hour", getTradePrice(0))
IF CrossUP(EMA(Close,5) , EMA(Close,10)) AND (OneHourEURTradePos > 0) THEN
AddBuyEntry
ENDIF
IF CrossDown(EMA(Close,5) , EMA(Close,10)) AND (OneHourEURTradePos <0) THEN
AddSellEntry
ENDIF
Points to note:
This example assumes that the syntax above is attached to a data series that
is not a EUR/USD 1-hour data series. The purpose is that suppose you have a
different strategy written as a customized alert and attached to the EUR/USD
1-hour data series, now you want to generate an alert in a second strategy
only when the first strategy is in the same trade. For example, you have
attached the script shown in Example 1 to the EUR/USD 1-hour data series.
Now you attach this Example 8 script to the EUR/USD 5-minute data series.
As a result, this Example 8 script will generate a buy entry position when
the 5-period EMA crosses with the 10-period EMA in both the EUR/USD 1-hour
data series and the EUR/USD 5-minute data series.
getValue("EUR/USD,1 Hour", getTradePrice(0)): This syntax shows you how to retrieve the current position in a different data series. If the current position on the EUR/USD 1-Hour chart is a buy position, the syntax returns a position number. If the current position on the EUR/USD 1-Hour chart is a sell position, the syntax returns a negative number. If on the EUR/USD 1-Hour, there is no buy or sell position at the moment, the syntax above returns 0.
- Example 9:
Purpose:
Generate a log file at the close of each bar for the data series in which the script is attached.
Expression Syntax:
IF BarClosed() THEN
LogData "C:\EURUSD.TXT"
ENDIF
Points to note:
Unlike previous examples, this example does not generate any signals. We use this example to demonstrate how to generate a data file automatically when a bar closes. Suppose this script is attached to a EUR/USD 1-minute chart, then you will be able to log a 1-minute historical data continuously when the chart is open.
BarClosed(): This function returns true when the current bar becomes closed.
LogData: This function takes one parameter: the location of the log file you wish to be saved. In this example, the log file is named EURUSD.TXT and is saved in your local C: drive.
- Example 10:
Purpose:
Draw customized Pivot Points (horizontal support and resistance lines) on the chart.
Expression Syntax:
Local MyPivot, R1, R2, R3, S1, S2, S3
MyPivot = (High[1] + Low[1] + Close[1]) / 3
S1 = MyPivot - (High[1] - MyPivot) //S1 Line
S2 = MyPivot - (High[1] - Low[1]) //S2 Line
S3 = Low[1] - (High[1] - Low[1]) //S3 Line
R1 = MyPivot + (MyPivot - Low[1]) //R1 Line
R2 = MyPivot + (High[1] - Low[1]) //R2 Line
R3 = High[1] + (High[1] - Low[1]) //R3 Line
HLine MyS1 = S1
HLine MyS2 = S2
HLine MyS3 = S3
HLine MyR1 = R1
HLine MyR2 = R2
HLine MyR3 = R3
Points to note:
HLine MyS1 = S1: This syntax creates a horizontal line called "MyS1" on the chart. The value of MyS1 is S1.
- Example 11:
Purpose:
To generate a buy signal when the current price crosses above a drawn trendline and generate a sell signal when the current price crosses below the same trendline.
Expression Syntax:
IF price[0] > _ABC THEN
AddBuyEntry
ENDIF
IF price[0] < _ABC THEN
AddSellEntry
ENDIF
Points to note:
The trendline that is drawn on the chart must be named. To do so, right click on the line of your choice and select "Set Name". When you reference this line in IntelliScript, you must use an underscore before the name. The line in the above example is named ABC, to reference this line in IntelliScript, you would use _ABC. If you attach the above script to a chart that does not have a trendline named _ABC, the script would not run properly as the value of _ABC is undefined.
- Example 12:
Purpose:
To exclude from Friday at 2:00 PM to Monday 1:00 AM from my trading strategy.
Expression Syntax:
local tp=GetTimePoint(0)
local int hour = GetHour(tp)
local int day_of_week=GetDayofWeek(0)
If ( day_of_week = 5 and hour >= 14 )
or (day_of_week = 6 )
or (day_of_week = 0 )
or (day_of_week = 1 and hour < 1 ) Then
return
Endif
IF ( BLG_U[0](Close, 20, 2) - BLG_L[0](Close, 20, 2) ) < point(20) THEN
RETURN
ENDIF
Points to note:
Sunday is represented by 0 using the GetDayofWeek function. Monday would be 1.
- Example 13:
Purpose:
To add the value of an indicator to the body of an email using the SendMail function.
Expression Syntax:
Local Float body = EMA[0](Close, 10)
Local String emailbody = "EMA10 is " + body
IF price[0] > 1.2365 Then
AddBuyEntry
Sendmail "Subject", emailbody
ENDIF
- # Comments
Sometimes a user wants to add his/her texts in the script as comments, which are ignored by the IntelliScript engine. There are two ways to place comments in IntelliScript.
Syntax 1:
// ...
Remark:
Any content after // and on the same line as // is ignored by IntelliScript. // can comment only one line of script at a time.
Syntax 2:
/* ... */
Remark:
Any content between /* and */ is ignored by IntelliScript engine. In contrast with //, commenting using /* ... */ can cover many lines of script.
Example:
// The script below will add a buy entry
IF (RSI[0](Close, 14) <20/* This is my RSI condition */ and
CrossUP(EMA[0](close, 10), EMA[0](Close, 48)) /* This is my EMA condition
*/) THEN
AddBuyEntry // This is when I place a buy entry
ENDIF
- # Syntax Conventions
The IntelliScript Syntax Reference uses the following conventions in its documentations:
| (vertical bar): Separating syntax items within brackets or braces. You can only choose one of the items.
[ ] (brackets): Optional syntax items. Do not type the brackets in your real syntax.
{ } (braces): Required syntax items. Do not type the braces in your real syntax.
- ABS
Syntax:
Abs({valueExpression})
Parameter:
valueExpression
Required. Float expression to be evaluated.
Action:
Evaluates to the absolute value of valueExpression. For example, ABS(-10) = 10, and ABS(20) = 20.
Example:
ABS(-50)
- AddBuyEntry
AddBuyEntry lot AddBuyExit lot AddSellEntry lot AddSellExit lot
Syntax:
AddBuyEntry [{"messageString"}] [Contract [=] {"nameString"}] [AT [=] {valueExpression} | OVER [=] {valueEpression} | BELOW [=] {valueExpression}] [LOT [=] {valueExpression}]
Arguments:
messageString
Optional. A string to be displayed in the message box.
Contract
Optional. A string to identify a specified contract.
AT
Optional. Float value to specify the entry price level. Note, if you use the AT parameter, you need to make sure the entry price is an attainable price for current price candle. If the price is not attainable in current candle, no action is taken.
OVER
Optional. Float value to enter as the entry price until the price goes up to this value.
BELOW
Optional. Float value to enter as the entry price until the price goes down to this value.
LOT
Optional. Integer, lot's unit is k. "lot=10" refers to 10k contract.
Action:
Popup a message box with sound and place a buy arrow on the chart.
Remark:
1: "messageString" is what will popup when the buy entry position is triggered. Use double quote to surround your message.
2: Contract defines which contract this position belongs to. In order to have multiple same directional positions, each position must belong to a different contract. Use double quote to surround your contract names.
3: AT, OVER, and BELOW are mutually exclusive, you cannot use more than one of them at a time. AT will add the position despite whether the valueExpression is an attainable price or not. In contrast, using OVER or BELOW will ensure that the position will only be added if the valueExpression is an attainable price.
4: Lot parameter is added to buy/sell actions so trader can specify the lots amount.
Example 1:
IF CrossUP(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddBuyEntry
ENDIF
Example 2:
IF CrossUP(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddBuyEntry "EMA5 Cross UP EMA10" Contract="MyCon1"
ENDIF
Example 3:
IF CrossUP(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddBuyEntry lot = 20
ENDIF
IF CrossDown(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddBuyExit lot = 10 "partial exit"
ENDIF
- AddBuyExit
Syntax:
AddBuyExit [{"messageString"}] [Contract [=] {"nameString"}] [AT [=] {valueExpression} | OVER [=] {valueEpression} | BELOW [=] {valueExpression}] [LOT [=] {valueExpression}]
Arguments:
messageString
Optional. A string to be displayed in the message box.
Contract
Optional. A string to identify a specified contract.
AT
Optional. Float value to specify the exit price level. Note, if you use the AT parameter, you need to make sure the exit price is an attainable price for current price candle. If the price is not attainable in current candle, no action is taken.
OVER
Optional. Float value to exit the contract until the price goes up to this value.
BELOW
Optional. Float value to exit the contract until the price goes down to this value.
LOT
Optional. Integer, lot's unit is k. "lot=10" refers to 10k contract.
Action:
Popup a message box with sound and place a buy exit arrow on the chart.
Remark:
1: "messageString" is what will popup when the buy exit position is triggered. Use double quote to surround your message.
2: Contract defines which contract this position belongs to. In order to have multiple same directional positions, each position must belong to a different contract. Use double quote to surround your contract names.
3: AT, OVER, and BELOW are mutually exclusive, you cannot use more than one of them at a time. AT will add the position despite whether the valueExpression is an attainable price or not. In contrast, using OVER or BELOW will ensure that the position will only be added if the valueExpression is an attainable price.
4: Lot parameter is added to buy/sell actions so trader can specify the lots amount.
Example 1:
IF Profit(0) > Point(50) THEN
AddBuyExit "Take Profit"
ENDIF
Example 2:
IF Loss(0) > Point(30) THEN
AddBuyEixt "Stop Loss"
ENDIF
Example 3:
IF CrossUP(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddBuyEntry lot = 20
ENDIF
IF CrossDown(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddBuyExit lot = 10 "partial exit"
ENDIF
- AddSellEntry
Syntax:
AddSellEntry [{"messageString"}] [Contract [=] {"nameString"}] [AT [=] {valueExpression} | OVER [=] {valueEpression} | BELOW [=] {valueExpression}] [LOT [=] {valueExpression}]
Arguments:
messageString
Optional. A string to be displayed in the message box.
Contract
Optional. A string to identify a specified contract.
AT
Optional. Float value to specify the entry price level. Note, if you use the AT parameter, you need to make sure the entry price is an attainable price for current price candle. If the price is not attainable in current candle, no action is taken.
OVER
Optional. Float Float value to enter as the entry price until the price goes up to this value.
BELOW
Optional. Float value to enter as the entry price until the price goes down to this value.
LOT
Optional. Integer, lot's unit is k. "lot=10" refers to 10k contract.
Action:
Popup a message box with sound and place a sell arrow on the chart.
Remark:
1: "messageString" is what will popup when the sell entry position is triggered. Use double quote to surround your message.
2: Contract defines which contract this position belongs to. In order to have multiple same directional positions, each position must belong to a different contract. Use double quote to surround your contract names.
3: AT, OVER, and BELOW are mutually exclusive, you cannot use more than one of them at a time. AT will add the position despite whether the valueExpression is an attainable price or not. In contrast, using OVER or BELOW will ensure that the position will only be added if the valueExpression is an attainable price.
4: Lot parameter is added to buy/sell actions so trader can specify the lots amount.
Example 1:
IF CrossDOWN(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddSellEntry
ENDIF
Example 2:
IF CrossDOWN(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddSellEntry "EMA5 Cross DOWN EMA10" Contract="MyCon1"
ENDIF
Example 3:
IF CrossUP(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddSellEntry lot = 20
ENDIF
IF CrossDown(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddSellExit lot = 10 "partial exit"
ENDIF
- AddSellExit
Syntax:
AddSellExit [{"messageString"}] [Contract [=] {"nameString"}] [AT [=] {valueExpression} | OVER [=] {valueEpression} | BELOW [=] {valueExpression}] [LOT [=] {valueExpression}]
Arguments:
messageString
Optional. A string to be displayed in the message box.
Contract
Optional. A string to identify a specified contract.
AT
Optional. Float value to specify the exit price level. Note, if you use the AT parameter, you need to make sure the exit price is an attainable price for current price candle. If the price is not attainable in current candle, no action is taken.
OVER
Optional. Float value to exit the contract until the price goes up to this value.
BELOW
Optional. Float value to exit the contract until the price goes down to this value.
LOT
Optional. Integer, lot's unit is k. "lot=10" refers to 10k contract.
Action:
Popup a message box with sound and place a sell exit arrow on the chart.
Remark:
1: "messageString" is what will popup when the sell exit position is triggered. Use double quote to surround your message.
2: Contract defines which contract this position belongs to. In order to have multiple same directional positions, each position must belong to a different contract. Use double quote to surround your contract names.
3: AT, OVER, and BELOW are mutually exclusive, you cannot use more than one of them at a time. AT will add the position despite whether the valueExpression is an attainable price or not. In contrast, using OVER or BELOW will ensure that the position will only be added if the valueExpression is an attainable price.
Example 1:
IF Profit(0) > Point(50) THEN
AddSellExit "Take Profit"
ENDIF
Example 2:
IF Loss(0) > Point(30) THEN
AddSellExit "Stop Loss"
ENDIF
Example 3:
IF CrossUP(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddSellEntry lot = 20
ENDIF
IF CrossDown(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddSellExit lot = 10 "partial exit"
ENDIF
- AdjustedLoss
Syntax:
AdjustedLoss()
Arguments:
None.
Action:
Return the loss based on AdjustedPrice in float format.
Remark:
If you are in a buy position, and the entry price was 1.3205. The AdjustedPrice() is 1.3505. The current price is 1.3405. Then the AdjustedLoss is 1.3505 - 1.3405 = 100 pips.
- AdjustedPrice
Syntax:
AdjustedPrice()
Arguments:
None.
Action:
If it is a buy position, return the highest price since buy entry in float format.
If it is a sell position, return the lowest price since sell entry in float format.
Example:
If isBuyPosition() and (AdjustedPrice() - LastTradePrice()) > point(50)) Then
AlertOnly "You've gained 50 pips!"
Endif
- AlertOnly
Syntax:
AlertOnly [{"messageString"}]
Arguments:
messageString
Optional. A string to be displayed in the message box.
Action:
Popup a message box with sound. No arrow is added on the chart.
Remark:
Generates a popup message only. This statement will not place a position on the chart.
Example:
IF (RSI[0](Close, 14) > 80) THEN
AlertOnly "RSI14 Over 80"
ENDIF
- And
Syntax:
{Boolean expression1} AND {Boolean expression2}
Parameters:
Boolean expression1, Boolean expression2
Both are required.
Action:
If boolean expression1 and boolean expression2 are both TRUE, Otherwise (at least one of expressions is FALSE) return FALSE.
Example:
2 > 0 AND 15 > 10 //will return TRUE
2 > 0 AND 3 <0 //will return FALSE
- BarClosed
Syntax:
BarClosed()
Remark:
During the current calculation, if the bar is closed, return boolean expression TRUE.
Example:
IF BarClosed() THEN
AlertOnly "5 min closed"
ENDIF
- BuyStopLoss
Syntax:
BuyStopLoss {valueExpression}
Argument:
valueExpression
This is the stop loss amount you set: a float value.
Action:
When you have a buy entry position on the chart, this command will calculate the stop loss. If the stop loss is greater than valueExpression points, the IntelliScript engine will issue the AddBuyExit command automatically for you.
Example:
IF CrossUP(EMA(Close,5) , EMA(Close,10)) THEN
AddBuyEntry
ENDIF
BuyStopLoss Point(30)
- BuyTakeProfit
Syntax:
BuyTakeProfit {valueExpression}
Argument:
valueExpression
This is the profit amount you set: a float value.
Action:
When you have a buy entry position on the chart, this command will calculate the current profit the position has generated. If the current profit is greater than valueExpression points, the IntelliScript engine will issue the AddBuyExit command automatically for you.
Example:
IF CrossUP(EMA(Close,5) , EMA(Close,10)) THEN
AddBuyEntry
ENDIF
BuyTakeProfit Point(50)
- BuyTrailingStop
Syntax:
BuyTrailingStop point {valueExpression}
Argument:
valueExpression
This is the stop loss amount you set: can be an integer or a float number. pips
Action:
When you have a buy entry position on the chart, this command will calculate the trailing stop in pips. If the trailing stop is greater than valueExpression pips, the IntelliScript engine will issue the AddSellExit command automatically for you.
Example:
IF CrossDown(EMA(Close,5), EMA(Close,10)) THEN
AddBuyEntry
ENDIF
BuyTrailingStop Point(30)
- CrossDOWN
Syntax:
CrossDOWN({indicatorExpression1}, {indicatorExpression2})
Parameter:
indicatorExpression1
Required. This is the first indicator parameter, a float expression.
indicatorExpression2
Required. This is the second indicator parameter, a float expression.
Action:
When {indicatorExpression1} is crossing from above indicatorExpress2 to below indicatorExpress2, return boolean expression TRUE. Otherwise, return Boolean expression FALSE.
Example:
IF CrossUP(EMA(Close,5) , EMA(Close,10)) THEN
AddBuyEntry "EMA Cross Up"
SendMail "EMA Cross UP", "john@hotmail.com"
ENDIF
IF CrossDown(EMA(Close,5) , EMA(Close,10)) THEN
AddSellEntry "EMA Cross Down"
SendMail "EMA Cross Down", "MailList"
ENDIF
- CrossUP
Syntax:
CrossUP({indicatorExpression1}, {indicatorExpression2})
Parameter:
indicatorExpression1
Required. This is the first indicator parameter, a float expression.
indicatorExpression2
Required. This is the second indicator parameter, a float expression.
Action:
When {indicatorExpression1} is crossing from below indicatorExpress2 to above indicatorExpress2, return boolean expression TRUE. Otherwise, return Boolean expression FALSE.
Example:
IF CrossUP(EMA(Close,5) , EMA(Close,10)) THEN
AddBuyEntry "EMA Cross Up"
SendMail "EMA Cross UP", "john@hotmail.com"
ENDIF
IF CrossDown(EMA(Close,5) , EMA(Close,10)) THEN
AddSellEntry "EMA Cross Down"
SendMail "EMA Cross Down", "MailList"
ENDIF
- Enter_Open
Syntax:
Enter[{0 | 1 | 2 | 3 | ...}]
or
Open[{0 | 1 | 2 | 3 | ...}]
("Enter" and "Open" are interchangeable, they are two names for the same function)
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar counted to the left from the current bar (the index of the current bar is 0).
Action:
Returns the Open price of the bar specified by the parameter, counted from the right to the left.
Example:
Open[0] //returns the Open price of the current bar.
Open[25] //returns the Open price of the 25th bar to the left of the current bar.
- FOR_NEXT
Syntax:
FOR counter {=} start {TO} end [Step step]
{statement
[statement
...]}
NEXT
Arguments:
counter
Required. Numeric variable used as a loop counter.
indicatorExpression2
Required. This is the second indicator parameter, a float expression.
start
Required. Initial value of counter.
end
Required. Final value of counter.
Step
Optional. Amount counter is changed each time through the loop. If not specified, counter will be increased by one each time through the loop.
- GetChartName
Syntax:
GetChartName()
Action:
It returns the attached chart's name. "EUR/USD(1 min. 8 hr.)" is an example result.
Example:
IF getChartName () = "EUR/USD(1 min. 8 hr.)" THEN
AlertOnly "This is Euro 1 min 8 hour chart"
ENDIF
- GetBarCount
Syntax:
GetBarCount()
Parameters:
None.
Action:
Returns the total number of bars (candles) on the chart in integer format from the current chart.
Example:
Local Int barCount=GetBarCount()
- GetBarDate
Syntax:
GetBarDate({0 | 1 | 2 | 3 | ...}}
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar to the left of the current bar.
Action:
Returns the close date of the nth bar to the left of the current bar in Integer format.
Example:
// If the current bar closes on 10/30/2003, GetBarDate(0) returns 20031030
IF GetBarDate(0) = 20031030 THEN
AlertOnly "This is my birthday!"
ENDIF
- GetBarTime
Syntax:
GetBarTime({0 | 1 | 2 | 3 | ...})
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar to the left of the current bar.
Action:
Returns the close time of the nth bar to the left of the current bar in Integer format.
Example:
// If the current bar closes on 11:59PM, GetBarTime(0) returns 2359
IF GetBarTime(0) = 2359 THEN
AlertOnly "I am sleeping at this time"
ENDIF
- GetBEPrice
Syntax:
GetBEPrice({0 | 1 | 2 | 3 | ...})
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the trade signal (BuyEntry, SellEntry, BuyClose or SellClose) counted to the left from the rightmost signal (whose index is 0).
Action:
If the specified signal is a BuyEntry, returns signal price. If it is not or non-existent, returns 0.
Example:
GetBEPrice(5) //returns the signal price of the 6th trade signal from the rightmost if that signal is indeed a BuyEntry, otherwise it returns 0.
- GetBXPrice
Syntax:
{0 | 1 | 2 | 3 | ...}
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the trade signal (BuyEntry, SellEntry, BuyExit or SellExit) counted to the left from the rightmost signal (whose index is 0).
Action:
If the specified signal is a BuyExit, returns signal price. If it is not or non-existent, returns 0.
Example:
GetBXPrice(5) //returns the signal price of the 6th trade signal from the right if that signal is indeed a BuyExit, otherwise it returns 0.
- GetCurrTime
Syntax:
GetCurrTime()
Action:
Returns the current time in String format displayed as hhmmss.
Example:
// If the current time is after 1:00 am, alert me to go to sleep
IF GetCurrTime() = "010000" THEN
AlertOnly "It's time to go to bed!"
ENDIF
- GetDayofWeek
Syntax:
GetDayofWeek({0|1|2|3|...})
Parameters:
{0|1|2|3|...}
Required. This is the index of the bar to the left of the current bar.
Action:
Based on the date of the nth bar, return the day of the week of that date. The return type is integer. If it is Sunday, will return 0. If it is Monday, will return 1, and so on.
Example:
Int i=GetDayOfWeek(20)
- GetHour
Syntax:
GetHour(TimePoint)
Parameter:
TimePoint
Required. It is a long integer value returned by function GetTimePoint().
Action:
Returns the hour of the time point (0-24).
Example:
Local tp = GetTimePoint(5) //now tp is a long integer marking the ending time of the 5th bar to the left of the current bar
Local h = GetHour(tp) //b is the hour element of tp, if that bar ended at 3:45pm, then h is 15.
- GetIndexByTime
Syntax:
GetIndexByTime("mm/dd/yyyy HH:MM:SS")
Parameter:
"mm/dd/yyyy HH:MM:SS"
Required. This is the time of the bar for which you want to return the index.
Action
Returns the index of the bar relative to the current bar that falls at the time specified.
Example:
GetIndexByTime("05/21/2004 05:17:44")
- GetIndexByTimePoint
Syntax:
GetIndexByTimePoint(TimePoint)
Parameter:
TimePoint
Required. Long integer value returned by function GetTimePoint().
Action
Returns the bar index specified by timepoint. It works like a reverse function of GetTimePoint().
Example:
Local tp = GetTimePoint(5) //tp, the TimePoint, is the ending time of the 5th bar to the left of the current bar
Local b = GetIndexByTimePoint(tp) //b is 5
- GetInterval
Syntax:
GetInterval()
Parameters:
None.
Action:
Returns the bar interval time in minutes.
Example:
If it is a 5min. 6hr. chart, GetInterval() would return 5.
If it is a 1hr. 10 day chart, GetInterval() would return 1440.
- GetOpenLots
Syntax:
GetOpenLots ({0 | 1 | 2 | 3 | ...})
Parameters:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar to the left of the current bar.
Action:
It returns amount of total lots of open positions Integer. The lot's unit is k. "lot=10" refers to 10k contract.
Example:
GetOpenLots (0)
/* The lot size of last position to the left of the current bar is 1, GetOpenLots (0) = 10 */
- GetSEPrice
Syntax:
GetSEPrice({0 | 1 | 2 | 3 | ...})
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the trade signal (BuyEntry, SellEntry, BuyClose or SellClose) counted to the left from the rightmost signal (whose index is 0).
Action
If the specified signal is a SellEntry, returns signal price. If it is not or non-existent, returns 0.
Example:
GetSEPrice(5) //returns the signal price of the 6th trade signal from the rightmost if that signal is indeed a SellEntry, otherwise it returns 0.
- GetSXPrice
Syntax:
GetSXPrice({0 | 1 | 2 | 3 | ...})
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the trade signal (BuyEntry, SellEntry, BuyClose or SellClose) counted to the left from the rightmost signal (whose index is 0).
Action
If the signal pointed is a SellExit, returns signal price. If it is not or non-existent, returns 0.
Example:
GetSXPrice(5) //returns the signal price of the 6th trade signal from the rightmost if that signal is indeed a SellExit, otherwise it returns 0.
- GetSymbol
Syntax:
GetSymbol()
Action
It returns the attached chart's currency pair name. "EUR/USD" is an example result.
Example:
IF GetSymbol() = "EUR/USD" THEN
AlertOnly "This is Euro chart"
ENDIF
- GetTimePoint
Syntax:
GetTimePoint({0 | 1 | 2 | 3 | ...})
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar to the left of the current bar (or the rightmost bar, whose index is 0).
Action
Returns a unique long integer value marking the bar's ending time (to the milliseconds). This value is often used later by functions such as GetIndexByTimePoint.
Example:
GetTimePoint(0) //Returns a long integer value marking the current time.
GetTimePoint(5) //Returns a long integer value marking the ending time of 5th bar to the left of the current bar.
- GetTradeBarIndex
Syntax:
GetTradeBarIndex({0 | 1 | 2 | 3 | ...})
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar to the left of the current bar.
Action:
Returns the bar index of the nth position on the chart, counted from the right to the left.
Example:
GetTradeBarIndex(0)
/* If the last position to the left of the current bar is a buy entry position occurring at the 10th bar to the left of the current bar, GetTradeBarIndex(0) returns 10 */
- GetTradePrice
Syntax:
GetTradePrice({0 | 1 | 2 | 3 | ...})
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar to the left of the current bar.
Action:
Returns the price of the nth position on the chart, counted from the right to the left.
Example:
GetTradePrice(0)
/* If the last position to the left of the current bar is a buy entry position occurring at the 10th bar to the left of the current bar and if this position's entry price is 1.1612, GetTradePrice(0) = 1.1612 */
/* If the 4th last position to the left of the current bar is a sell entry position occurring at the 10th bar to the left of the current bar and if this position's entry price is 113.16, GetTradePrice(4) = -113.16 */
- GetValue
Syntax:
getValue({stringExpression}, {floatExpression})
Parameter:
stringExpression
Required. String expression that represents the currency symbol and time frame for which you wish to return the value.
floatExpression
Required. Float expression that represents the field for which you wish to return the value. Not that this expression is calculated on the currency symbol and time frame specified by the stringExpression above.
Action:
Return the value of the expression specified by floatExpression for the specified currency symbol and time frame. This function enables you to retrieve the value from a different data series than the one to which the IntelliScript is attached.
Example 1:
getValue("EUR/USD,1 hr. 30 day", Close[0])
// returns the current close price for EUR/USD 1-Hour 30-Day chart
Example 2:
getValue("1 hr. 30 day", GetTradePrice(0))
// returns the entry price of the last traded position on the 1-hour 30-day chart for the same currency symbol as the one to which this syntax is attached. For example, if this IntelliScript is attached to the EUR/USD 5-minute 12-hour chart, this syntax will return the entry price of the last traded position on the EUR/USD 1-hour 30-day chart
Example 3:
getValue("EUR/USD", EMA(Close, 10))
// returns the 10-period Exponential Moving Average for EUR/USD on the same time frame as the one to which this syntax is attached. For example, if this IntelliScript is attached to the USD/JPY 10-minute 1-day chart, this syntax will return the 10-period EMA value for EUR/USD 10-minute 1-day chart.
- Global
Syntax:
Global {variableName} [= {initialValueExpression}] [, {variableName} [= {initialValueExpression}] ...]
Action:
Declares a global variable. These variables remain accessible from every IntelliScript that are attached to the same Data Series. These variables can be assigned an initial value.
Example 1:
Global A = 0, B = -1
A = A + 1
B = 0
- HHV
Syntax:
HHV({indicatorExpression}, {integerValueExpression})
Parameter:
indicatorExpression
Required. Float expression.
integerValueExpression
Required. Integer expression.
Action:
Returns the highest indicatorExpression value for the last n bars.
Example 1:
HHV(High, 10)
/* Returns the highest high value for the last 10 bars. */
Example 2:
HHV(SMA(Close, 5), 20)
/* Returns the highest 5-period simple moving average value for the last 20 bars. */
- HHVindex
Syntax:
HHVindex({indicatorExpression}, {integerValueExpression})
Parameter:
indicatorExpression
Required. Float expression.
integerValueExpression
Required. Integer expression.
Action:
Returns the position of the bar where the highest indicatorExpression value for the last n bars occurs.
Example 1:
HHVindex(High, 10)
/* Returns the position of the bar where the highest high value for the last 10 bars occurs. */
Example 2:
HHVindex(SMA(Close, 5), 20)
/* Returns the position of the bar where the highest 5-period simple moving average value for the last 20 bars occurs. */
- High
Syntax:
High[{0 | 1 | 2 | 3 | ...}]
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar counted to the left of the current bar (or the rightmost bar, whose index is 0).
Action:
Returns the High price of the bar specified by the parameter.
Example:
High[0] //return the current bar's High price;
High[6] //return the High price of the 6th bar to the left of the current bar.
- HLine
Syntax:
HLine {indicatorName} {=} {valueExpression}
Arguments:
indicatorName
This is the name of the horizontal line.
valueExpression
This is the value of the horizontal line, a float expression.
Action:
Defines a horizontal line. The value for the horizontal line must be initialized in the declaration.
Property:
{indicatorName}.color = {"Yellow" | "Green" | "Black" | "Purple" | "Blue" | "Red"}
After you declare a horizontal line, you can set the line color to be one of the colors listed above.
Example:
HLine myLine = (High[1] + Low[1] + Close[1]) / 3
myLine.Color = "BLUE"
- IF_THEN_ELSE_ENDIF
Syntax:
IF {booleanExpression} THEN
{statement
[statement
...]}
[ELSE
{statement
[statement
...]}
ENDIF
Action:
Imposes conditions on the execution of a statement or a series of statements (here we refer to this as a statement block). The statement block following the THEN keyword is executed if the condition is satisfied (when the booleanExpression following the IF keyword returns TRUE). The optional ELSE keyword introduces an alternate statement block that is executed when the IF condition is not satisfied (when the booleanExpression returns FALSE).
Example 1:
IF EMA[0](Close, 5) > EMA[0](Close, 10) THEN
AddBuyEntry
ELSE
AddSellEntry
ENDIF
- Indicator
Syntax:
Indicator {indicatorName}
Augument:
indicatorName
This is the name of the customized indicator.
Action:
Defines a new customized Indicator.
Properties:
{indicatorName}.Value = {valueExpression}
Set the value for the defined customized indicator.
{indicatorName}.Channel = {0 | 1 | 2 | 3 | ...}
Set the channel in which the customized indicator is drawn. Setting as 0 will draw the indicator in the price channel. Setting as 1 will draw the indicator in the first lower channel below the price channel.
{indicatorName}.Color = {"Yellow" | "Green" | "Black" | "Purple" | "Blue" | "Red"}
Set the customized indicator to use one of the colors above.
{indicatorName}.Draw
Draws this customized indicator on the chart in which the IntelliScript is attached.
Example:
// Define a customized indicator called "MyInd"
Indicator MyInd
MyInd.Channel = 1
IF Close > Open THEN
MyInd.Color = "Blue"
MyInd.Value = (Close - Open) / Close * 100
ELSE
MyInd.Color = "Red"
MyInd.Value = (Open - Close) / Close * 100
ENDIF
MyInd.Draw
- IsBeginBar
Syntax:
isBeginBar()
Action:
During the current calculation, if the bar is the first bar on the chart (if the bar appears on the most left side of the chart), return boolean expression TRUE.
Example:
Global Counter
IF isBeginBar() THEN
Counter = 0
ENDIF
- IsBuyPosition
Syntax:
isBuyPosition()
Action:
If the last generated position is a buy entry position, return Boolean expression TRUE. Otherwise, return Boolean expression FALSE.
Example:
IF isBuyPosition() AND Close - GetTradePrice(0) > Point(20) THEN
AddBuyExit
ENDIF
- IsEmptyPosition
Syntax:
isEmptyPosition()
Action:
If the last generated position is either a buy exit position or a sell exit position or if there have not been any position generated on the chart, return Boolean expression TRUE. Otherwise, return Boolean expression FALSE.
Example:
IF isEmptyPosition() AND CrossUp(EMA(Close,10), EMA(Close, 20)) THEN
AddBuyEntry
ENDIF
- IsPair
Syntax:
IsPair({"EUR/USD" | "USD/CHF" | "USD/JPY" | "GBP/USD" | ...})
Action:
Returns true if the IntelliScript is currently running on the Data Series with the symbol specified in the parameter.
Example:
Global pips
IF IsPair("USD/JPY") THEN
pips = 0.01
ELSE
pips = 0.0001
ENDIF
- IsRealTime
Syntax:
IsRealTime()
Parameters:
None.
Action:
Returns 0 for historical bars. Returns 1 for the last bar, which receives real time data update.
Remarks:
This function is useful when you want to perform different actions in real time execution and historical calculation in the same script.
- IsSellPosition
Syntax:
isSellPosition()
Action:
If the last generated position is a sell entry position, return Boolean expression TRUE. Otherwise, return Boolean expression FALSE.
Example:
IF isSellPosition() AND GetTradePrice(0) - Close > Point(20) THEN
AddSellExit
ENDIF
- LastTradePrice
Syntax:
LastTradePrice
Arguments:
None.
Action:
If there is no open position, returns 0.0.
If it is a buy position, returns the buy price in positive value.
If it is a sell position, returns the sell price in negative value.
Example:
Local float f=LastTradePrice
- LLV
Syntax:
LLV({indicatorExpression}, {integerValueExpression})
Parameter:
indicatorExpression
Required. Float expression.
integerValueExpression
Required. Integer expression.
Action:
Returns the lowest indicatorExpression value for the last n bars.
Example 1:
LLV(High, 10)
/* Returns the lowest high value for the last 10 bars. */
Example 2:
LLV(SMA(Close, 5), 20)
/* Returns the lowest 5-period simple moving average for the last 20 bars. */
- LLVindex
Syntax:
LLVindex({indicatorExpression}, {integerValueExpression})
Parameter:
indicatorExpression
Required. Float expression.
integerValueExpression
Required. Integer expression.
Action:
Returns the position of the bar where the lowest indicatorExpression value for the last n bars occurs.
Example 1:
LLVindex(High, 10)
/* Returns the position of the bar where the lowest high value for the last 10 bars occurs. */
Example 2:
LLVindex(SMA(Close, 5), 20)
/* Returns the position of the bar where the lowest 5-period simple moving average for the last 20 bars occurs. */
- Local
Syntax:
Local {variableName} [= {initialValueExpression}] [, {variableName} [= {initialValueExpression}] ...]
Action:
Declares a local variable in the chart. These variables remain accessible only within the particular script, in contrast with the global variables, which are accessible to other scripts that are attached to the same Data Series. These variables can be assigned an initial value.
Example 1:
Local A = 0, B = -1
A = A + 1
B = 0
- Log
Syntax:
Log({floatExpr})
Parameters:
floatExpr
Required.
Action:
Returns the mathematical log function.
Example:
float a=log(5.8)
- LogData
Syntax:
LogData {"pathString"}
Parameters:
pathString
Required. Path string to indicate the path and name of the log file.
Action:
Writes all the data in the chart to the file specified. The file would be updated when new tick data comes in.
Example:
LogData "C:\log\EURUSD2day.txt"
or
LogData "\log\EURUSD2day.txt"
In the log file, you would see output similar to the following:
"Date","Time","O","H","L","C"
01/18/2005,0940,1.30265,1.303,1.30205,1.3023
01/18/2005,0945,1.3022,1.3025,1.30135,1.30145
01/18/2005,0950,1.30155,1.30195,1.30075,1.30155
01/18/2005,0955,1.3015,1.30185,1.30085,1.30135
01/18/2005,1000,1.3014,1.30175,1.30045,1.30165
...
...
- Loss
Syntax:
Loss(["nameString",] {integerValueExpression})
Parameter:
"nameString"
Optional. This is the contract name for which you wish to return the loss amount.
integerValueExpression
Required. Integer expression.
Action:
Returns the loss for the last n trades. The first parameter "nameString" is the contract name. This parameter can be omitted. The Loss function returns the opposite value of the Profit function. So if the trade generates a profit instead of a loss, when you call the loss function, you will receive a negative value.
Example 1:
Loss("contract1", 0)
/* Returns the loss value for the last occurred trade under contract1. */
Example 2:
Loss(3)
/* Returns the loss value for the third most recent occurred trade. */
- Low
Syntax:
Low[{0 | 1 | 2 | 3 | ...}]
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar counted to the left of the current bar (or the rightmost bar, whose index is 0).
Action:
Returns the Low price of the bar specified by the parameter.
Example:
Low[0] //return the current bar's low price;
Low[6] //return the Low price of the 6th bar to the left of the current bar.
- Max
Syntax:
Max({valueExpression1}, {valueExpression2})
Parameter:
valueExpression1
Float expression 1.
valueExpression2
Float expression 2.
Action:
Returns to the larger one of valueExpression1 and valueExpression2.
Example:
Max(5, 4)
/* This expression returns 5 */
- Min
Syntax:
Min({valueExpression1}, {valueExpression2})
Parameter:
valueExpression1
Float expression 1.
valueExpression2
Float expression 2.
Action:
Returns to the smaller one of valueExpression1 and valueExpression2.
Example:
Min(5, 4)
/* This expression returns 4 */
- Or
Syntax:
{Boolean expression1} OR {Boolean expression2}
Parameter:
Boolean expression1, Boolean expression2
Both required.
valueExpression2
Float expression 2.
Action:
If at least one of the expressions is TRUE, returns TRUE. Otherwise (both expressions are FALSE), returns FALSE.
Example:
2 < 0 OR 15 < 10 //return FALSE
3 > 0 OR 2 < 0 //return TRUE
- Pause
Syntax:
Pause {integerValueExpression}
Parameter:
integerValueExpression
Required. Integer expression that represents the number of milliseconds to pause.
Action:
The IntelliScript stops running for n milliseconds as specified by integerValueExpression.
Example:
/* This example will give me the status whether EMA5 is greater or less than EMA10 status every 5 minutes */
IF EMA[0](Close, 5) > EMA[0](Close, 10) THEN
AlertOnly EMA[0](Close, 5) + " > " + EMA[0](Close, 10)
ELSE
AlertOnly EMA[0](Close, 5) + " <" + EMA[0](Close, 10) ENDIF
Pause 5 * 60 * 1000
- Pivot
Syntax:
Pivot({"Daily" | "Weekly" | "Monthly"}, {"S1" | "S2" | "S3" | "R1" | "R2" | "R3"})
Parameter:
"Daily" | "Weekly" | "Monthly"
Pivot time frame type.
"S1" | "S2" | "S3" | "R1" | "R2" | "R3"
Pivot line's name you wish to return the value.
Action:
Returns the value of the pivot point (support/resistance lines using the Pivot Calculator).
Example:
Pivot("Daily", "S1")
/* Returns the current daily pivot S1 line's value. */
- Playsound
Syntax:
Playsound {"soundFilePathString"} [ , lengthOfSoundFile ] [, timesOfRepeating]
Parameter:
soundFilePathString
Required. String expression for the path of the sound file you wish to play.
lengthOfsoundFile
Optional. Integer expression for the length of time you wish to play the sound file.
timesOfRepeating
Optional. Integer expression for the number of times you wish to play/repeat the sound file.
Action:
Play a sound file. The soundFilePathString needs to be a valid path for the external sound file, e.g., "C:\Mymusic\alertsound.wav".
Example:
/* This example below will play the specified music with length of 6 seconds one time whenever the current price is greater than 109.60. */
IF price > 109.60 THEN
Playsound "sound\alert2.wav", 6, 1
ENDIF
- Point
Syntax:
Point({floatValueExpression})
Parameter:
floatValueExpression
Float expression.
Action:
Evaluates to the appropriate decimal numbers based on the currency. The parameter floatValueExpression can be an integer or a float number.
Example:
Point(4)
/* For EUR/USD this expression returns 0.0004; for EUR/JPY this expression returns 0.04 */
Remark:
Point is similar to pip.
- Price_Close
Syntax:
Price[{0 | 1 | 2 | 3 | ...}]
or
Close[{0 | 1 | 2 | 3 | ...}]
("Price" and "Close" are interchangeable, they are two names for the same function)
Parameter:
{0 | 1 | 2 | 3 | ...}
Required. This is the index of the bar counted to the left from the current bar (the index of the current bar is 0).
Action:
Returns the Close price of the bar specified by the parameter, counted from the right to the left.
Example:
Price[25] //returns the Close price of the 25th bar to the left of the current bar.
- Profit
Syntax:
Profit(["nameString",] {integerValueExpression})
Parameter:
"nameString"
Optional. This is the contract name for which you wish to return the profit amount.
integerValueExpression
Required. Integer expression.
Action:
Returns the profit for the last n trades. The first parameter "nameString" is the contract name. This parameter can be omitted. The Profit function returns the opposite value of the Loss function. So if the trade generates a loss instead of a profit, when you call the profit function, you will receive a negative value.
Example 1:
Profit("contract1", 0)
/* Returns the profit value for the last occurred trade under contract1. */
Example 2:
Profit(3)
/* Returns the profit value for the third most recent occurred trade. */
- Return
Syntax:
Return
Action:
Skip running the rest of the IntelliScript for this current cycle.
Example:
Global Counter = 0
IF isBeginBar() THEN
Counter = 0
ENDIF
IF EMA[0](Close, 10) < ema[0](close, 20) THEN
RETURN
ENDIF
Counter = Counter + 1
- Round
Syntax:
Round({valueExpression}, {0 | 1 | 2 | 3 | ...})
Parameter:
valueExpression
Float expression.
0 | 1 | 2 | 3 | ...
Integer expression.
Action:
Round valueExpression to the nth decimal points.
Example:
Round(0.12345, 4)
/* This expression returns 0.1235 */
- Run
Syntax:
Run {"applicationPathString"}
Argument:
applicationPathString
String expression for the path of the program you wish to run.
Action:
Run an external application. The applicationPathString needs to be a valid path for the external application, e.g., "C:\WINNT\System32\CMD.exe".
Example:
IF RSI[0](Close, 14) > 80 THEN
Run "C:\WINNT\System32\CMD.exe"
ENDIF
- SellStopLoss
Syntax:
SellStopLoss {valueExpression}
Augument:
valueExpression
This is the stop loss amount you set: a float value.
Action:
When you have a sell entry position on the chart, this command will calculate the stop loss. If the stop loss is greater than valueExpression points, the IntelliScript engine will issue the AddSellExit command automatically for you.
Example:
IF CrossDown(EMA(Close,5) , EMA(Close,10)) THEN
AddSellEntry
ENDIF
SellStopLoss Point(30)
- SellTakeProfit
Syntax:
SellTakeProfit {valueExpression}
Argument:
valueExpression
This is the profit amount you set: a float value.
Action:
When you have a sell entry position on the chart, this command will calculate the current profit the position has generated. If the current profit is greater than valueExpression points, the IntelliScript engine will issue the AddSellExit command automatically for you.
Example:
IF CrossDown(EMA(Close,5) , EMA(Close,10)) THEN
AddSellEntry
ENDIF
SellTakeProfit Point(50)
- SellTrailingStop
Syntax:
SellTrailingStop point {valueExpression}
Argument:
valueExpression
This is the stop loss amount you set: can be an integer or a float number. pips
Action:
When you have a sell entry position on the chart, this command will calculate the trailing stop in pips. If the trailing stop is greater than valueExpression pips, the IntelliScript engine will issue the AddBuyExit command automatically for you.
Example:
IF CrossUp(EMA(Close,5) , EMA(Close,10)) THEN
AddSellEntry
ENDIF
SellTrailingStop Point(30)
- SendMail
Syntax:
SendMail {"emailSubjectString"}, {"emailAddressString"}
Arguments:
emailSubjectString
This is the subject of the email, a constant string expression.
EmailBodyString
This is the email body message, a constant string expression.
Action:
Send an email. The emails will be sent to the list of email addresses configured under the IntelliScript Organizer window in the Default Email List section.
Example:
IF RSI[0](Close, 14) > 80 THEN
SendMail "rsi over 80", "Please take action now that RSI is over 80!"
ENDIF
- SetBarColor
Syntax:
SetBarColor {"yellow"|"Green"|"Black"|"purple"|"Blue"|"Red"}
Parameter:
Required. This is the color to be set.
Action:
Set bar color to be a color of choice.
Example:
If isBuyPosition() and close-lastTradePrice() > point(70) Then
setBarColor "yellow"
Endif
- SetBarComment
Syntax:
SetBarComment "messageString"
Arguments:
messageString
Required. A string to be displayed on the status bar.
Action
Create a comment for this current bar. When a bar has had a comment created through IntelliScript, this comment is shown on the status bar, which is located on the top of each chart next to the toolbar, where normally you see the updated time displayed.
Example:
IF (RSI[0](Close, 14) > 80) THEN
SetBarComment "RSI14 Over 80"
ENDIF
- SetPositionControl
Syntax:
SetPositionControl {"false"|"true"}
Parameter:
Required. Required. Default is "true"
Action
By using this command, you can disable forced position control in the script. Now you can have multiple buy actions in a row. See intellichart Instruction Manual. Default position control is true.
What are Position Controls?
By default, you can only have one opened position at a time. For example, if your IntelliScript generates a buy entry position 10 minutes ago, then even if another buy entry position is satisfied now on the chart, you will not see this second buy entry position. At this point, only a sell entry or a buy exit position can be generated. However, keep in mind you can adjust the script and add a special parameter to enable a continuous buy entry position.
Example:
SetPositionControl ("false")
IF CrossDOWN(EMA[0](Close, 5), EMA[0](Close, 10)) THEN
AddSellEntry
ENDIF
IF CrossDOWN(SMA[0](Close, 5), SMA[0](Close, 10)) THEN
AddSellEntry
ENDIF
- SetStatus
Syntax:
SetStatus {"messageString"}
Arguments:
messageString
Required. A string to be displayed in the status box.
Action
Set the status for the Customized Alert. The current status for the Customized Alert is displayed in the "Show Customized Alert Status" window under the "IntelliScript" tab within the charting application.
Example:
IF (RSI[0](Close, 14) > 80) THEN
AlertOnly "RSI14 Over 80"
SetStatus "RSI14 Over 80"
ENDIF
- Share
Syntax:
Share {variableName} [= {initialValueExpression}] [, {variableName} [= {initialValueExpression}] ...]
Action:
Declares a share variable. These variables remain accessible from every single IntelliScript. These variables can be assigned an initial value.
Example 1:
Share gCounter1 = 0, gCounter2 = 0
- STDEV
Syntax:
STDEV({indicatorExpression}, {integerValueExpression})
Parameter:
indicatorExpression
Float expression for which you want to return the standard deviation.
integerValueExpression
Integer expression.
Action:
Returns the standard deviation value for the last n bars for the indicatorExpression specified as the first parameter.
Example:
STDEV(Close, 10)
/ * Returns the standard deviation for the close price for the last 10 bars. */
- String
Syntax:
String {variableName} [= {initialValueExpression}] [, {variableName} [= {initialValueExpression}] ...]
Ation:
Declares a String variable. A String variable has the same scope as a global variable, which remains accessible from every IntelliScript that is attached to the same Data Series. Such variables can be assigned an initial value.
Example:
String sMess
sMess = "Price AT" + Close[0]
IF Close[0] > EMA[0](Close, 4) THEN
AlertOnly sMess
ENDIF
- TimeDiff
Syntax:
TimeDiff(TimePoint1, TimePoint2)
Parameter:
TimePoint1, TimePoint2
Long Value recorded by GetTimePoint function.
Ation:
Returns the difference in minutes of time1 and time2.
Example:
Local t1 = GetTimePoint(0), t2 = GetTimePoint(5)
Local td = TimeDiff(t1, t2) //td is the time difference in minutes of 5 bars interval.
- WHILE_ENDWHILE
Syntax:
WHILE {booleanExpression}
{statement
[statement
...]}
ENDWHILE
Action:
Sets a condition for the repeated execution of a statement block. The statement block is executed repeatedly as long as the specified condition is true (when the booleanExpression following the WHILE keyword returns TRUE).
Example 1:
Local I = 0
WHILE (I <5)
IF (High[I] < close) THEN
AlertOnly "Current Close is higher than High[" + I + "]"
ENDIF
I = I + 1
ENDWHILE
- WriteMessage
Syntax:
WriteMessage {"filenameString"} {"messageString"}
Parameters:
filenameString
Required. This is the file into which you want to write a message.
messageString
Required. This is the actual message you want to write.
Action:
Write a message string at the end of the specified file.
Example:
WriteMessage "C:\log\mylog.txt" "my own message"
The IntelliScript Debug feature is a useful tool to help debug your script. It simulates the process in which the script runs through the historical data and lets you see the steps and expression values when the script runs. Please note that in order to debug your script, the script must be correct in its syntax and successfully attached to a Data Series. Please take a look at Figure 1. Debugger Overview as you read through these instructions.
- To use the Debugger tool:
- To use the Debugger tool, you first select the Data Series to which you have scripts attached. Then in box labelled #1, it will display the list of scripts attached to this Data Series. Please note the debugger will run through all the scripts attached to this Data Series.
- The checkboxes under the "Run to:" section displays the list of breakpoints you can check. If you check the boxes next to "Buy Entry" and "Sell Entry", then the debugger will stop whenever a Buy Entry is generated or a Sell Entry is generated.
- When you click on the "Restart" button, the debugger will start from the beginning of the Data Series. Then you can click on the "GO" button, which will stop at the next breakpoint, which is specified in the "Run to:" section as explained in the previous paragraph. If you click on the "Step" button, the debugger will stop at every bar in the Data Series.
- The box #2 labelled "Expression" displays the expression for your script in which the debugger is currently displaying.
- The box #3 labelled "Log" displays the values for certain lines of your expression that are currently running.
- Next to the box labelled "Watch:", you can enter expressions or variables used in your script. For example, you can enter "EMA(Close, 5)" in the Watch, then box #4 will display EMA(Close, 5)
- Lastly box #5 will display the value for expression EMA(Close, 5) at the particular breakpoint where the debugger is running.
Manually Add Buy/Sell Position
You can add signals to the charts to use as back testing tools. If you are studying a chart and want to see what would have occurred if you placed a buy or a sell trade at certain price you use the "Manually Add Buy/Sell Positions" feature. Once you have added the signals you can utilize the "Customized Alert Performance Summary" or "Customized Alert Performance Detail" to review the potential results of such back tested trades. Here is how to add these signals:
- Scroll in a chart with your mouse.
- Rest your cursor directly on or inside the Bar or Candle and then right click with your mouse on the chart.
- A window will pop up with many choices; highlight and select "IntelliScript".
- Then another pop-up menu will appear, please select "Manually Add Buy/Sell Positions".
- From here, scroll into the new window and select the Buy or Sell of your choosing. Once selected an arrow will appear on the chart to depict the signal selected.
- To check on the performance of these potential trades, right click on the chart, select "IntelliScript" and then from the next pop-up menu, please select "Customized Alert Performance Summary" or "Customized Alert Performance Detail".
Tick Back Testing Lab (TBTL)
Case Study Builder:
- Begin building a Case Study by drafting your syntax in the box labeled "Syntax".
- Once your syntax is drafted, you will need to add this to a data series, by selecting the "Symbol" first and then the "Interval". Next click on the button "Add to Case Study".
- You can add numerous Symbols to the Syntax section, a new tab will appear for each new Symbol and Interval that is selected. If you wish to remove one of these Symbols, click on the tab you wish to remove and select "Delete".
- You can call your previously drafted Customized Alerts, by choosing from the drop down list next to the box labeled "Alert". If you have no saved Customized Alerts, then this field will be blank. The Tick Back Testing Lab does not support Customized Indicators.
- Now, you will go to the section labeled "Options". Here you will choose how many days back you wish to run the Case Study by first filling in the box llabeled "___Days Back" and then choose if you wish to run tick by tick data or by pip change. Note, since this feature allows you to run the Case Study tick by tick, it will take a long time to load the studies results.
- Next select "Run". On the bottom of the window you can check the status bar, which will let you know first now how much of the data has loaded, and then the status of how the calculation is progressing.
- If you wish, you can select "Stop" to terminate the process at any time.
- Once the Case Study has loaded, you can select "P/L" to check the performance.
Save Feature:
A Case Study will include all of the Syntaxes listed on the tabs. To Save the Case Study, at the top of the window, choose, "Case Study" and select "Save", then follow the on-screen prompts.
Open Feature:
To Open previously saved Case Studies, at the top of the window, choose, "Case Study", then select "Open" and follow the on-screen prompts.
Import Feature:
The Import tool allows you to import alert files from your computer's hard drive. Therefore if you have an Alert file (.alt) that you have previously exported to a file on your computer, you can now select Import and browse to the folder where your saved Alert file is that you wish to load.
Notes:
The Historical Tick Data for this feature is available starting from June 2, 2004.
Loading data tick by tick may take from 5-minutes to numerous hours, depending on such elements as how active the cross rate is and how many days back you have selected to load. If you wish to terminate the loading process, you have the option to select "Stop".