tick by tick backtesting/ look inside the bar /bar magnifier feature in amibroker

#1
can any1 help me in implementing "look inside the bar" feature in backtesting.

suppose my system buy when prices cross above ema 14 with stop loss at ema 22 in daily timeframe. in real time i want to execute the order as soon as i get the signal .
but backtesting does not consider intrabar movement.it only consider if closing price of day satisfies my condition. so my idea is to develop an afl to backtest the above system which can consider finer resolution data(suppose 1 min) to look what was happening inside bar. so we can get realistic picture of system performance.
above feature is called by different name in different software-
for ex multichart call it bar magnifier, tradestation call it "look inside the bar" ..or tick by tick backtesting.

pls some1 help me to implement this backtesting feature in amibroker.
thnx
 
#2
to be more precise this is what i want to implement in amibroker-
multichart bar magnifier feature-
ar Magnifier

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.
https://www.multicharts.com/trading-software/index.php/Bar_Magnifier
or
tradestation look inside bar feature-
Back-Testing Resolution

Place a check mark next to Look-Inside-Bar Back-testing to enable the use of a sub-interval to identify price action occurring within each charted strategy bar.

_note_icon.gif Look-Inside-Bar-Backtesting has no effect on real-time data or strategy automation; it is a feature of TradeStation’s strategy backtesting only. It is designed to report more accurate backtesting results; it allows a strategy to examine a finer data interval than appears in your chart so as to more carefully reconstruct the historical trades as they might have occurred in real time. It is not necessary to use Intrabar Order Generation to take advantage of the improved back-test accuracy afforded by Look-Inside-Bar Backtesting. For more information on Intrabar Order Generation, see About Intrabar Order Generation or Format Strategy - Calculation.


If checked, the back-testing resolution is automatically selected based on the type of chart being used.

For weekly and monthly charts, Day is selected

For daily and intraday charts:

If you select Tick you'll be able to identify price action occurring within each charted strategy bar at the tick level.

If you select Intraday you change the number of minutes for each sub-interval used for back-testing.

Enter a value in the Maximum number of bars study will reference box to change the number of bars to reference.

Click OK when you have completed your changes or go on to the next properties section that you want to format.
http://www.clayburg.com/4_steps_system/4_steps_understanding_libbt.htm

pls help me to implementing this backtest feature in amibroker- i believe amibroker can perform as thomas mentioned this can be done using timeframefunctions.
pls pls help me
 

toptrader

Active Member
#3
in amibroker is not immediate this procedure, and you do not need no new afl because you have to set it manually in backtest procedure, also help do not undertand it very well how to set
 

trash

Well-Known Member
#4
in amibroker is not immediate this procedure, and you do not need no new afl because you have to set it manually in backtest procedure, also help do not undertand it very well how to set
Are you talking Martian way or from what planet are you coming from because your words don't make any sense? Here is a hint: Check your Star Trek Enterprise universal translator bought at Comic-Con.

Anyway it doesn't matter whether you look from upper timeframe to lower TF or from lower TF to upper TF. Both accomplish the same thing .. looking inside a bar. In AB in analysis you can look inside a bar by looking from lower timeframe to upper timeframe via timeframe functions. If you wanna look inside bar on chart and wanna replay something then use AB's bar replay tool.
 
Last edited:

toptrader

Active Member
#5
look, instead of clowning, strive to understand what we write, you do not understand anything nor my nor the request of the user.
 
#7
Are you talking Martian way or from what planet are you coming from because your words don't make any sense? Here is a hint: Check your Star Trek Enterprise universal translator bought at Comic-Con.

Anyway it doesn't matter whether you look from upper timeframe to lower TF or from lower TF to upper TF. Both accomplish the same thing .. looking inside a bar. In AB in analysis you can look inside a bar by looking from lower timeframe to upper timeframe via timeframe functions. If you wanna look inside bar on chart and wanna replay something then use AB's bar replay tool.
pls tell me how to use this function ..i have read about timeframe function .. but dont know how to use them in backtesting.though i have coded explorer using them.
cud u pls frame an macd crossover or any other formula which u like to implement lookinside bar feature during backtesting..so that i can learn to use this feature .it will be very grateful of u
thnx in advance
 

trash

Well-Known Member
#8
pls tell me how to use this function ..i have read about timeframe function .. but dont know how to use them in backtesting.though i have coded explorer using them.
cud u pls frame an macd crossover or any other formula which u like to implement lookinside bar feature during backtesting..so that i can learn to use this feature .it will be very grateful of u
thnx in advance
simply read the help file.
 

trash

Well-Known Member
#10
i have done that but to no avail.pls if u have some time then pls do give me example of code using this feature.
thnx
Timeframe examples are in the help file already!

And if you enter/exit on close/ open you don't need to look inside bar.
It is rather useful i.e. if you exit via stops as seen in this picture to overcome problem of what extreme came first ... High or Low: