NexusFi: Find Your Edge


Home Menu

 





Close of Previous Day on Custom Indicator?


Discussion in ThinkOrSwim

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




 
Search this Thread

Close of Previous Day on Custom Indicator?

  #1 (permalink)
 jngrim 
new york, ny/usa
 
Experience: Beginner
Platform: nt
Trading: futures
Posts: 128 since May 2012
Thanks Given: 32
Thanks Received: 50

Does anyone know how to map the precious close of a custom indicator onto the next session? I attempted a counting loop and that didn't give me what I needed. I tried to modifiy the existing study changing the locations of close(period = aggregationPeriod)[-1]) to my variable x, but it appears that TOS doesn't accept aggregation periods for a variable. I tried counting from open but that didn't work either. I also tried to store the last barnumber but TOS does not use sequential numbering.
Can someone help? thanks All I am trying to do is color the current days x indicator value on whether the indicator is above or below yesterday's x closing value

 
Code
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;
plot PrevDayClose;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) { PrevDayClose = Double.NaN;
} else { PrevDayClose = Highest(close(period = aggregationPeriod)[-displace], length);
}

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
What broker to use for trading palladium futures
Commodities
Cheap historycal L1 data for stocks
Stocks and ETFs
About a successful futures trader who didnt know anythin …
Psychology and Money Management
REcommedations for programming help
Sierra Chart
 
  #2 (permalink)
 
SONofANARCHY's Avatar
 SONofANARCHY 
dana point
 
Experience: Master
Platform: tos
Broker: amp
Trading: es cl gc nq
Posts: 2 since Nov 2016
Thanks Given: 0
Thanks Received: 1


jngrim View Post
Does anyone know how to map the precious close of a custom indicator onto the next session? I attempted a counting loop and that didn't give me what I needed. I tried to modifiy the existing study changing the locations of close(period = aggregationPeriod)[-1]) to my variable x, but it appears that TOS doesn't accept aggregation periods for a variable. I tried counting from open but that didn't work either. I also tried to store the last barnumber but TOS does not use sequential numbering.
Can someone help? thanks All I am trying to do is color the current days x indicator value on whether the indicator is above or below yesterday's x closing value

 
Code
input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;
plot PrevDayClose;
if showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1]) { PrevDayClose = Double.NaN;
} else { PrevDayClose = Highest(close(period = aggregationPeriod)[-displace], length);
}



input Period = AggregationPeriod.DAY;
def YestClose = close(period = Period)[1];

X.assignValueColor(if X >= YestClose then color.green else color.red);


Something like that?

Reply With Quote
Thanked by:
  #3 (permalink)
 jngrim 
new york, ny/usa
 
Experience: Beginner
Platform: nt
Trading: futures
Posts: 128 since May 2012
Thanks Given: 32
Thanks Received: 50



SONofANARCHY View Post
input Period = AggregationPeriod.DAY;
def YestClose = ;

X.assignValueColor(if X >= YestClose then color.green else color.red);


Something like that?

So I tried that and while it works on main charts is doesn't seem to work on lower charts with variable..

For example say, I have a lower study that tracks the /DX against /ES..

declare lower;
input aggregationPeriod = AggregationPeriod.DAY;
input showOnlyLastPeriod = no;

def x=if GetSymbol()==/ES then close("/DX") else double.nan;

#this line I use to this trigger the location of the close
def ValueClose=if (showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1])) then
double.NAN
else
#what do I put since I want to use the previous close value of x instead of actually
?
close("/DX",period = aggregationPeriod)[1]


what I would like to is color the x based on the previous close valce of x.

Started this thread Reply With Quote
  #4 (permalink)
devildriver6
Dallas, Texas
 
Posts: 43 since Jun 2015
Thanks Given: 2
Thanks Received: 32


jngrim View Post
So I tried that and while it works on main charts is doesn't seem to work on lower charts with variable..

For example say, I have a lower study that tracks the /DX against /ES..

declare lower;
input aggregationPeriod = AggregationPeriod.DAY;
input showOnlyLastPeriod = no;

def x=if GetSymbol()==/ES then close("/DX") else double.nan;

#this line I use to this trigger the location of the close
def ValueClose=if (showOnlyLastPeriod and !IsNaN(close(period = aggregationPeriod)[-1])) then
double.NAN
else
#what do I put since I want to use the previous close value of x instead of actually
?
close("/DX",period = aggregationPeriod)[1]


what I would like to is color the x based on the previous close valce of x.




Okay, so, not to be rude, but this all seems unnecessarily complicated.
Let me try to understand what you're intentions are here.....

You're trying to do what exactly? Compare the current price of /DX versus yesterday's close?
And then plot that as a lower study on an /ES chart?

Reply With Quote
  #5 (permalink)
 jngrim 
new york, ny/usa
 
Experience: Beginner
Platform: nt
Trading: futures
Posts: 128 since May 2012
Thanks Given: 32
Thanks Received: 50


devildriver6 View Post
Okay, so, not to be rude, but this all seems unnecessarily complicated.
Let me try to understand what you're intentions are here.....

You're trying to do what exactly? Compare the current price of /DX versus yesterday's close?
And then plot that as a lower study on an /ES chart?

Yes intraday price action against yesterdays close... Actually I just figured it out. I had a and extra parenthesis.

thanks for the help guys!!

Started this thread Reply With Quote




Last Updated on February 25, 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