Programming Tradestation 2000i (with Easy Language)

Changing close of bar values, to real-time values for trade entries/exits EL question

{*******************************************************************
Description : RSI Oscillator Short Entry
Provided By : Omega Research, Inc. (c) Copyright 1999
********************************************************************}

Inputs: RSILength(10), OverBought(70);

If Currentbar > 1 AND RSI(Close, RSILength) Cross Below OverBought Then
Sell ("RSI") This Bar on Close;

Hi

this is the RSI Oscillator Short Entry signal from TS2000i. Many signals that I've come across in ts2000i use the value of the close of the bar for triggering the signal. I will be trading in real-time - so would want to use real-time signals/value - as they occur, rather than wait until the close of a bar....
So, how do I alter this code, to produce a signal in real-time, as opposed to the close of a bar?

Many thanks

jtrader.
 
Quote:
{************************************************* ******************
Description : RSI Oscillator Short Entry
Provided By : Omega Research, Inc. (c) Copyright 1999
************************************************** ******************}

Inputs: RSILength(10), OverBought(70);

If Currentbar > 1 AND RSI(Close, RSILength) Cross Below OverBought Then
Sell ("RSI") This Bar on Close;

Hi

this is the RSI Oscillator Short Entry signal from TS2000i. Many signals that I've come across in ts2000i use the value of the close of the bar for triggering the signal. I will be trading in real-time - so would want to use real-time signals/value - as they occur, rather than wait until the close of a bar....
So, how do I alter this code, to produce a signal in real-time, as opposed to the close of a bar?

Many thanks

jtrader.

Have found out that the expression "Close" does not mean that a signal will only be generated at the close of a bar on a real-time time interval chart. Instead, the term close means the close of each tick - when applied in real-time. Therefore the signal could be generated at any point within a real-time 5 minute bar for example.

Cheers

jtrader.
 
To the best of my knowledge, signals are only triggered at the close of the bar. If you want to have more frequent signals, you have to use a faster timeframe. The 'update every tick' setting does not affect the generation of signals.
 
To the best of my knowledge, signals are only triggered at the close of the bar. If you want to have more frequent signals, you have to use a faster timeframe. The 'update every tick' setting does not affect the generation of signals.

Hi riddle

when i said that the "Close" refers to the close of each tick - when using a real-time chart - i was going off what the guys at www.tssupport.com told me. Now i am not sure :confused: .

if trading off of 5 minute charts, and your entry citeria was met half way through the bar (2.5 mins) what would be the point of having to wait until the end of the bar before a signal is generated? because by then a large chunk of the trade opportunity may have come and gone. If this is the case - it would be pretty poor.

Cheers

jtrader.
 
Jtrader,
From the easylanguage help file, under 'buy': The earliest order entry that can be generated is for the close of the current bar.

Also, search the email archives for the omega-list (at http://www.purebytes.com/cgi-local/swish/swish-cgi.pl ) You'll find that this is a frequent question.

This, by the way, is not actually a bug. The only way to have consistent signals (whether back-testing or live) is to use bar close. If you had signals triggering in the middle of a bar, they could easily disappear by the time the bar closes, leaving you to wonder why your system had entered a new position for no apparent reason.
 
riddle -
If you had signals triggering in the middle of a bar, they could easily disappear by the time the bar closes, leaving you to wonder why your system had entered a new position for no apparent reason.

Tradestation 2000i help files - When testing a trading strategy on a time-based chart based on historical data, it can signal a flaw in your trading strategy if the strategy repeatedly enters and exits on the same bar. In such a case, we recommend that you re-examine the rules of your strategy and redesign the entry and exit criteria so that the exit criteria of the strategy liquidates your open position only when the market takes a significant turn against you.

Hi riddle

if it is possible to enter and exit a trade on the same bar, then surely this mean that signals can be created by a strategy within a single bar?

Cheers


jtrader.
 
This is the info I received from www.tssupport.com -

******************}Inputs: RSILength(10), OverBought(70);If Currentbar > 1 AND RSI(Close, RSILength) Cross Below OverBought ThenSell ("RSI") This Bar on Close;"

Hi
this is the RSI Oscillator Short Entry signal from TS2000i. Many signals that I've come across in ts2000i use the value of the close of the bar. I will be trading in real-time - so would want to use real-time signals/value - as they occur, rather than wait until the close of a bar....So, how do I alter this code, to sell in real-time, as opposed to the close of a bar?

Many thanks
jtrader.

Robert (Posted: 12.13.04, 20:41)
Hi jtrader,If you trade in realtime, the close means the last tick because every new tick changes the close of the current bar. Please let me know if you have further questions.
Regards,
Robert


jtrader (Posted: 12.14.04, 15:49)
Thanks Robert.So does this mean that this RSI signal will work in real-time (producing a signal exactly when the criteria is met) without being altered, on any time interval of chart that i choose, regardless of whether or not the criteria is met at the beginning, middle or end of a bar?
Many thanks
jtrader.

Posted: 12.14.04, 17:17)
Reply jtrader (12.14.04, 15:49)
Thanks Robert.

So does this mean that this RSI signal will work in real-time (producing a signal exactly when the criteria is met) without being altered, on any time interval of chart that i choose, regardless of whether or not the criteria is met at the beginning, middle or end of a bar?

Many thanks

jtrader.


Exactly, the signal will work in realtime. You should understand that the latest tick is always the close of the current bar i.e. the close changes on every tick.

Is Robert incorrect? :confused:

Cheers
:)
jtrader.
 
Last edited:
Just as an aside.
If you are thinking of automated the order process forget close of bar orders, they are not recognised. Only orders for "Next Bar" can be used. Therefore any strategies that have close orders have to be changed accordingly.
I must say I have found TS support online to be pretty bad when it comes to answering these questions, I begin to wonder about their knowledge of the system they are supposed to support.
 
Tradestation 2000i help files -
Automating Your Strategy on a Real-time/Delayed Basis

{ ** © 1987, 1999 Omega Research, Inc. ** }

When you collect data on a real-time/delayed basis, TradeStation can analyze each new tick of data as it is collected. Instantly, TradeStation will notify you:

·When you need to place a new buy or sell order with your broker

·When market conditions have changed such that an active order is filled and therefore your market position has changed (provided you placed the order with your broker)

·When market conditions have changed such that you should cancel an active order you have with your broker (or an order is canceled by virtue of it not being filled)

Any time during the trading day that market conditions trigger the buy, sell, and/or exit criteria of your trading strategy, TradeStation will post the orders to the Tracking Center and notify you.

To notify you, TradeStation sounds an audible beep (or ..wav file) and displays an Attention dialog box, which contains one of three messages, as described in Understanding Trading Strategy Attention Dialog Boxes.

Also, you can customize how you are notified; for example, you can use a .wav file instead of the default beep, or you can have TradeStation sound the beep and not display the dialog boxes. You can also set up TradeStation to notify you via e-mail or a call to your pager. For more information, see Setting Up Messaging Options.

IMPORTANT Regardless of how you collect data, whether on a real-time/delayed or end-of-day basis, if you want a trading strategy to generate trading orders, you must enable the Generate trading orders for next bar option for each trading strategy. In addition, when you are trading on a real-time/delayed basis, the workspace(s) that contains your chart window(s) and trading strategy(ies) must be open.



{ ** © 1987, 1999 Omega Research, Inc. ** }
 
Last edited:
Tradestation 2000i help files -

Calculating Orders on a Real-Time/Delayed Basis

{ ** © 1987, 1999 Omega Research, Inc. ** }

When you are working with time-based bars based on real-time/delayed data, TradeStation receives price data tick-by-tick (transaction by transaction) and builds time-based bars from that tick-by-tick data. As each transaction is received, TradeStation calculates whether or not the entry or exit criteria of an applied trading strategy are triggered by that transaction. If a transaction is received that matches the entry criteria of the strategy, TradeStation issues the entry signal at the exact moment the transaction is received. If a transaction is received that matches the exit criteria of the strategy, TradeStation issues the exit signal at the exact moment that transaction is received.
Therefore, it is possible to both enter and exit the market on the same bar. TradeStation handles both signals in the order in which the transactions are received on a real-time/ delayed basis.
If the exit signal of a trading strategy is triggered first in a bar in which both the entry and exit criteria of a strategy are met, TradeStation handles the exit criteria in the following ways:

·If you do not have an open position and a transaction triggers the exit criteria of your strategy first and then a later transaction triggers the entry criteria, TradeStation ignores the exit criteria (because at the time there is no open position to exit) but issues the entry signal to open a position.

·If you do have an open position and on the same time-based bar a transaction triggers the exit criteria of your strategy and then a transaction triggers the entry criteria of your strategy, TradeStation shows the open position as having been liquidated due to the exit criteria, then would show a new open position based on the entry signal.

As you can see, when you apply a trading strategy to a time-based chart based on real-time delayed data, TradeStation can calculate the entry and exit criteria of your trading strategy with great precision and enter and exit the market based on exactly what is happening in the market when one or more of the criteria of your strategy are met.

{ ** © 1987, 1999 Omega Research, Inc. ** }
 
Hi

all this seems to bring me back to my original enquiry -

Quote:
{************************************************* ******************
Description : RSI Oscillator Short Entry
Provided By : Omega Research, Inc. (c) Copyright 1999
************************************************** ******************}

Inputs: RSILength(10), OverBought(70);

If Currentbar > 1 AND RSI(Close, RSILength) Cross Below OverBought Then
Sell ("RSI") This Bar on Close;

Hi

this is the RSI Oscillator Short Entry signal from TS2000i. Many signals that I've come across in ts2000i use the value of the close of the bar for triggering the signal. I will be trading in real-time - so would want to use real-time signals/value - as they occur, rather than wait until the close of a bar....
So, how do I alter this code, to produce a signal in real-time, as opposed to the close of a bar?

Many thanks

jtrader.

Or is Robert from www.tssupport.com right when he says that "Close" is the right word to use, and that "Close" refers to the close of each tick - when applied to a real-time chart?

Many thanks :)

jtrader.

******************}Inputs: RSILength(10), OverBought(70);If Currentbar > 1 AND RSI(Close, RSILength) Cross Below OverBought ThenSell ("RSI") This Bar on Close;"

Hi
this is the RSI Oscillator Short Entry signal from TS2000i. Many signals that I've come across in ts2000i use the value of the close of the bar. I will be trading in real-time - so would want to use real-time signals/value - as they occur, rather than wait until the close of a bar....So, how do I alter this code, to sell in real-time, as opposed to the close of a bar?

Many thanks
jtrader.

Robert (Posted: 12.13.04, 20:41)
Hi jtrader,If you trade in realtime, the close means the last tick because every new tick changes the close of the current bar. Please let me know if you have further questions.
Regards,
Robert

jtrader (Posted: 12.14.04, 15:49)
Thanks Robert.So does this mean that this RSI signal will work in real-time (producing a signal exactly when the criteria is met) without being altered, on any time interval of chart that i choose, regardless of whether or not the criteria is met at the beginning, middle or end of a bar?
Many thanks
jtrader.

Posted: 12.14.04, 17:17)
Reply jtrader (12.14.04, 15:49)
Thanks Robert.

So does this mean that this RSI signal will work in real-time (producing a signal exactly when the criteria is met) without being altered, on any time interval of chart that i choose, regardless of whether or not the criteria is met at the beginning, middle or end of a bar?

Many thanks

jtrader.


Exactly, the signal will work in realtime. You should understand that the latest tick is always the close of the current bar i.e. the close changes on every tick.
 
Currently the only way to automate a trade is for the next bar. If the value is known in advance then this is fine because the order will be held as a stop order at a price and sent to market once triggered no matter where in the next bar(which is the current bar by the time it trades) it is and so appears as an intra bar trade. If it is a limit order it will be placed in the market as soon as the level is calculated. If you wish to work more accurately then you need to reduce the interval of the chart you use to send the signals and take an indicator which calculates from a longer term chart. If you wish to automate you have to forget using bar on close orders.

http://www.tradestationworld.com/discussions/Topic.aspx?Topic_ID=20406&SearchTerm=bad tick

You may find this thread useful for solving some issues.
 
It mayu stand to reason that the RSI value can only be calculated on close so if it crosses on bar X due to calculations done from bar X-1 then presume the system will place a limit order to sell at the close of the previous bar.
 
jtrader, found this in the help file.

Tick-based Bar Charts

A tick-based bar chart is different from a time-based bar chart in that rather than plotting prices during a particular time period, a tick chart plots the price of each transaction, regardless of what time it is. Tick-based charts do show the time the transaction occurred; however, the time frame is not relevant. You can create a chart that shows each tick, or you can create a chart that shows multiple ticks per bar.

In a 1-tick chart, there is no reason to report the open, high, low, and closing prices because the exact trade price is plotted. In a 1-tick bar chart, the open, high, low, and closing price would all be the same. Therefore, the price data is not really displayed as a bar; it is displayed as a series of connected ticks (it actually uses the Line on Close style; however it is discussed as a bar chart because the caption will read 1 Tick Bars).

When you create a tick-based chart where each bar contains a certain number of ticks, each bar contains the range of open, high, low, and closing prices for a specified number of ticks; for example, 10 ticks, 100 ticks, or 1000 ticks. When you change the data compression to build bars based on multiple ticks per bar, the bars look exactly like time-based bars; that is, they plot the open, high, low, and closing prices for the specified number of transactions. The title bar displays the number of ticks used to build each bar. For example, when you use 5-ticks per bar, the title bar reads, “5-Tick Bars.”

{** © 1987-1999 Omega Research, Inc. **}
 
twalker -
It mayu stand to reason that the RSI value can only be calculated on close so if it crosses on bar X due to calculations done from bar X-1 then presume the system will place a limit order to sell at the close of the previous bar.

Hi twalker

by close of a bar, do you mean a full and completed time interval bar (say 5 minute for example)? or do you mean the close of a completed tick?

I am saying (having read the extracts from the ts2000i help files that i have quoted) that "Close" seems to mean - "on a tick-by tick basis" - the close of each individual tick/trade being plotted on a real-time chart, and not the Close of the full bar on a real-time chart (say a 5-minute bar for example) as a whole.

On a real-time time interval chart the RSI should adjust on a real-time basis, and not just when one bar has closed and the next one opens. This is how esignal and other real-time packages that i have used work. Is TS2000i different?

ps. I (think I) read in another post that you are now using TS8. How are you getting along with TS8?

Many thanks

jtrader.
 
Last edited:
I had a think aboout this last night. I believe that when calculating an indicator value that value can update on every tick but when initiating an order that can only be based on the Open/High/Low or Close of some full bar in the past. If you pull up the same RSI entry strategy in TS8 the order is for "Next Bar at Market".

jt - TS8 seems to be doing its job. I got it to start automating FX strategies that I was having trouble covering manually due to STIR trading. I have been running it for 2 full days 24hrs and so far it has obeyed the rules.
 
twalker -
I had a think aboout this last night. I believe that when calculating an indicator value that value can update on every tick but when initiating an order that can only be based on the Open/High/Low or Close of some full bar in the past.

Thanks twalker.
By this, do you mean that an entry or exit signal may be given at any point within a time interval bar, but if you are fully automating a strategy with your broker, tradestation will only initiate the order with the broker at the end of the bar, or the start of the next bar?

Are you fully automating TS8 with your forex broker? if so, is this Globex futures, or retail spot forex? if so - which broker allows you to do this?

Many thanks

jtrader.
 
I am fully automating with TS8 via the TS brokerage. Just experimenting right now with small size until i am confident of the reliabllity of the system.

By this, do you mean that an entry or exit signal may be given at any point within a time interval bar, but if you are fully automating a strategy with your broker, tradestation will only initiate the order with the broker at the end of the bar, or the start of the next bar?

This is mostly correct although withy automation it can only be the next bar, not the end of the current bar.
 
Hi twalker

sorry, is this the TS Globex futures brokerage service, or, the TS RJOFX spot forex broker service.................I wasn't aware that RJOFX offered full automation yet. If RJOFX do offer full automation, what are the additional charges (if any) for full automation?

Thanks again

jtrader.
 
Top