NexusFi: Find Your Edge


Home Menu

 





accumulated up and down volume on renko chart


Discussion in TradeStation

Updated
    1. trending_up 5,395 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread

accumulated up and down volume on renko chart

  #1 (permalink)
PippiLong
Dallas, TX
 
Posts: 7 since Jul 2012
Thanks Given: 1
Thanks Received: 0

I am new to Easy Language (and this site). I am trying to print a text object at the top of an upwave on a renko chart in Tradestation that is the total volume of all of the up bars in that wave. Also want to print a total at the bottom of a down wave. I can calculate the number, however I can't figure out how to print as a text object the right number above the right bar because the only difference I see in the top most bar from the other up bars is that the next bar closes lower than the top bar but I can't reference a bar in the future.

Ultimately I would also like to print the total minutes in the up and down wave but got stopped at the above problem. Any help would be greatly appreciated.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
About a successful futures trader who didn´t know anyth …
Psychology and Money Management
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
  #2 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


PippiLong View Post
I am new to Easy Language (and this site). I am trying to print a text object at the top of an upwave on a renko chart in Tradestation that is the total volume of all of the up bars in that wave. Also want to print a total at the bottom of a down wave. I can calculate the number, however I can't figure out how to print as a text object the right number above the right bar because the only difference I see in the top most bar from the other up bars is that the next bar closes lower than the top bar but I can't reference a bar in the future.

Ultimately I would also like to print the total minutes in the up and down wave but got stopped at the above problem. Any help would be greatly appreciated.

I can't help you with the text object, but in a simple indicator.....

variables: direction(0), wavevolumeup(0), wavevolumedn(0);

if close > close[1] then direction = 1;
if close < close[1] then direction = -1;

if direction = 1 then begin
wavevolumedn = 0;
wavevolumeup = upticks;
wavevolumeup = wavevolumeup + wavevolumeup[1];
end;

if direction = -1 then begin
wavevolumeup = 0;
wavevolumedn = downticks;
wavevolumedn = wavevolumedn + wavevolumedn[1];
end;

this will give you the total volume for each up string and each down string and print along the way for each bar.

"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:
  #3 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


As far as keeping track of the time,

You can use a similar approach, but you'll have to convert the timestamp to a string. (there's several methods for this, just reference the help index for the reserved functions).

You'll have to reference the previous close from a new change bar..

if direction <> direction[1] then starttime = time[1];
totaltime = time - starttime;

this is of course, after converting the time to a string (for runs that cross over midnight and over weekends, 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
  #4 (permalink)
PippiLong
Dallas, TX
 
Posts: 7 since Jul 2012
Thanks Given: 1
Thanks Received: 0

Thank you very much for the reply. I appreciate it very much. I think I got to the same place. However where I am stuck is how to only print the total at the last high or low bar of each wave and not at each bar. The following code prints it at each bar which I think is similar to yours.






inputs:
UpColor(darkGreen),
DnColor(darkred),
ScaleVolBy(100);

vars:
up(0),
dn(0),
vol(0),
UpWavevolume (0),
DnWavevolume (0);



vol=upticks+downticks;

if c>o then begin
if dn>0 then up=vol else up=up+vol;
dn=0;
end;

if c<o then begin
if up>0 then dn=vol else dn=dn+vol;
up=0;
end;

UpWavevolume= up * Reciprocal(ScaleVolBy);
DnWavevolume= dn * Reciprocal(Scalevolby);

IF up>0 then begin
Value1 = Text_New(Date, Time, High + Range * 1.5, Numtostr(upwavevolume,0));
Text_SetColor(Value1, UpColor);
Text_setstyle(Value1, 2, 1);

end;

IF dn>0 then begin
Value1 = Text_New(Date, Time, Low - Range * 1.5, Numtostr(DnWavevolume,0));
Text_SetColor(Value1, DnColor);
Text_setstyle(Value1, 2, 0) ;

end;

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


PippiLong View Post
Thank you very much for the reply. I appreciate it very much. I think I got to the same place. However where I am stuck is how to only print the total at the last high or low bar of each wave and not at each bar. The following code prints it at each bar which I think is similar to yours.






inputs:
UpColor(darkGreen),
DnColor(darkred),
ScaleVolBy(100);

vars:
up(0),
dn(0),
vol(0),
UpWavevolume (0),
DnWavevolume (0);



vol=upticks+downticks;

if c>o then begin
if dn>0 then up=vol else up=up+vol;
dn=0;
end;

if c<o then begin
if up>0 then dn=vol else dn=dn+vol;
up=0;
end;

UpWavevolume= up * Reciprocal(ScaleVolBy);
DnWavevolume= dn * Reciprocal(Scalevolby);

IF up>0 then begin
Value1 = Text_New(Date, Time, High + Range * 1.5, Numtostr(upwavevolume,0));
Text_SetColor(Value1, UpColor);
Text_setstyle(Value1, 2, 1);

end;

IF dn>0 then begin
Value1 = Text_New(Date, Time, Low - Range * 1.5, Numtostr(DnWavevolume,0));
Text_SetColor(Value1, DnColor);
Text_setstyle(Value1, 2, 0) ;

end;

hmmm, the only way you'll accomplish this is to print the total for the previous wave at the beginning of the next wave. Because you're using Renko, there's no need to separate upticks and downticks, the chart will only reference upticks for up bars and downticks for down bars, the values for the opposite volume will be zero, but you'll have to split the up and down waves because that's the only way to get the individual totals without losing a bar upon the rest.

try this....

variables: direction(0), wavetotal(0), waveup(0), wavedn(0);

if close > open then direction = 1 else direction = -1;

if direction = 1 then begin
wavedn = 0;
waveup = upticks;
waveup = waveup + waveup[1];
end;

if direction = -1 then begin
waveup = 0;
wavedn = downticks;
wavedn = wavedn + wavedn[1];
end;

wavetotal = 0;
if direction > direction[1] then wavetotal = wavedn[1];
if direction < direction[1] then wavetotal = waveup[1];

plot1(wavetotal);


This should print the wavetotal only upon a change in direction, but it will be the volume for the previous wave.

If you're printing, I'd imagine you don't want the extra/noisy values of all the running volume values in the middle of the string.

This is the only option (to print upon a new string for the previous string's value) simply because the chart has no way of knowing that it's the end of a wave until the bar is closed/a new bar in the opposite direction has already begun. In essence, there's no way for any algorythm to know that the current bar is the end of the string (until it's already passed).

So your two choices are to print the running total on all bars in a string (which I'm sure is a bunch of extra data you're not interested in, making the files large) OR to print only once per string, but a bar delayed (at the beginning of a new string) which references the previous strings total.

"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:
  #6 (permalink)
PippiLong
Dallas, TX
 
Posts: 7 since Jul 2012
Thanks Given: 1
Thanks Received: 0

Yay! It works. I had tried printing the total for the previous bar over the next bar but I kept getting the wrong volume on top of the next bar. So for some reason referencing the prior bars accum vol worked this time but I would not have been able to do it without your example. So THANKS.

For some reason your code was giving me a different accumulated volume but I honestly can not tell why so I just used my previous code and changed the condition for the printing of the up direction to

If C < Open and upwavevolume[1] <> 0 (without the second condition the other bars printed 0)

and added the [1] to the numtostr(upwavevolume[1] so the prior bar's value would print.

Thanks

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

Glad to help....

I recommend artificially creating the renko bars instead of using the standard renko chart.

If you us Kase bars and artificially replicate the renko on top, not only will you be able to see the true high/low (and all the movement inside the bar) but you'll also be able to see the other volume component.

Additionally, with renko, you're not going to see gaps...so if there's a gap that's larger than your renko instrument, it's simply going to create a new bar(s) in the gap, which can be troublesome for a number of reasons.

I have the artifical renko paintbar and indicator if you're interested.

"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
  #8 (permalink)
PippiLong
Dallas, TX
 
Posts: 7 since Jul 2012
Thanks Given: 1
Thanks Received: 0

Yes please send me the indicator. think that would be helpful to be able to see the high and low. I would like to take a look. Thank you very much.

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

Input:
FirstBrickHi(9523), // to syncronize with a base renko chart
Bricksize(10),
upcolor (rgb(185,255,185)), // light green
dwcolor (rgb(255,185,185)) ; // light red
Vars:
hiline(0),
loline(0),
direction(0);


// FIRST BRICK at the first bar of graph

If currentbar = 1 then
begin
If high > open then
begin
hiline= FirstBrickHi + bricksize ;
loline= hiline - bricksize ;
direction = 1;
end;
If low < open then
begin
loline= FirstBrickHi - bricksize;
hiline= loline + bricksize;
direction = -1;
end;
end;

// ALL OTHER BRICKS

If low <= loline - bricksize then
begin
direction = -1;
hiline= loline;
loline = loline - bricksize;
end;

If high >= hiline + bricksize then
begin
direction = 1;
loline = hiline;
hiline = loline + bricksize;
end;

// PLOTTING

If direction = 1 then Plotpaintbar(hiline,loline,"renko",upcolor) else
Plotpaintbar(hiline,loline,"renko",dwcolor) ;

"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
  #10 (permalink)
 RM99 
Austin, TX
 
Experience: Advanced
Platform: TradeStation
Trading: Futures
Posts: 839 since Mar 2011
Thanks Given: 124
Thanks Received: 704


Paste into a paintbar.

Open up the Renko chart you're attempting to replicate.

Now open a Kase chart with a smaller increment (preferably no more than half the desired Renko increment).

Insert paintbar. Input the high of the first bar on the real renko chart into the paintbar settings (ensure that the start dates for each chart match).

You can mess around with the R/B/G colors to your liking, I usually make the bricks fully red and fully green and then make my kase bars yellow, to contrast.

You can also take the body of the code minus the plot and use it to craft indicator values.

This will allow you to see true highs/lows, see intrabar movement and also see gaps. It will also allow you to execute intrabar (with respect to the renko brick) although it will be at the end of a Kase bar...so the smaller the Kase bars, the more closely you can approximate intrabarordergeneration. (although it does require a lot of processing power).

"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




Last Updated on July 23, 2012


© 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