Hi
Testing a Daily start that buys on the open and exits on the close of the same bar.
I understand that with the bar magnifier the results become more precise, but what about the intrabarordergeneration. With it my 5% stop just wrecks the strategy. Does it mean my stop would not be executed?
Confused?
Question on Intrabar & bar magnifier
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Question on Intrabar & bar magnifier
Here is how the scripts are calculated in MultiCharts 8.0:
Realtime normal mode. The script is calculated on the bar close. Order is placed on this bar close/ next bar open. Order is filled on any tick price within the next bar.
In realtime with IOG enabled the script is calculated tick by tick. Order is placed on the next tick. Order is filled on any tick price within the bar.
Calculation on historical data. Regular mode. No IOG. No Bar Magnifier. The script is calculated on the bar close. It is considered that all prices were within the bar (Price movement assumption is used). Order filled on any price within the bar.
Calculation on historical data. IOG enabled. No Bar Magnifier. The script is calculated four times on OHLC. It is considered that all prices were within the bar (Price movement assumption is used). Order filled on any price within the bar with the step (minmove/pricescale).
Calculation on historical data. No IOG. With Bar Magnifier enabled. The script is calculated 1 time on main data series close. MultiCharts considers that there were only OHLC values of the detailed data series->order is filled only on OHLC prices.
Calculation on historical data. IOG and Bar Magnifier enabled. The script is calculated on the Open value of the main data series, then OHLC of each bar of the detailed data series selected in bar magnifier, then on the Close of the main data series. Order is filled only on these O-OHLC-C values.
Realtime normal mode. The script is calculated on the bar close. Order is placed on this bar close/ next bar open. Order is filled on any tick price within the next bar.
In realtime with IOG enabled the script is calculated tick by tick. Order is placed on the next tick. Order is filled on any tick price within the bar.
Calculation on historical data. Regular mode. No IOG. No Bar Magnifier. The script is calculated on the bar close. It is considered that all prices were within the bar (Price movement assumption is used). Order filled on any price within the bar.
Calculation on historical data. IOG enabled. No Bar Magnifier. The script is calculated four times on OHLC. It is considered that all prices were within the bar (Price movement assumption is used). Order filled on any price within the bar with the step (minmove/pricescale).
Calculation on historical data. No IOG. With Bar Magnifier enabled. The script is calculated 1 time on main data series close. MultiCharts considers that there were only OHLC values of the detailed data series->order is filled only on OHLC prices.
Calculation on historical data. IOG and Bar Magnifier enabled. The script is calculated on the Open value of the main data series, then OHLC of each bar of the detailed data series selected in bar magnifier, then on the Close of the main data series. Order is filled only on these O-OHLC-C values.
Re: Question on Intrabar & bar magnifier
so let me see if I understand this correctly in terms of the stops on the daily chart/strategy (after entering at the open on a market order)!?
It is a simple stop:
So in realtime without IOG it should be able to execute on the same day once the stop level is breached!???
In historical testing it would be best to choose ... No IOG. With Bar Magnifier enabled. ?????
Thanks for any further help on this.
It is a simple stop:
Code: Select all
if MarketPosition = 1 then SetStopLoss( EntryPrice * StopLossPct ) ;
In historical testing it would be best to choose ... No IOG. With Bar Magnifier enabled. ?????
Thanks for any further help on this.
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Question on Intrabar & bar magnifier
The code you have provided will not work this way. SetStopLoss should not be under a condition in order to be evaluated intrabar when IOG is disabled. Remove the condition and use it separately.So in realtime without IOG it should be able to execute on the same day once the stop level is breached!?
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Question on Intrabar & bar magnifier
In realtime with IOG disabled SetStopLoss will not be placed on the same bar if it is under condition.
If the trade is opened and closed with same price then most probaby the order parameters are incorrect. Please refer to the wiki article for more details on using SetStopLoss
If the trade is opened and closed with same price then most probaby the order parameters are incorrect. Please refer to the wiki article for more details on using SetStopLoss
Re: Question on Intrabar & bar magnifier
Thnaks so far.
Another question. Trading 15 min bars, my market closes at 1710 and I want to submit a market order at 1709 to close my open long position.
[/code]
The above does not seem to work in backtesting with or without intrabarordergeneration and/or bar magnifier??? Is it possible to do a time exit like this within a bigger timeframe bar??
Any help appreciated. thx!
Another question. Trading 15 min bars, my market closes at 1710 and I want to submit a market order at 1709 to close my open long position.
Code: Select all
if time > 1709 and marketposition = 1 then sell this bar at close;
[code]
The above does not seem to work in backtesting with or without intrabarordergeneration and/or bar magnifier??? Is it possible to do a time exit like this within a bigger timeframe bar??
Any help appreciated. thx!
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: Question on Intrabar & bar magnifier
Hello aczk,
This Bar on Close order is generated on the last tick of the bar. The order is sent on the open of the next bar. The code you have provided will not close the position before the session end in realtime calcualtion.
In realtime calcualtion you can use IntrabarOrderGeneration, "next bar" order command and reference computer time. For example:
The code you have provided works ok in backtesting with IOG & Bar magnifier set to Off:
In order to get precise results in backtesting you can use IOG, Bar magnifier, "next bar" order command, reference bar closing time and enable the option "Enable access to intra-bar time for calcualtion in Intra-bar order generation mode" (Format->Strategy properties->Backtesting tab, nas been added in MC 8.5 beta 2 ). For example:
This Bar on Close order is generated on the last tick of the bar. The order is sent on the open of the next bar. The code you have provided will not close the position before the session end in realtime calcualtion.
In realtime calcualtion you can use IntrabarOrderGeneration, "next bar" order command and reference computer time. For example:
Code: Select all
if datetime2eltime(computerdatetime)>= 1709 and marketposition = 1 then sell next bar at market;
Code: Select all
if time > 1709 and marketposition = 1 then sell this bar at close;
Code: Select all
if time >= 1709 and marketposition = 1 then sell next bar at market;
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2223 times
Re: Question on Intrabar & bar magnifier
re: This Bar on CloseThnaks so far.
Another question. Trading 15 min bars, my market closes at 1710 and I want to submit a market order at 1709 to close my open long position.
[/code]Code: Select all
if time > 1709 and marketposition = 1 then sell this bar at close;
[code]
The above does not seem to work in backtesting with or without intrabarordergeneration and/or bar magnifier??? Is it possible to do a time exit like this within a bigger timeframe bar??
Any help appreciated. thx!
see post #7
viewtopic.php?f=16&t=10811