allanster

How To Set Backtest Time Ranges


Example how to set the time range window to be backtested for both entries and exits. Additional examples are also included showing how to set the date range and toggle plot visibility.

By incorporating this code with your own strategy's logic, it will allow you to backtest various time windows.

Much gratitude to @LucF and @a.tesla2018 for help with including ':1234567' for time ranges on weekends. Thank you both!


NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
Release Notes: Cosmetic.
Remove from Favorite Scripts Add to Favorite Scripts
Telegram: https://t.me/allanster • Gunbot Tuners: http://www.allanster.com

If you would like to buy me a refreshing beverage :)...

LTC (preferred): LTDaAe7nPzbpBhZVT9o5f9f8M3aZSPa46Y

BTC: 13LhkeXBYrRomVAqbXcoLXHuqMk6Mf7G6N

Comments

500coins
Reply
allanster PineCoders
@PineCoders, thank you, very much appreciated!
Reply
thanks for sharing this script
Reply
allanster blackcat1402
@blackcat1402, thanks for your comment and sorry for delayed response.
Reply
wish to work with my strategy from 10 AM to 02:30 PM only . Please guide me how to code that one
Reply
@iamakp, in script above replace logic for enterLong and exitLong with your own logic.
Reply
Hi @allanster, thanks for this script.
Pls can you show me a way or a script to pin/fix a timeline on the chart? So that let's say i'm on 2012 timeline in Daily timeframe, when i change to 1 hr or lower timeframe, it stays on the same 2012. Please help. I would be waiting for your reply soon. Thanks
Reply
allanster Forexking7
@Forexking7, Pine currently has no ability to control which portion of the chart you are viewing.
Reply
Forexking7 allanster
@allanster, alright, thanks. I appreciate the reply.
Reply
@allanster Thanks for the post.

I was playing around with my strategy to fix the backtest time range part.

Your piece of code for back test time range is what I was exactly looking for and worked perfectly for me.
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