Trading Articles
Article Categories
Article Tools
Plotting agg variables
Updated September 4, 2017
trending_up
908 views
thumb_up
0 thanks given
group
2 followers
forum
1 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
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 and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
(login for full post details)
#1 (permalink )
Los Angeles CA
Posts: 2 since Jun 2017
Thanks: 0 given,
0
received
Trying to render multiple plots of a given variable throughout different aggregations.
Working with standard code for Ichimoku indicator. Lets get into it:
Code
input tenkan_period = 9;
input kijun_period = 26;
plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
plot "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
plot "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
plot Chikou = close[-kijun_period];
rec spanALast = CompoundValue(1, if IsNaN(close[-1]) and !IsNaN(close) then "Span A"[-kijun_period] else spanALast[1], Double.NaN);
rec spanBLast = CompoundValue(1, if IsNaN(close[-1]) and !IsNaN(close) then "Span B"[-kijun_period] else spanBLast[1], Double.NaN);
plot trackSpanA = spanALast;
This plots the ichimoku indicator as well as drawing a horizontal line of the value of SPAN A for whichever time frame chart you are on. What I would like to add next is an additional plot of SPAN A's value for a different time frame.
I know that you can use
to reference different time frames, but I don't know how to point that aggregation to a specific value to be plotted.
Can anyone point me in the right direction?
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#2 (permalink )
Dallas, Texas
Posts: 43 since Jun 2015
Thanks: 2 given,
30
received
aquaticnomad
Trying to render multiple plots of a given variable throughout different aggregations.
Working with standard code for Ichimoku indicator. Lets get into it:
Code
input tenkan_period = 9;
input kijun_period = 26;
plot Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
plot Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
plot "Span A" = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
plot "Span B" = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
plot Chikou = close[-kijun_period];
rec spanALast = CompoundValue(1, if IsNaN(close[-1]) and !IsNaN(close) then "Span A"[-kijun_period] else spanALast[1], Double.NaN);
rec spanBLast = CompoundValue(1, if IsNaN(close[-1]) and !IsNaN(close) then "Span B"[-kijun_period] else spanBLast[1], Double.NaN);
plot trackSpanA = spanALast;
This plots the ichimoku indicator as well as drawing a horizontal line of the value of SPAN A for whichever time frame chart you are on. What I would like to add next is an additional plot of SPAN A's value for a different time frame.
I know that you can use
to reference different time frames, but I don't know how to point that aggregation to a specific value to be plotted.
Can anyone point me in the right direction?
To plot variable timeframes, you have to adjust the coding as follows....
first, add adjustable TF....
then, adjust "close" to show that TF....
any coding that goes into the adjustable TF has to be fixed as well.... So, for Span A, you have to correct the Tenkan and Kijun coding....
input Period1 = aggregationPeriod.DAY;
input Period2 = aggregationPeriod.WEEK;
def Period1_Tenkan = (Highest(high(Period = Period1) , tenkan_period) + Lowest(low(Period = Period1) , tenkan_period)) / 2;
def Period1_Kijun = (Highest(high(Period = Period1) , kijun_period) + Lowest(low(Period = Period1) , kijun_period)) / 2;
plot Period1_SpanA = (Period1_Tenkan [kijun_period] + Period1_Kijun [kijun_period]) / 2;
def Period2_Tenkan = (Highest(high(Period = Period2) , tenkan_period) + Lowest(low(Period = Period2) , tenkan_period)) / 2;
def Period2_Kijun = (Highest(high(Period = Period2) , kijun_period) + Lowest(low(Period = Period2) , kijun_period)) / 2;
plot Period2_SpanA = (Period2_Tenkan [kijun_period] + Period2_Kijun [kijun_period]) / 2;
Now, the Kijun and Tenkan are looking for highs and lows from your input value, which is day and week.
Then, your different SPAN A's are using the adjusted TF values accordingly.
Make sense?
Last Updated on September 4, 2017
Right now
Ongoing
Right now
February
Register to Attend
Feb 25
Coming soon
March