NexusFi: Find Your Edge


Home Menu

 





MedianRenko close/open


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one hawks67 with 7 posts (0 thanks)
    2. looks_two aslan with 4 posts (7 thanks)
    3. looks_3 Big Mike with 3 posts (4 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 6,072 views
    2. thumb_up 11 thanks given
    3. group 2 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread

MedianRenko close/open

  #1 (permalink)
 hawks67 
Chicago, IL
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AGN/Rithmic
Trading: CL
Posts: 22 since Apr 2010
Thanks Given: 14
Thanks Received: 2

Once again, I begin this plea for help by saying that if there already is an answer for this somewhere in these forums, I've been unable to find it.

Every strategy I've ever written has been applied to either a tick or a minute chart. These strategies calculate various things at the close of the current bar and enter trades at the open of the next bar (market order at the open). Bar 0 closes at 1080.00, the strategy calculates stuff and decides to execute a trade, the next bar opens at 1079.75, the strategy goes short at 1079.75.

Doesn't seem to work with MedianRenko4.

If the current MedianRenko4 bar closes at 1080.00 and the next one opens at, say, 1079.50, I'm getting filled at 1080.00. I want the fill to occur at the open of the next bar, not the close of the current one (this is not just normal slippage). This was never an issue until I started messing with MedianRenko bars.

When I apply the strategy forward and backward, 100% of the historical fills have been exactly where I've wanted them (at the open of the new bar), but 100% of the fills going forward (live) are at the close of the just-closed bar. Why would this be?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #3 (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,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603


Moved to NinjaTrader Programming.

You cannot backtest any Renko chart, or any Line Break, PnF chart, etc, using NinjaTrader and have it be the only dataseries and have it be accurate. Even the built-in Renko in NT7 is not accurate in backtests.

You will need to use a second dataseries and place all orders via that second dataseries. It should be a 1 range or 1 tick dataseries for best results. That pretty much means NT 6.5 is out because it will crash due to the memory consumption.

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:
  #4 (permalink)
 hawks67 
Chicago, IL
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AGN/Rithmic
Trading: CL
Posts: 22 since Apr 2010
Thanks Given: 14
Thanks Received: 2

Thank you sincerely, Mike.

I apologize for really sounding green here, but while I have previously added secondary dataseries to strategies in order to add further depth to my calculations, I have not even heard of submitting orders through them. Is there an example you can point me to that illustrates this?

And, since I do eventually want to know what I'm talking about, can you help me understand why this is happening like this? Why does a MedianRenko bar open at X price, but a market order submitted at that open is consistently getting filled at the close of the previous (just-closed) bar? (I know slippage will happen, but this is not slippage...) What aspect of MedianRenko bars am I not understanding here?

Started this thread Reply With Quote
  #5 (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,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603

A market order is submitted at the Open price of a bar, which is 'false' or whatever word you want to use with MedianRenko bars. That is the why. Even if you try limit orders based on the Close, you still run into problems (new ones) because of all the problems with NT's handling of limit orders in a backtest, specifically NT doesn't know the OHLC order of a bar and it makes terrible assumptions (the opposite is true of MultiCharts, for example), so it requires some more work to use Limit orders, too.

You can read the Hurley thread, a lot of details, tons of backtesting, etc. Hundreds of posts about MedianRenko and backtesting.

As for as how to write your strategy, I am sorry but I don't do NT programming any longer. Adding a second DataSeries to a strategy and then properly submitting orders to it is not an entry-level task. You can ask for help here, it will help if you share your strategy so someone has something to "gain" from the time it will take to convert your strategy to a multi-dataseries one.

I don't want to burst your bubble, but what it really truly comes down to is this --- if you want my opinion: if your strategy can't make money on time based bars or tick, volume, or regular range bars, then it is not worth the time effort and/or money to try to make it work on medianrenko. The backtest results look stellar, it's about impossible to make a strategy look bad with medianrenko, but its all fake. Just run it live and you'll see (I think you've got this far already).

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:
  #6 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127

Renkos have a fundamental problem in that the "open" of the next bar is not known until the next bar closes.

The algorithm for building a renko bar typically starts accumulating ticks for a new bar, and then sets the open when the brick size is met. If the direction of the brick is the opposite of the previous brick, then the open is changed. The NT bar building algorithm makes this problematic at best, because they do not make it easy to actually change the open.

Renkos have another MAJOR issue, in that some implementations do not track the "wick" data (high and low data outside of the brick). I am not familiar with MedianRenko, but NT native Renko is horrible. I tried to fix this in "WickedRenko" bars which are in the download area, but they still suffer from the open price changing when the bar closes.

Backtesting with Renko is just a bad idea unless you really know what you are doing. Generally, I use renko bars for visual only cues, as I like the way they remove the noise, but would never set up a strategy on them.

Reply With Quote
  #7 (permalink)
 hawks67 
Chicago, IL
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AGN/Rithmic
Trading: CL
Posts: 22 since Apr 2010
Thanks Given: 14
Thanks Received: 2

Excellent info, thanks to both of you. I shall now resume my regularly-scheduled MedianRenko-free programming.

Started this thread Reply With Quote
  #8 (permalink)
 hawks67 
Chicago, IL
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AGN/Rithmic
Trading: CL
Posts: 22 since Apr 2010
Thanks Given: 14
Thanks Received: 2

Here I thought I was out of the woods...

My initial problem (see above) was that with a MedianRenko chart, my fills were out of whack due to some incorrect assumptions about closes and opens. That has since been explained (thanks again).

But I'm finding that I'm getting exactly the same problem with Range bars. On my Range6 chart, as I understand it, each bar grows until it is six ticks in size, at which point the next bar opens either one tick above the high of the just-closed bar or one tick below the low. My code calculates things, and if all is copacetic, it issues a market order, which, I assume (incorrectly?), is supposed to be executed at the open of the next bar, since these calculations only occur OnBarClose.

So I have been watching carefully, and when a Range6 bar closes at 1060.00 and the next one opens at 1060.25, I'm getting filled at 1060.00. Every time. Can someone tell me why this would be?

[my order-entry code is just this: SE_EntryOrder = EnterShort(0, pEntry_Qty, "SE"); ]

Started this thread Reply With Quote
  #9 (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,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603

I always add 1 tick slippage for market orders in backtests to get around that issue.

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
  #10 (permalink)
 
aslan's Avatar
 aslan 
Madison, WI
 
Experience: Advanced
Platform: ALT
Trading: ES
Posts: 625 since Jan 2010
Thanks Given: 356
Thanks Received: 1,127


OnBarClose may actually be OnBarOpen for certain bar types. For example, for a range bar you need the first tick of the next bar to know that you should close the current bar.

Another strangeness of range bars is the "phantom" bars that get inserted when there is a gap. In backtesting, you could be filled at non-existent prices (the phantom bars usually have volume of 1 or zero the way NT builds the bars).

Finally, a market order could get filled anywhere, but in backtest/sim, it will be filled at the current bid/ask (there may be ways to control this in NT, but don't recall). So on an uptick, your sell market will likely be at open minus a tick.

Reply With Quote
Thanked by:




Last Updated on July 19, 2010


© 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