NexusFi: Find Your Edge


Home Menu

 





Tip for backtesting on Renko charts


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one cpi65 with 10 posts (0 thanks)
    2. looks_two Zoethecus with 7 posts (1 thanks)
    3. looks_3 gregid with 6 posts (11 thanks)
    4. looks_4 aslan with 6 posts (9 thanks)
      Best Posters
    1. looks_one traderlange with 7 thanks per post
    2. looks_two Seberbach with 2.3 thanks per post
    3. looks_3 gregid with 1.8 thanks per post
    4. looks_4 aslan with 1.5 thanks per post
    1. trending_up 34,728 views
    2. thumb_up 43 thanks given
    3. group 18 followers
    1. forum 44 posts
    2. attach_file 2 attachments




 
Search this Thread

Tip for backtesting on Renko charts

  #41 (permalink)
 traderlange 
NY NY
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp/CQG
Trading: Futures - CL/GC/YM
Posts: 42 since Aug 2011
Thanks Given: 31
Thanks Received: 209

I use Renko bars religiously in all my strategies, and here is what I've found works for me after many many horrid automated trading experiences. Account killers and 10's of thousands of dollars of losses. But Keep reading, I do this for a living now.....

1. Write your strat - (I like the idea of limits orders mentioned above)

2. Back-test. (2 or 3) tick slippage so you don't get too excited.

3. Genetic Optimization

now here is where it really gets important -----

4. Learn how to properly do walk forward optimization. I cannot stress this enough. And not just once - learn your strategies' ratio of Optimization Period and Test Period. Especially with a strat involving a lot of parameters. And limit dynamic params as much as possible. Know what your indicators are doing as only optimize the absolutely necessary prams. This is the only chance you'll get an out of sample test without a live market.

5. If you are still happy - you MUST do Monte Carlo simulations. This is the most under utilized tool and prob the most important thing NT has for testing. You WANT your strategies to run in noisy unexpected markets and fail. Read everything you can about how this works behind the scenes so you do it properly. And ALWAYS remove at least 5-10% of your best and worse trades. If that probability curve if out of whack, go back to the drawing board.

6. If things still check out - download a couple years of market replay and let er rip all night. This is the closest thing you'll get to building the bars likea live feed does (it's not, but close).

7. Then test in realtime - as this is really the only way to make sure your logic is solid (other than with actual $$)

8. repeat #4-5 every Sunday in volatile markets if you have too. Especially if you're trading craziness like the GC.

Look, I may be completely wrong..lol. But the workflow above works for me financially (after losing for eh, 8 years now, I'm finally in the black). Again, 4 and 5 - are an absolute must.

Also, if you're new at this, learn that your risk management & exit strategy code is more important that your entry signal. And don't always use trails --- think bigger. Especially with Renkos. The options are endless, Depending on market conditions i utilize 6 exit strats (beyond a set tick or $$ profit take)

1. EMA Trail
2. Fat Tails awesome super trend trail.
3. I have a custom MA that adapts to fake reversals - and exit when the slope changes <- this is my prize winner
4. Fast markets i use the slope change of this beauty anaZeroLagHATEMA again thank you @Fat Tails
5. For longer holds i'll use the trend change of my Adaptive Laguerre filter <- this rocks.
6. and sometimes anaADXVMA. and again @Fat Tails you rock.

(I'm actually almost finished with a chart trader add on that utilizes these seamlessly - i'll post when finished but it's a ton of code and I'm finally testing on the live markets)

Of course, proper entries are important, but if you're not netting a 3+ profit factor, you'll eventually blow your account. I've done it too many times.

There is my 2 cents for the for the eve - time to grab a beer.

Mike

Visit my NexusFi Trade Journal Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Deepmoney LLM
Elite Quantitative GenAI/LLM
ZombieSqueeze
Platforms and Indicators
Are there any eval firms that allow you to sink to your …
Traders Hideout
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
Battlestations: Show us your trading desks!
18 thanks
  #42 (permalink)
 aaadetos 
houston, tx/usa
 
Experience: Intermediate
Platform: ninjatrader
Trading: es
Posts: 1 since Mar 2014
Thanks Given: 2
Thanks Received: 0


gregid View Post
All renko incarnations (NT Renko, MedianRenko, SBSRenko, WickedRenko) are unreliable for backtesting due to few issues. One of these issues is redrawing the "open" of the bar after the bar has formed.

In order to avoid the complications of the redraw:

Tip

Refrain from using Market Orders for backtesting purposes and replace all MARKET orders with LIMIT orders with LimitPrice = Close[0]
(this will simulate standard behaviour of market orders for CalculateOnBarClose = true)



Sample code:

 
Code
                            
//instead of using:

EnterLong("entry1");
//use:
EnterLongLimit(Close[0],"entry1");
 
 
//instead of using:
EnterShort("entry1");
//use:
EnterShortLimit(Close[0],"entry1"); 
Good luck backtesting!

I have found that submitting market orders, via EnterLong() or EnterShort() in backtesting yields a different result than EnterLongLimit(Close[0]),"Buy") on the same backtest. When the exit strategy is to exit on conditions on the Renko chart, these appear to be ignored; and the entry and exit appears on the same Renko bar. Using EnterLong(), however, these enter on the new bar, as highlighted by others in this thread, and the rules appear to be followed.

What is a work-around for this in live testing? Live testing with the EnterLong()- ExitLong() sees eventual order rejections due to market movements within the Renko bar (Buy stops below the market/ sell stops above the market)...How could one then submit market orders on Renko charts in live testing without this occurring? Otherwise, how could one submit limit orders in strategy testing without also exiting on the same entry Renko bar?


Reply With Quote
  #43 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623



aaadetos View Post
I have found that submitting market orders, via EnterLong() or EnterShort() in backtesting yields a different result than EnterLongLimit(Close[0]),"Buy") on the same backtest. When the exit strategy is to exit on conditions on the Renko chart, these appear to be ignored; and the entry and exit appears on the same Renko bar. Using EnterLong(), however, these enter on the new bar, as highlighted by others in this thread, and the rules appear to be followed.

What is a work-around for this in live testing? Live testing with the EnterLong()- ExitLong() sees eventual order rejections due to market movements within the Renko bar (Buy stops below the market/ sell stops above the market)...How could one then submit market orders on Renko charts in live testing without this occurring? Otherwise, how could one submit limit orders in strategy testing without also exiting on the same entry Renko bar?


Quite a lot has changed since my original post - there have been many new renko implementations with real open and close - search for Beter Renko on this board.

Started this thread Reply With Quote
Thanked by:
  #44 (permalink)
Zananas
Paris France
 
Posts: 7 since Sep 2018
Thanks Given: 4
Thanks Received: 1

Hi everyone,

First of all, thanks for all your tips and sharing your experience here.

I'm actually backtesting a strategy on GBPUSD using a Renko based charts.
Unfortunately I'm having some issue concerning exact opening/closing price position.

For exemple my long strategy is simply based on a direction change between two following Renko bars, here's my script
if (Open[0] < Close[0])
&& (Open[1] > Close[1])
{
EnterLong(Convert.ToInt32(DefaultQuantity), @"Long");
}

Here's a snapshot for illustration in attachment.
On renko #1 we notice a open > close, and on renko #2 a open < close, so my entry condition is triggered as soon as renko #2 is closed.
The issue remain here : opening position price is the open of renko #3 (red triangle) instead of closing of renko #2 (green triangle).
Hence my strategy tester remain on false price entry.

NB : obviously this issue ain't encountered on candlestick chart, as close from previous bar equals open of following. But renko chart are constructed totally different.

How NinjaTrader could to manage this error ?
Is there some code to implement in the strategy script to solve it ?

Thanks a lot for your help

Attached Thumbnails
Click image for larger version

Name:	GBPUSD (140 Renko)_cropped.png
Views:	256
Size:	2.8 KB
ID:	255110  
Reply With Quote
  #45 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863

It all depends how you back test.

Live testing is not equal to replay
replay is not equal to fast forward

I will post some more evidence,
and I am sure that some folks will completely freak out on the findings

If you replay the data at real-time speed, you get what is supposed to be near real live results
(who has that patience ?)

If you fast forward replay the data, you get very different results..
result that will not be in relation to what you can expect in a real market

When you ask a computer to calculate something
and you ask the computer to do it slowly
or you ask the computer to do it fast
you expect the results to be the same

If you do something in Ninjatrader,
that logic does not work..
slow is not equal to fast
and i'm not talking about the comm's delay
you can put the delay to 0

Even worse
if you have more than 500 historical trades
this issue even gets worse
a lot worse..

stay tuned, i'll post some findings in the next days
it will show that a live working strategy,
in back testing completely fails
and vice-versa

if you are a gold digger
still trying to find a holy grail ?
you should be aware of these things
if not, it will sting you badly..

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on March 8, 2019


© 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