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 have an ThinkScript (ThinkOrSwim Platform) indicator that I created… how do I make it so it only calculates this indicator that I made on bar close and NOT every tick. It is a 1min chart. Thanks.
Update: I found this command: declare once_per_bar; but, it doesn't seem to consistently process the code in the indicator at the end of each bar... perhaps because I'm using 1m bars.
Any tips or guidance is appreciated.
Can you help answer these questions from other members on NexusFi?
If I understand you right....I tried that but then it makes it one bar late...
The way I have it now for example:
def main = close("/ES");
def bullsigna1 = main > main[1];
Now if I use this at the top of the code: declare once_per_bar;
it does seem to test the indicator once per bar but not consistently at the same time... ie. at the close of the current bar.
And if I don't use that declaration... it tests the indicator each tick.
Now... if I use this code:
def bullsigna1 = main[1] > main[2];
Then obviously, the indicator is now lagging inherently by 1 bar...
Question is [0] the same as the current bar or is [0] referencing the last "closed" bar?
ie. is def bullsigna1 = main[0] > main[1]; what you're talking about?
This looks promising... of course the market is closed now and I gotta wait until Sunday Night / Monday morning to test - lol.
When you say be a candle behind... you mean behind only the CURRENT bar - right? ie. say it's a 2min chart... it will be as current as the last closed bar... but not really "behind" in the context of what I'm trying to accomplish?
and in your example: plot signal = INDICATOR and !INDICATOR[-1];
isn't INDICATOR the current bar?
And !INDICATOR[-1] is the future bar?
So, how would that accomplish what I'm trying to make happen... with the indicator not getting processed until the end of the current bar? The future bar isn't even and shouldn't be... considered anyways... and using INDICATOR... would still have the indicator updating each tick, which is what I don't want? Not trying to be a jerk... just asking.
And how is the set of code you just gave... different than the other one: Def CURRENT= isnan(close[-1]) and !isnan(close);
I'm trying to just have the indicator process or be ran at the very end of the current candle... ie. not tick for tick throughout that candle's timeframe.
It could also process the indicator at the very beginning of the new candle for the previous candle... but needs to happen immediately on the new candle.
Yea correct, this will only show on the previous bar that just closed, so only 1 bar behind.
The !indicator[-1] IS for the future bar, however the “!” In front of it means, “not true” for the next bar.
As far as the Isnan code, that you would use if you wanted your signal to appear on the CURRENT bar, not the PREVIOUS (which is the code i just provided). Hope that makes sense...im still new in coding but had the same issue and these codes worked for me