NexusFi: Find Your Edge


Home Menu

 





Backtesting on Renko Charts


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one diverdan with 12 posts (8 thanks)
    2. looks_two RM99 with 5 posts (9 thanks)
    3. looks_3 Jura with 3 posts (0 thanks)
    4. looks_4 Big Mike with 3 posts (1 thanks)
      Best Posters
    1. looks_one RM99 with 1.8 thanks per post
    2. looks_two sptrader with 1 thanks per post
    3. looks_3 diverdan with 0.7 thanks per post
    4. looks_4 Big Mike with 0.3 thanks per post
    1. trending_up 23,566 views
    2. thumb_up 19 thanks given
    3. group 8 followers
    1. forum 25 posts
    2. attach_file 4 attachments




 
Search this Thread

Backtesting on Renko Charts

  #11 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


Jura View Post
This question is just showing my ignorance on this subject matter, but I don't follow this. If I plot Renko bars in MultiCharts, each has the same range and the open is at most one "box size" away from the preceding close. Also when using "PlayBack" mode, I don't see this behaviour that a new bar can be three "box sizes" away from the preceding bar.

Or are you saying that real-time Renko charts have different 'plotting rules' than the one based on historical tick data?

Thanks for any insights,

let's say your box size is 10 ticks. And the last bar is a down bar that closes at 100.00

The new bar "opens" at 100.00, if that new bar runs to 99.91, it still has not created a new down box, additionally, it can then go all the way from 99.91 back North, all the way until it reaches 100.19, because at 100.20 is when it will make a new green/higher bar.

So the range for the bar is really 30 ticks (100.20 down to 99.90)

So if you backtested and had a trailing stop of 2 box increments, it's possible, that in our example, the trail was activated if the price then retraced BACk to the downside and made a new bar opening at 99.90.

What BigMike was saying, that the openings don't line up, is because if the last bar was a down bar and to stick with our example...closed at 100.00

if the bar retraces and begins to climb and hits 100.20 and closes a "green" or up bar, the historical chart will actually show the open at 100.10 (not 100.00) NOR will it show if the price actually went lower than the true open of the bar.

If you actually run a live strategy on renko, with tick/tick entries or exits, you'll begin to notice transactions that ocurr OUTSIDE the actual bars...because the bar only plots new bricks up or downs, it doesn't plot the rest of the story.

That's the original intent of a renko chart, that it removes all the "noise" of the price action and that's why you see these nice, beautiful strings of same colored bars in trends....

When in actuality, there was most likely, a lot of price movement around some of the bars during a trend...you just don't see it, because renko removes all the excess information.

Like I said, Renko is useful (in it's original form) for identifying overall/higher time frame trends and also it's very useful for visualizing support/resistance points (if you see a double top where the brick highs are equal, or a triple top).

You actually have the ability to run 2 data streams. (with MC). TS has the ability to use workarounds such as globaldictionary and globalvariables...but you still cannot backtest (even end of bar, no IOG). I'd be satisfied simply backtesting with the true ranges/tails/wicks included.

Renko is also very useful for identifying trend reversals/pivot points.

IF you can plot the improved Renko with tails/wicks, you can notice some pretty strong entry points where there are a reversal bar with a very long tail/wick. You'll begin to notice that reversals always feature a wick that's the length of a bar (at least) but sometimes, the wick can be almost 2x the brick increment...those are stronger entry and exit points.

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Tao te Trade: way of the WLD
24 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
11 thanks
GFIs1 1 DAX trade per day journal
11 thanks
  #12 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704

One thing I forgot to add is that the inherent nature of Renko is to remove the time aspect....so a bar might form in any time frame imagineable...might be 1 minute, 1 hour, 1 day, etc.

THAT is why the range is so prolific.

With regular time based bars, you see an "inversion" where the bar is an up bar, but instead of the normal OLHC order, you see an inversion order of OHLHC (which gets plotted as OLHC). This doesn't happen very often, but it does happen (because the time is limited, it's not as often). With Renko, there's no time limit, so price wonders however it wants, for as long as it wants before moving far enough to create a new bar.

This type of "inversion" bar really throws trailing stops and anything that's tick/tick or IOG for a loop, because unless the stop and profit limits are larger than the bar, the backtest engine either has to assume "best case" or "worst case" with respect to OHLC.

Obviously the remedy to this is to backtest "look inside" or tick/tick, but with TS, that's not always available. (IOG strategies, DLL strategies, etc).

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
Thanked by:
  #13 (permalink)
 diverdan 
Singapore
 
Experience: Beginner
Platform: Multicharts, R
Trading: EUR / USD
Posts: 185 since Feb 2010
Thanks Given: 106
Thanks Received: 99


Hi RM99

Thanks for the explanation.

I can understand the points about wicks not showing, and I have now plotted a 5Range chart and 5 Renko chart together and can very clearly see some of the price action you are talking about.


RM99 View Post
What BigMike was saying, that the openings don't line up, is because if the last bar was a down bar and to stick with our example...closed at 100.00

if the bar retraces and begins to climb and hits 100.20 and closes a "green" or up bar, the historical chart will actually show the open at 100.10 (not 100.00) NOR will it show if the price actually went lower than the true open of the bar.

However I still don't get the point above. If the Renko plots like you explain, surely you would see a gap from the bar that closed at 100.00 and the one which opened at 100.20.

Cheers,

Dan

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #14 (permalink)
 diverdan 
Singapore
 
Experience: Beginner
Platform: Multicharts, R
Trading: EUR / USD
Posts: 185 since Feb 2010
Thanks Given: 106
Thanks Received: 99

I thought I would post my cool strategy which started me off on this thread and see if I can improve as per the suggestions.

I ran it on the eur/usd 5 Renko and seemed to test very well.

 
Code
                            
Inputs:
    
ccilength 14 ), turningpoint 100 ), strength ),
    
Lookback(2), BarSize(5),
    
TimeOffset(100), MaxLosingTrades(4), DailyProfitTargetPips(50), TimeStop(20),
    
ProfitTarget1(20), BreakEven(20), Offset(2), AccountSize(10000), RiskPerTrade(0.01);
Vars:
    
cciv(0), up(0), down(0), 
    
SessionTime (0), TimeToTrade(0), Triggered(0),
    
ind(1), SessionHi(-999999), SessionLo (+999999), 
    
TradeChart(1), TrendChart(2), Penetrated(false), LongTrigger(False), ShortTrigger(false),
    
AvgMaxExtension(0), MaxExtension(0), MaxHiLo(0),
    
NoLosingTrades(0), Pips4Day (0), PipsThisTrade(0), 
    
enterprice(0), stoploss(0), stopsize(0), BE(0), PT(0), ts(0), 
    
RiskAmount(0), Quantity(0), oneTick(0), OffsetTick(0), trend(0);

if 
CurrentBar 1 Then begin    
    cleardebug
;
    
oneTick MinMove PriceScale;
    
OffsetTick = (BarSize Offset) * oneTick;
    
AvgMaxExtension 0;
end;

trend 0;

cciv CCI(ccilength);

if 
cciv crosses below turningpoint and L then up Highest(Highstrength);
if 
cciv crosses above -turningpoint and H then down Lowest(Lowstrength);

//Work out session time
SessionTime CalcSessionTime;
TimeToTrade CalcLondonOpen;

If 
time >= SessionTime and SessionTime time[1then begin     
    NoLosingTrades 
0;
    
Pips4Day 0;
end;

//Session Performance Analysis
if marketposition and Triggered 1 then begin
    Triggered 
0;
    if 
positionprofit(1) < 0 then NoLosingTrades NoLosingTrades 1;
    
PipsThisTrade positionprofit(1) / maxcontracts(1) / oneTick;
    
Pips4Day Pips4Day PipsThisTrade;
    if 
Pips4Day DailyProfitTargetPips then messagelog(NumToStr(date,0) + " # Pips 4 Day: " NumToStr(pips4day0) + " # Losing Trades: " NumToStr(NoLosingTrades0));
    
MaxExtension MaxExtension oneTick;
    
AvgMaxExtension MaxExtension AvgMaxExtension;
end;

LongTrigger close[1]  > open[1];
ShortTrigger close[1] < open[1];

if 
marketposition and NoLosingTrades MaxLosingTrades and time TimeToTrade and 
     
Pips4Day DailyProfitTargetPips then begin
    
if LongTrigger and close up then begin
        enterprice 
up OffsetTick;
        
stoploss up OffsetTick;
        
ts stoploss OffsetTick;
        
MaxExtension enterprice;
        
MaxHiLo enterprice;
        
stopsize = (enterprice stoploss) / oneTick;    
        
RiskAmount = (AccountSize i_ClosedEquity) * RiskPerTrade;
        
Quantity RiskAmount stopsize 10000;
        
Buy Quantity contracts Next Bar at enterprice stop;
    
end 
    
else if ShortTrigger  and close down then begin
        enterprice 
down OffsetTick;
        
stoploss down OffsetTick;    
        
ts stoploss OffsetTick;    
        
MaxExtension enterprice;    
        
MaxHiLo enterprice;
        
stopsize = (stoploss enterprice) / oneTick;
        
RiskAmount = (AccountSize i_ClosedEquity) * RiskPerTrade;
        
Quantity RiskAmount stopsize 10000;
        
sellshort Quantity Contracts Next Bar At enterprice stop;    
    
end;
end;


if 
marketposition 1 then begin
    Triggered 
1;
    
PT entryprice ProfitTarget1 oneTick;
    
BE entryprice BreakEven oneTick;
    
    
ts iff(ts close  offsettickclose  offsettickts);
    
Sell ("Long Target 1"Quantity contracts next bar At PT limit// Profit Target 1 

    
SetStopPosition// Forces the built-in stop functions to be applied on the entire position basis (all open contracts) 
    
Sell ("StopLoss L"All Contracts next Bar At stoploss Stop// initial stop 
    
Sell ("Trailing L")All Contracts next Bar At ts Stop// trailing stop 
    //Sell ("Trailing Stop") All Contracts next Bar At ts Stop; // trailing stop 
    
    
if high MaxHiLo then MaxHiLo high;
    
MaxExtension maxhilo enterprice;    
end
else if marketposition = -1 then begin
    Triggered 
1;
    
    
PT entryprice ProfitTarget1 oneTick;
    
BE entryprice BreakEven oneTick;

    
ts iff(ts close  offsettickclose offsettickts);

    
Buytocover ("Short Target 1"Quantity contracts next bar At PT limit// Profit Target 1

    
SetStopPosition// Forces the built-in stop functions to be applied on the entire position basis (all open contracts) 
    
Buytocover ("StopLoss S"All Contracts next Bar At stoploss Stop// initial stop
    
Buytocover ("Trailing S"All Contracts next Bar At ts Stop// trailing stop
    
    
if low MaxHiLo then MaxHiLo low;
    
MaxExtension enterprice maxhilo;
end

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #15 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


diverdan View Post
Hi RM99

Thanks for the explanation.

I can understand the points about wicks not showing, and I have now plotted a 5Range chart and 5 Renko chart together and can very clearly see some of the price action you are talking about.



However I still don't get the point above. If the Renko plots like you explain, surely you would see a gap from the bar that closed at 100.00 and the one which opened at 100.20.

Cheers,

Dan

If bar[1] is red (or a down bar) and the current bar closes up (green bar) yes, you see a void gap, but the open/close values do not account for this.

If you click on the green bar (that's preceded by a red) the open for the green bar is reported as the actual price of the bottom of the green bar (not the close of the red bar or the bottom of the red bar).

Historically, those values throw everything off.

When TS is plotting renkos in real time, they turn different colors when they're in "no man's land" i.e. the range of the bar preceding.

when a new bar reverses from previous, it doesn't take into account the close of the last bar as it's open. the open/close value for renko bricks is always a fixed preset amount.

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
  #16 (permalink)
 diverdan 
Singapore
 
Experience: Beginner
Platform: Multicharts, R
Trading: EUR / USD
Posts: 185 since Feb 2010
Thanks Given: 106
Thanks Received: 99

In the middle of updating the strategy to have Renko on chart 2 and Range as the trading chart 1.

Have to go out with wife, will post later on...

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #17 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


RM99 View Post
let's say your box size is 10 ticks. And the last bar is a down bar that closes at 100.00

The new bar "opens" at 100.00, if that new bar runs to 99.91, it still has not created a new down box, additionally, it can then go all the way from 99.91 back North, all the way until it reaches 100.19, because at 100.20 is when it will make a new green/higher bar.

So the range for the bar is really 30 ticks (100.20 down to 99.90)

So if you backtested and had a trailing stop of 2 box increments, it's possible, that in our example, the trail was activated if the price then retraced BACk to the downside and made a new bar opening at 99.90.


RM99 View Post
With regular time based bars, you see an "inversion" where the bar is an up bar, but instead of the normal OLHC order, you see an inversion order of OHLHC (which gets plotted as OLHC). This doesn't happen very often, but it does happen (because the time is limited, it's not as often). With Renko, there's no time limit, so price wonders however it wants, for as long as it wants before moving far enough to create a new bar.

Ah I see, thanks a lot RM99 for your thorough reply. I haven't been able to locate examples of this '3x range occurrence', but did find in my data/instrument examples when the price when 1 tick higher or lower than the Renko bar, which with a box size of 2 would be half of the box range, which is already big and that's even with a "slow" instrument with low ATR. Thanks again for bringing up this important point RM99. I've attached a screenshot for other readers which show 2 of these cases (see red arrow).


RM99 View Post
IF you can plot the improved Renko with tails/wicks, you can notice some pretty strong entry points where there are a reversal bar with a very long tail/wick. You'll begin to notice that reversals always feature a wick that's the length of a bar (at least) but sometimes, the wick can be almost 2x the brick increment...those are stronger entry and exit points.

MultiCharts currently can't plot the wicks of Renko bars (right?). At first thought I assumed this could be coded in a custom indicator, by plotting vertical lines which would be the wicks for the Renko bar, based on a lower resolution time frame. But, to accurately plot these wicks, they'd had to be matched with a 1 Tick resolution. However, that screws up the distance between the Renko bars (missing feature MultiCharts Project Management - Issue MC-377 - Keep X [AUTOLINK]Scale[/AUTOLINK] of Data1 when 'hidden' Data2 is in different time frame [Feature Request]). Perhaps someone knows a way how to keep the Renko bars usable when adding a 1 Tick data series as Data2? Then we can code an indicator which draws these custom wicks, which would be a great help to visually see the "quality" of the Renk chart and the chosen 'box size'-settings for a particular instrument.

Attached Thumbnails
Click image for larger version

Name:	renkoDifference.png
Views:	387
Size:	46.8 KB
ID:	44353  
Reply With Quote
  #18 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704

 
Code
//=================================================================================================================
 Input: HighWickColor   (Green);
 Input: LowWickColor       (Red);
 var: IntraBarPersist True_High (0);
 var: IntraBarPersist True_Low  (0);
 var: IntraBarPersist T_High_L (0);
 var: IntraBarPersist T_Low_H  (0);
 var:      Brick_Dir  (0);
 
// BRICK DIRECTION
 If BarStatus(1) = 2 then begin
  If High > Open then Brick_Dir =  1;
  If Low  < Open then Brick_Dir = -1;
 End;
// TRACK THE BRICK HIGH AND THE BRICK LOW
 If Brick_Dir = -1 then begin 
  If Close <= Open[1] and Close >= Open then begin  T_High_L = Close; T_Low_H = Close; End;
  If Close <  Open    then begin T_Low_H = Close;   T_High_L = Open;  End;
  If Close >  Open[1] then begin T_Low_H = Open[1]; T_High_L = Close; End;
 End; 
 If Brick_Dir = 1 then begin 
  If Close >= Open[1] and Close <= Open then begin   T_High_L = Close;T_Low_H = Close; End;
  If Close >  Open    then begin T_High_L = Close;   T_Low_H = Open;  End;
  If Close <  Open[1] then begin T_High_L = Open[1]; T_Low_H = Close; End;
 End;
// TRACK THE TRUE HIGH AND THE YRUE LOW
 If True_High < High then True_High = High;
 If True_Low  > Low  then True_Low  = Low;
 
   Plot1(True_High, "BarHigh",HighWickColor ,0,0);
   Plot2(T_High_L , "BarLow ",HighWickColor ,0,0);
   Plot3(T_Low_H  , "BarHigh",LowWickColor  ,0,0);
   Plot4(True_Low , "BarLow ",LowWickColor  ,0,0);
 
// RESET
 If BarStatus(1) = 2 then begin
  True_High = Close;
  True_Low  = Close;
  T_High_L  = Close;
  T_Low_H   = Close;
 End;
//=================================================================================================================

"A dumb man never learns. A smart man learns from his own failure and success. But a wise man learns from the failure and success of others."
Reply With Quote
Thanked by:
  #19 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


diverdan View Post
I thought I would post my cool strategy which started me off on this thread and see if I can improve as per the suggestions.

I ran it on the eur/usd 5 Renko and seemed to test very well.

 
Code
                            
[....] 


Thanks for sharing Diverdan. Is it correct that this strategy generates roughly one trade per day in EUR/USD? Can you tell what ...
 
Code
                            
//Work out session time
SessionTime CalcSessionTime;;
TimeToTrade CalcLondonOpen
are? (Since I don't have those functions).


diverdan View Post
In the middle of updating the strategy to have Renko on chart 2 and Range as the trading chart 1.

Will be interesting to hear what your further studies uncovered.

Attached Thumbnails
Click image for larger version

Name:	renkoExample.png
Views:	357
Size:	38.6 KB
ID:	44664  
Reply With Quote
  #20 (permalink)
 diverdan 
Singapore
 
Experience: Beginner
Platform: Multicharts, R
Trading: EUR / USD
Posts: 185 since Feb 2010
Thanks Given: 106
Thanks Received: 99



Jura View Post
Can you tell what ...
 
Code
                            
//Work out session time
SessionTime CalcSessionTime;;
TimeToTrade CalcLondonOpen
are? (Since I don't have those functions).

Hi Jura

Sorry for the delay in responding, but I have been in Switzerland all week for work and have just got back.

Those two functions are ones I developed. My data is in local PC time and as I switch around time zones (Australia and Singapore) I developed those functions to work out when the London Session opened according to my time zone (taking into account Day Light Saving) and when the FX Session Time started.

You can remove these functions and set them to whatever time you want.

Cheers,

Daniel

Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on October 29, 2017


© 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