Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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.
Can you help answer these questions from other members on NexusFi?
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."
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.
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) ;
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.
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."
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.
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."
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."
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."