melihtuna

Backward Number of Bars

This indicator was written in order to apply bar limit in strategies and it was published as open code so that everyone can use it. When backtesting with stock market api data, we determine how many bars should be, not from which date the data will be drawn. For example, we can draw 1000 bar data from stock exchange and perform the backtest on this data. You can plan your strategy by checking the number of bars you test with the window () == 1 parameter here while checking through Tradingview to check that the test we performed gives correct results.



Remove from Favorite Scripts Add to Favorite Scripts

Comments

Can anyone explain/correct why this won't work on a 1 minute chart? I'm need a script that will change the background (whether the "background" is the background function, histogram etc.) for the most recent 5 bars on a 1 minute chart. I'm having a heck of a time figuring out how to script it!! 'any help would be MUCH appreciated!! this script works on the H1 and D1, but not on the smaller time frames for some reason....
Reply
1,000 thank yous! This was breaking my brain. had like 12 ideas and I couldn't get any of them to work as good as this. lol. You win my friend! thanks for sharing!
Reply
Hi @melihtuna - this is the method I've used in the past as well. The problem I run into is that it only works for instruments that trade 24/7. I've been racking my brain trying to come up with a method to accomplish the same thing for things like traditional equities (with or without extended sessions) and have gotten SO close a few times, but nothing perfected yet. Do you have any ideas? I'd be happy to share the "dead-ends" I've already attempted.
Reply
Very ingenious! Congrats.
Reply
@LucF, thx :)
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out