Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Price Close below EMA for exit conditions (backtest works,not with live sim test)
Collapse
X
-
Hello abtrad1ng,
Thanks for your post.
Are you running your strategy with a Calculate mode of OnBarClose, OnEachTick, or OnPriceChange?
To have the strategy process only at the close of each bar, you would need to run the strategy using a Calculate mode of OnBarClose.
See this help guide page for more information about Calculate: https://ninjatrader.com/support/help.../calculate.htm
Also, see the help guide documentation on the differences on real-time vs backtest (historical).
http://ninjatrader.com/support/helpG...ime_vs_bac.htm
It is expected that a strategy running real-time (live brokerage account, live market simulation, Playback connection etc...) will produce different results than the performance results generated during a backtest.
When in historical data, only the Open, High, Low, and Close will be available and there will be no intra-bar data. This means actions cannot happen intra-bar, fills cannot happen intra-bar. All prices and actions come from and occur when the bar closes as this is all the information that is known.
Because of this, OnBarUpdate will only update 'On bar close' as it does not have the intra-bar information necessary for 'On price change' or 'On each tick' and the script will not have the intra-bar information to accurately fill an order at the exact price and time.
Additional information may be found in this NinjaTrader Forum post —
https://ninjatrader.com/support/foru...mance?t=102504
Let us know if we may assist further.
<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
-
Hi Brandon thanks for the info!
I just checked and it was set to on price change. My entry is based on an active price of the current bar instead of the bar close. If I change the setting to on bar close, will my entry likely need to change as well? Right now my entry is an enter long market if touched @ the ema, whenever the price is <= the ema.
Comment
-
Hello abtrad1ng,
Thanks for your note.
I would not be able to say for sure if you would need to modify your entry order condition.
If you run the strategy with a Calculate mode of OnBarClose, the strategy will process orders at the close of each bar.
You could run your strategy using Calculate.OnBarClose to see how the strategy is behaving and make modifications depending on your goals.
Note that it would be able to calculate some logic OnPriceChange and other logic OnBarClose using IsFirstTickOfBar, however, this would require unlocking the script from the Strategy Builder and manually coding this. You can take the following approach to differentiate logic between OnBarClose and OnPriceChange processing.
Please see this reference sample which demonstrates a technique used for those who need to separate their logic to calculate some values on each tick and others only on the close of a bar. You will set your host script to Calculate.OnPriceChange and use if(IsFirstTickOfBar) and place all code that needs to calculate once every bar within that condition check. Then place all code that you want to calculate OnPriceChange outside of the IsFirstTickOfBar condition check.
SampleEnterOnceExitEveryTick -https://ninjatrader.com/support/help...either_cal.htm
Let us know if we may assist further.<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by WilliCarls, Today, 02:01 AM
|
0 responses
5 views
0 likes
|
Last Post
![]()
by WilliCarls
Today, 02:01 AM
|
||
Started by Pa_Baz, 12-14-2024, 09:40 PM
|
47 responses
793 views
1 like
|
Last Post
![]() |
||
Started by powbordon1126, 02-06-2025, 08:47 PM
|
3 responses
28 views
0 likes
|
Last Post
![]()
by rockmanx00
Today, 12:09 AM
|
||
Started by dhanushatrader96, Yesterday, 10:24 PM
|
1 response
13 views
0 likes
|
Last Post
![]()
by bltdavid
Yesterday, 11:55 PM
|
||
Started by reynoldsn, Yesterday, 07:52 PM
|
0 responses
9 views
0 likes
|
Last Post
![]()
by reynoldsn
Yesterday, 07:52 PM
|
Comment