Plotting agg variables - futures io
futures io futures trading



Plotting agg variables


Discussion in ThinkOrSwim

Updated
    1. trending_up 908 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. 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)

 
Search this Thread
 

Plotting agg variables

(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
 
Code
period = Aggregation.DAY
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?

Reply With Quote

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(154 thanks from 29 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(111 thanks from 32 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 16 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #2 (permalink)
Dallas, Texas
 
 
Posts: 43 since Jun 2015
Thanks: 2 given, 30 received


aquaticnomad View Post
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
 
Code
period = Aggregation.DAY
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?

Reply With Quote


futures io Trading Community Platforms and Indicators ThinkOrSwim > Plotting agg variables


Last Updated on September 4, 2017


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1500 prizes from Topstep!

February
 

Identifying Setups & Targets Using Profile Charts w/Trevor & Tradovate

Feb 25
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts