NexusFi: Find Your Edge


Home Menu

 





MultiCharts lag time?


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one bobbakerr with 63 posts (24 thanks)
    2. looks_two Big Mike with 19 posts (19 thanks)
    3. looks_3 Jura with 11 posts (8 thanks)
    4. looks_4 Bimi with 10 posts (7 thanks)
      Best Posters
    1. looks_one bretter with 4 thanks per post
    2. looks_two RM99 with 2.3 thanks per post
    3. looks_3 Big Mike with 1 thanks per post
    4. looks_4 bobbakerr with 0.4 thanks per post
    1. trending_up 56,350 views
    2. thumb_up 144 thanks given
    3. group 23 followers
    1. forum 171 posts
    2. attach_file 2 attachments




 
Search this Thread

MultiCharts lag time?

  #51 (permalink)
 bretter 
Austin, TX
 
Experience: Advanced
Platform: Tradestation
Posts: 16 since Sep 2010
Thanks Given: 5
Thanks Received: 12

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:
https://www.tradestation.com:443/Discussions/Topic.aspx?Topic_ID=36421


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

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Exit Strategy
NinjaTrader
Deepmoney LLM
Elite Quantitative GenAI/LLM
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
Battlestations: Show us your trading desks!
18 thanks
  #52 (permalink)
 
bobbakerr's Avatar
 bobbakerr 
Riverdale, Idaho, USA
 
Experience: Intermediate
Platform: Optimus Futures + MultiCharts + TradeStation
Broker: Optimus Futures, Rithmic Data, TradeStation
Trading: CL, ES
Posts: 115 since Aug 2010
Thanks Given: 241
Thanks Received: 51

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.

Started this thread Reply With Quote
  #53 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,396 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,537



bobbakerr View Post
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

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #54 (permalink)
nismo
Australia
 
Posts: 32 since Dec 2010
Thanks Given: 7
Thanks Received: 3


Big Mike View Post

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?

Reply With Quote
  #55 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


nismo View Post
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
Click image for larger version

Name:	barMagnifier.PNG
Views:	263
Size:	49.0 KB
ID:	41443  
Reply With Quote
Thanked by:
  #56 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,396 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,537


nismo View Post
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

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #57 (permalink)
nismo
Australia
 
Posts: 32 since Dec 2010
Thanks Given: 7
Thanks Received: 3


Big Mike View Post
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.

Reply With Quote
  #58 (permalink)
Khalaad
Lahore, Pakistan
 
Posts: 3 since Jun 2011
Thanks Given: 0
Thanks Received: 2

When I was a beginner traders I read a story about a trader in a bygone age who lived far away from the big city, and sent written orders to his brokers via postal mail. He made a lot of money.

Because he knew his limitations and traded within them.

I trade FX. PFGBest is my broker, and I use no-backfill PFGBest data fed into my MultiCharts. My latency is 300ms on average. Yet my fills are EXCELLENT.

Because I know my limitations and have learned to trade within them.

This is the ONLY MAGIC I KNOW.

Reply With Quote
Thanked by:
  #59 (permalink)
 
bobbakerr's Avatar
 bobbakerr 
Riverdale, Idaho, USA
 
Experience: Intermediate
Platform: Optimus Futures + MultiCharts + TradeStation
Broker: Optimus Futures, Rithmic Data, TradeStation
Trading: CL, ES
Posts: 115 since Aug 2010
Thanks Given: 241
Thanks Received: 51

You have adapted well, Khalaad. That's what I'm trying to do now.

Started this thread Reply With Quote
  #60 (permalink)
Khalaad
Lahore, Pakistan
 
Posts: 3 since Jun 2011
Thanks Given: 0
Thanks Received: 2


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.

Reply With Quote
Thanked by:




Last Updated on April 4, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts