MultiCharts lag time? - MultiCharts | futures io social day trading

MultiCharts lag time?
 Updated: April 4th, 2012 (10:31 AM) Views / Replies: 33,297 / 171 Created: May 29th, 2011 (11:55 AM) by bobbakerr Attachments: 2

 Welcome to futures io.

2

# MultiCharts lag time?

Elite Member
Austin, TX

Posts: 16 since Sep 2010

Order Generation

A problem arises when you start using "next bar ..." and tick data. If Intrabar order generation is enabled, then the order for "next bar ..." may only be valid for the next tick, so you have to keep issuing the order.

Quoting
 >>Is there a way to ensure that the stop or limit order is held for longer than 1 tick? If you want to keep the order active for a specified amount of time or bars, you can use intrabar persist variables to keep track of the elapsed time, number of ticks, or number of bars.

Example code:

Quoting
 variables: IntraBarPersist Count( 0 ) ; if BarStatus( 1 ) = 2 then Count = 0 ; if Close < Lowest( Low, 10 )[1] then Count = Count + 1 ; if Count <> 0 then print( ELDateToString(Date)," ",Time:4:0," ", Count, " ", Close ) ; if MarketPosition <> 1 and Count > 5 then begin buy next bar at Lowest( Low, 10 )[1] + MinMove / PriceScale stop ; print("Issuing buy stop order at ", Lowest( Low, 10 )[1] + MinMove / PriceScale ) ; end ; if BarsSinceEntry = 5 then sell next bar at market ; The code uses an IntrabarPersist variable as a counter to count the number of intrabar ticks that occur below a new 10 bar lowest low. If more than 5 ticks occur below the lowest low during a bar, then a buy stop order is issued at a price increment ( a minmove ) above the lowest low. The idea is to go long if price makes a new 10 bar low, holds the low for at least N number of ticks during the bar and then reverses and rallies back above the low. If the end of the bar is reached, the stop order is no longer issued. To test the code in history, enable intrabar execution and use look-inside-bar-backtesting. I tested this on @ES.D, 10 minute bars, with intrabar enabled, and look-inside-bar backtesting set to 1 minute resolution.

More detail on IOG:

Quoting
 If checked, orders can be generated as frequently as every tick during a bar. If unchecked, orders can be generated only on bar close (or at bar open for ‘open next bar’ strategies). The setting is disabled by default. The value of the setting is associated with each individual strategy that is applied to a chart. Different strategies in the same strategy group may have different settings. When ‘Enable intrabar order generation and calculation’ is checked a choice is provide to determine whether fills should occur more than once per bar. • If ‘Limit entries from same signal in this strategy and exits from same signal in this strategy to once per bar’ is selected, each entry and exit order from the same signal can be filled only one time per bar (even if Position Limits settings have pyramiding enabled). This option is selected by default. • If ‘Limit entries from all signals in this strategy and exits from all signals in this strategy to once per bar’ is selected, the strategy will enter and exit only once per bar. • If ‘Allow any entry from this strategy and any exit from this strategy to occur multiple times per bar’ is selected, the strategy may enter and exit from the same or from different signals as many times per bar as conditions dictate. What does [0] now mean? When “Enable intrabar order generation” is enabled then [0] refers to the in-progress bar. How will historical calculations work? When “Enable intra-bar order generation” is disabled historical calculations will behave as they did in prior TradeStation versions. When the intrabar calculation setting is enabled, historical calculations will vary based on the ‘Look-Inside-Bar’ back-testing settings: - Historical calculations with Look-Inside-Bar Back-testing disabled: When Look-Inside-Bar Back-testing disabled, historical strategy calculations will occur 4 times per bar on the Open, High, Low, and Close of the historical bar. The actual calculation order will depend on the proximity of the high and low to the open. If the open is closer to the high then calculations will proceed in the following order: Open, High, Low, and then Close. If the open is closer to the low then calculations will proceed in the following order: Open, Low, High, and Close. Volume is split between the 4 points (Volume / 4). Open interest will not be divided by 4 - Historical calculations with “Look-Inside-Bar Back-testing” enabled: When Look-Inside-Bar Back-testing” is enabled, historical strategy calculations will occur on the Open, High, Low, and Close of each interim ‘Look-Inside’ bar. If using tick resolution, a calculation will occur on the tick only. The high and low will update on each interim Look-Inside bar to simulate the creation of a bar in progress. After the last Look-Inside bar is processed a calculation will occur one more time on the actual close of the bar. Intrabar on Multiple Datastream Charts Intrabar order generation is not allowed on multiple datastream charts. Open next bar systems Enable Intra-bar order generation is not allowed for open next bar systems. However, since calculations can occur on each tick during the bar, EasyLanguage code can detect the open of the bar and execute specific code at the open. This enables ‘open next bar’ type strategies to be rewritten as intrabar strategies, if desired. How to write code that evaluates intrabar, and places orders intrabar? Enable intra-bar order generation and calculation for the strategy on the Format Strategy Dialog – Calculation Tab. Write the EasyLanguage code to place the order as a ‘next bar’ order; it will be active for the next tick for the in-progress bar. For example: if MarketPosition <> 1 and close > close[1] then buy next bar at market ; This will place a market order for the next tick of the in-progress bar, if the close of the current in-progress bar is greater than the close of the prior bar. How to write code that evaluates intrabar, but places orders only on the bar close? Use the BarStatus reserved word. For example: If BarStatus(1) = 2 then { place orders for next bar } buy next bar at market ; IntrabarOrderGeneration EasyLanguage Attribute An attribute has been added to EasyLanguage [IntrabarOrderGeneration=True/False] that allows the intrabar order generation capability to be turned on or off from within EasyLanguage. This attribute value will override the user interface setting in the Format Strategy dialog. If the attribute is not present in the strategy code, the intrabar order generation and calculations setting will be controlled through the Calculations tab of the format Strategy window. If the attribute is present and set to TRUE, the ‘Enable intrabar order generation and calculation’ flag will be checked, the checkbox will be disabled, and the radio buttons will be available. If the attribute is present and set to FALSE, the ‘Enable intrabar order generation and calculation’ flag will unchecked and the checkbox and radio buttons will be disabled. The syntax for the attribute is as follows: [IntrabarOrderGeneration = Value] where Value can be TRUE or FALSE The attribute may only be used in a strategy. Attributes are evaluated at compile time only, so their values cannot be changed at run-time. Usage Example: [IntrabarOrderGeneration = FALSE] // Strategy will only generate orders at close of bar

I hope this helps!
Brett

 The following 5 users say Thank You to bretter for this post:

 June 18th, 2011, 12:27 PM #52 (permalink) Elite Member Riverdale, Idaho, USA   Trading Experience: Intermediate Platform: Optimus Futures + MultiCharts + TradeStation Broker/Data: Optimus Futures, Rithmic Data, TradeStation Favorite Futures: CL, ES     Posts: 110 since Aug 2010 Thanks: 224 given, 43 received Brett, what a GREAT series of posts. Very informative and helpful. Thank you for all that time and effort. I do have 'Intra-bar Order Generation' turned on for the code and I also have 'Use Bar Magnifier' checked with 1 Tick as the defining interval. I think Bar Magnifier in MultiCharts is equivalent to 'Intra-bar Order Persist' in TradeStation, but I'm not sure. I need to re-read and re-read all that you've posted here so that I can completely understand all you've written. Thanks again.

Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500

Posts: 46,925 since Jun 2009

bobbakerr
 Brett, what a GREAT series of posts. Very informative and helpful. Thank you for all that time and effort. I do have 'Intra-bar Order Generation' turned on for the code and I also have 'Use Bar Magnifier' checked with 1 Tick as the defining interval. I think Bar Magnifier in MultiCharts is equivalent to 'Intra-bar Order Persist' in TradeStation, but I'm not sure. I need to re-read and re-read all that you've posted here so that I can completely understand all you've written. Thanks again.

Intrabar Order Generation means orders can be submitted intrabar instead of at close of bar. It is off by default, you have to explicitly enable it.

Intrabar Persist means a var: can be updated intrabar instead of only at the close of a bar. It is off by default.

Bar Magnifier takes non-tick data and fills in the missing ticks to give you more accurate results. For example if you submit orders on a 5 minute chart, and you have a 5 minute bar that is real big - wick/tail - and both the tail and wick include both your stop and target. Bar Magnifier allows MC to know the true order of the OHLC so it can determine if your stop or target was hit first, otherwise it does not know the order. By default MC assumes the worst when filling these orders without bar magnifier, unlike NT which assumes the best.

Mike

 The following 2 users say Thank You to Big Mike for this post:

Australia

Platform: Multicharts
Favorite Futures: forex

Posts: 32 since Dec 2010

Big Mike
 Bar Magnifier takes non-tick data and fills in the missing ticks to give you more accurate results. For example if you submit orders on a 5 minute chart, and you have a 5 minute bar that is real big - wick/tail - and both the tail and wick include both your stop and target. Bar Magnifier allows MC to know the true order of the OHLC so it can determine if your stop or target was hit first, otherwise it does not know the order. By default MC assumes the worst when filling these orders without bar magnifier, unlike NT which assumes the best. Mike

Hi Mike, I was under the impression that bar magnifier still requires the data of what ever you set it to. Ie if you have a 5min strategy and enable bar magnifier to '1 tick' then you require tick data and this just enables the use of the tick data while back testing. If you don't have the tick data then that is when MC does its assumptions for order filling and which happened first in the bar.

This is the way I understand it to work but please correct me if I'm wrong. How else would MC know what happened intrabar without tick data?

The Netherlands

Favorite Futures: ...

Posts: 774 since Apr 2010

nismo
 Hi Mike, I was under the impression that bar magnifier still requires the data of what ever you set it to. Ie if you have a 5min strategy and enable bar magnifier to '1 tick' then you require tick data and this just enables the use of the tick data while back testing. If you don't have the tick data then that is when MC does its assumptions for order filling and which happened first in the bar. This is the way I understand it to work but please correct me if I'm wrong. How else would MC know what happened intrabar without tick data?

As far as I know, you're both right: the Bar Magnifier can use both ticks as well as minutes (see picture).

So, for example, if you backtest a strategy on a 10 minute time frame, but don't have tick data, you can use the Bar Magnifier with a one minute setting (since that's available, even though there is no tick data). And when backtesting on a 100 tick chart, the Bar Magnifier can be set to 1 tick or use the minutes. (Though I doubt this will give more accurate results when the Bar Magnifier is set to minutes while backtesting on ticks).

According to the MultiCharts manual (p. 204)

Quoting
 The Bar Magnifier backtest feature is important for precise backtesting. Bar magnifier can be considered as a replay of the way a bar was formed. The user can choose a replay frequency that is based on number of ticks or number of minutes. There is a tradeoff between the level of precision in a replay and memory requirements. Tick-by-tick replay is the most precise, but it also requires the most memory. If the strategy does not require high precision, then replays based on n-ticks or n-minutes may be sufficient. For example, Bar Magnifier is helpful when both the profit target and stop loss occurred on the same bar. In this situation, it is unclear whether the profit target or the stop loss occurred first. With Bar Magnifier, MultiCharts is able to see how the bar was formed to determine whether the profit target or the stop loss occurred first. We suggest to use tick because most precise.

Regards,

Attached Thumbnails

 The following user says Thank You to Jura for this post:

Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500

Posts: 46,925 since Jun 2009

nismo
 Hi Mike, I was under the impression that bar magnifier still requires the data of what ever you set it to. Ie if you have a 5min strategy and enable bar magnifier to '1 tick' then you require tick data and this just enables the use of the tick data while back testing. If you don't have the tick data then that is when MC does its assumptions for order filling and which happened first in the bar. This is the way I understand it to work but please correct me if I'm wrong. How else would MC know what happened intrabar without tick data?

Yes for sure, it requires tick data if you tell it to use tick data resolution. Sorry if I suggested otherwise, it was not my intention. I'm pretty sure it will just throw an error message if you try to use it without tick data.

Mike

Australia

Platform: Multicharts
Favorite Futures: forex

Posts: 32 since Dec 2010

Big Mike
 Yes for sure, it requires tick data if you tell it to use tick data resolution. Sorry if I suggested otherwise, it was not my intention. I'm pretty sure it will just throw an error message if you try to use it without tick data. Mike

No worries Mike, I"m just making sure I'm understanding MC correctly thats all.

 The following user says Thank You to Khalaad for this post:

 June 25th, 2011, 10:50 AM #59 (permalink) Elite Member Riverdale, Idaho, USA   Trading Experience: Intermediate Platform: Optimus Futures + MultiCharts + TradeStation Broker/Data: Optimus Futures, Rithmic Data, TradeStation Favorite Futures: CL, ES     Posts: 110 since Aug 2010 Thanks: 224 given, 43 received You have adapted well, Khalaad. That's what I'm trying to do now.

 June 25th, 2011, 12:08 PM #60 (permalink) Trading Apprentice Lahore, Pakistan   Trading Experience: Advanced Platform: MultiCharts Favorite Futures: EUR/USD   Posts: 3 since Jun 2011 Thanks: 0 given, 2 received bobbakerr, You are doing lots of things right; systematic trading is one of them. And although no one should tell you what style to trade, I think you particularly need to think through how frequently you trade. I am new to systematic trading, but I did spend many, many hours doing my homework; lots of things I tried suggest to me when you test you test codes, not methods. The line between the two is ultra-fine, but results wise the differences are huge.
 The following user says Thank You to Khalaad for this post:

 futures io > MultiCharts lag time?

Upcoming Webinars and Events (4:30PM ET unless noted)

February

Feb 19

Feb 21

Mar 5

Mar 12

Mar 19

## Day Trading Oil Futures: Reducing Risk & Increasing Profits w/DTN IQFeed

Mar 26

 Similar Threads Thread Thread Starter Forum Replies Last Post ebtrader ThinkOrSwim Programming 18 February 12th, 2019 03:56 AM DarrenH NinjaTrader 6 September 13th, 2013 04:31 PM crbucks MultiCharts 4 June 23rd, 2011 11:33 AM Sad Planet Reviews of Brokers and Data Feeds 3 May 5th, 2011 06:05 AM GilR NinjaTrader 4 February 25th, 2011 07:36 AM

 Tags 2 data, algos, automated trading, autotrade, average, back testing, backtest, backtesting, bid and ask, broker, brokers, buy, chat, cl, code, coding, commission, conditional, crude, crude oil, data, data feed, datafeed, discretionary trading, drawdown, easylanguage, el, elite, email, es, feedback, forward testing, futures, indicator, information, institutional, intrabar, intrabarordergeneration, latency, limit order, limit orders, live trading, margin, market data, market order, marketposition, multicharts, ohlc, optimus futures, order book, order management, order price, orders, patterns, precision, profit target, profitable, programming, pyramiding, quantify, range bars, range charts, real time, rithmic, scan, short, signal, signals, simulator, slippage, sp, split, spread, statistics, stop limit, stop limit order, strategies, strategy, strength, support, switch, systems, tick, time intervals, trading, trading strategy, volume, vps