PDA

View Full Version : Confused


Duval
11-24-2008, 08:07 AM
Hi,
i'm a bit confused when I read that backtest is ONLY possible with OHLC data.

For example, lets say my backtest entry point is previous back high +10 tick.

So when doing the backtest, it will only enter at current bar either OHLC value, and is not "smart" enough to calculate previous bar high + 10 tick (providing that current bar high > previous bar high of course) ?

So at current bar, it is IMPOSSIBLE to have an entry at a value other than OHLC ?

Cordially,
Duval

NinjaTrader_Josh
11-24-2008, 08:11 AM
Duval,

One of our NinjaScript trainees will respond to you later today. Thank you for your patience.

NinjaTrader_Bertrand
11-24-2008, 09:41 AM
Hi Duval,

This statement only refers to the absense of the tick formation inside your bar when backtesting, which for example means, you don't know which came first - the high or the low of the bar.

Of course you can place an order like you outlined in your post below.

Please also review this link -

http://www.ninjatrader-support.com/HelpGuideV6/DiscrepanciesReal-TimeVsBacktest.html

Duval
11-24-2008, 11:04 AM
Ok thanks for your answer..... so for example in a backtest, going long, I can set a profit stop at my entry level + ATR of 5 bars..... and have this stop "taken" in a backtest if any bar touches this level.... and have my profit calculated on exactly my entry price + ATR(5) even if it doesn't correspond exactly to an OHLC value ?

Sorry to insist but before deciding to spend the next few months working with NT, i must be really sure it is well suited for me.

Thanks,
Duval

NinjaTrader_Bertrand
11-24-2008, 11:30 AM
Hi Duval,

Thanks for following up, yes this is possible in NinjaTrader.

Just keep in mind that any historical (backtesting) fill is always an assumption, since tick formations and queues at certain price levels are only present realtime.

You can choose between two fill algorithms in NinjaTrader -

1. Default - more conservative approach, price has to penetrate limit price to fill

2. Liberal - limit orders only need a touch to fill

Please also review this link http://www.ninjatrader-support.com/HelpGuideV6/BacktestAStrategy.html under 'Historical Fill Processing'

Thanks and have a great day!

Duval
11-24-2008, 11:46 AM
Thanks, you seem to have the best compromise between power and ease of access, I will definitely give Ninjatrader a try.

I particularly like the free historical intraday feed provided by GAIN forex..... this is really perfect for backtesting before going live.

NinjaTrader_Bertrand
11-24-2008, 11:52 AM
You are welcome Duval, have a good developing time with NinjaTrader!

Here's a link to our help guide, which is very comprehensive and a great learning start - http://www.ninjatrader-support.com/HelpGuideV6/WelcomeToNinjaTrader.html

Duval
11-28-2008, 03:07 AM
Ok, in the context of a backtest on 5 minutes bars where I set not to update strategy on bar close, I developped a simple strategy, and final trigger for long entry is:

bar price (close) > High of yesterday, with condition that bar open < yesterday high. The goal was to enter position just when price cross yesterday high even if not an OHLC value.

What happens is that the entry is always on next bar open, never in the bar at exactly yesterday high + 1 tick.

Is the only solution in this context is to have entry the closest possible to yesterday high + 1 tick, is to use multi time frame strategy, with signals generated on smaller time frame when smaller time frame close > yesterday 5 minute bar high ?

Cordially,
Duval

NinjaTrader_Jason
11-28-2008, 05:30 AM
Hello Duval,

You will need to set "Calculate on bar close" to False for your strategy in Initialize(). More information can be found at the link below.
http://www.ninjatrader-support.com/HelpGuideV6/OnBarUpdateEvent.html

Duval
11-28-2008, 06:25 AM
Thanks for continuous support, but I really have this problem still with entry systematically on next bar open. Stop loss and profit are well calculated though and don't wait bar to close in backtests to be triggered.

Of course I unchecked calculate on bar close.

Maybe I set my parameter wrong ?
In the wizard I say that condition that Close(0) > High(1). I expect from this that a long is generated at high(1) +1 tick level in current bar from last bar. Maybe I specify wrong.

Cordially,
Duval

Hello Duval,

You will need to set "Calculate on bar close" to False for your strategy in Initialize(). More information can be found at the link below.
http://www.ninjatrader-support.com/HelpGuideV6/OnBarUpdateEvent.html

NinjaTrader_Ray
11-28-2008, 07:10 AM
What you will get is an entry when close of current bar is greater than the high of the last bar by at least 1 tick. When running your strategy in real-time and calculate on bar close parameter is set to false, this condition will be checked on each incoming tick.

Duval
11-28-2008, 07:20 AM
What you will get is an entry when close of current bar is greater than the high of the last bar by at least 1 tick. When running your strategy in real-time and calculate on bar close parameter is set to false, this condition will be checked on each incoming tick.

Thanks for your support.
Ok I understand why I get this. the point is: is there a way to have the signal from the backtest entered right at the high of previous bar + 1 tick ?
If backtests can only simulate entry at next bar open after signal is triggered... then this is a serious problem for me since backtest will be useless as there are big variation between signal and next bar open.

Cordially,
Benj

NinjaTrader_Ray
11-28-2008, 09:22 AM
You have then run into the limitation of backtesting. Backtest fills can only occur on the bar after the signal bar. This will not be any different on any other commercial backtest application in the market.

Duval
11-28-2008, 09:29 AM
Ok.
And can this be overcome with Ninjatrader's multi time frame capabilities ?

For example, still in a backtest environement, have signals generated on 3 seconds charts of instrument Y, based on setups of 5 minutes charts of same instrument Y ?

For example, compare 3 second chart close of current bar to high of latest 5 minute bar (once bar is completed) and generate signal if the 3 second bar close is higher ?

This would be a real solution to the problem but i'm wondering if it can be done in such a way in backtest environment ?

Thanks,
Duval

NinjaTrader_Josh
11-28-2008, 01:08 PM
Duval,

Please see this reference sample: http://www.ninjatrader-support2.com/vb/showthread.php?t=6652

Be advised that even with more granularity it will still not be the same as forward testing though.

Duval
11-30-2008, 03:39 PM
Hi,
the granularity definitely helps and makes backtesting much much more accurate.

Is there anyway to have the backtest signals drawn on the small timeframe chart (3 seconds) also displayed on the 5 mn chart ? Because actually when I backtest it switch to small time frame which is normal, but when I go back in 5mn timeframe I don't see the signals anymore.

Thanks,
Duval

NinjaTrader_Ray
11-30-2008, 03:50 PM
Unfortunately not at this time.

Duval
12-01-2008, 01:25 AM
Is this feature included in 7.0 ?

Thanks,
Duval

NinjaTrader_Bertrand
12-01-2008, 04:39 AM
Hi Duval,

Unfortunately we are not yet in the position to announce NinjaTrader 7 features, we will do so as appropriate.

Duval
12-03-2008, 01:01 AM
Ok, but I really hope it is included because it is a HUGE loss of time currently to use the cross air to see where the trades between the different timeframe charts.

NinjaTrader_Bertrand
12-03-2008, 04:07 AM
Hi Duval,

Have you tried coding your signals up visually? This way you can run those on all your needed timeframes and get easier confirmation when action is needed...

Duval
12-05-2008, 02:53 PM
Hi Duval,

Have you tried coding your signals up visually? This way you can run those on all your needed timeframes and get easier confirmation when action is needed...

Hi,
can you be a bit more specific please, what exactly can be achieved with coding signals visually ? I currently have signals on my 3 seconds charts..... do I need to open another chart ? Or just reload the 3 second chart as 5 mn chart ?

Thanks,
Duval

NinjaTrader_Josh
12-05-2008, 03:08 PM
Hi Duval,

I have not followed this thread intimately, but you can use any of the Draw() methods to add a visual marker on your chart. Do this at the same time you make trades and you will know when your signals are triggering.

Duval
12-05-2008, 03:11 PM
Hi Josh,
I did not mention that my requirements to show trade signals on higher time frame is in the context of a Backtest, so I don't know if your remarks applies ?!

NinjaTrader_Josh
12-05-2008, 03:19 PM
Duval,

As I mentioned earlier I have not been following this thread intimately and Bertrand is off for the day.

What are you trying to do if it is not to come up with visual representations? Just use a Draw() method anywhere you want this visual.