date-time in SC Spreadsheet Study for backtesting - simple buy/sell rules Q - Sierra Chart | futures io social day trading
futures io futures trading


date-time in SC Spreadsheet Study for backtesting - simple buy/sell rules Q
Updated: Views / Replies:47 / 2
Created: by ClutchAce Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

date-time in SC Spreadsheet Study for backtesting - simple buy/sell rules Q

  #1 (permalink)
Trading Apprentice
Cookeville, TN
 
Trading Experience: Advanced
Platform: R|Trader, Thinkorswim
Favorite Futures: CL, RB, 6E, ZB, DX
 
Posts: 49 since Oct 2011
Thanks: 11 given, 16 received

date-time in SC Spreadsheet Study for backtesting - simple buy/sell rules Q

Hi, I'm trying to make a simple trading rule in the Spreadsheet System for Trading. Basically, in a sheet with 60-min bars, I want to buy at the ask at the top of every hour starting at 15:00:00 and ending at 21:00:00, and likewise sell at the bid at the bottom of each hour, starting 15:59:59 and ending at 21:59:59. My first inkling of an idea was to use an =IF() statement for columns K & L ('Buy Entry' & 'Buy Exit (Sell)'), going off of SC's documentation for the TIME() function, like this for example of a Buy Entry in K3:

=IF(AND(FRACTIME(A3)>=TIME(14, 59, 59, 750), FRACTIME(A3)<TIME(15, 59, 59, 950)),1,0)

I'm confused as to what to put in subsequent rows, and even this one, since the time stamp in column A will be changing and I'm making an explicit time range in the example.

A simpler approach *if backtesting wasn't planned* seems to just be a compound conditional statement using the NOW() date-time function, but that function is truly 'now' and has no linkage to a historical clock loop cycle, according to Sierra staff (I'm paraphrasing).

Any idea on cracking this riddle? I've been doing some intermediate-level strategy writing with the spreadsheets, but nothing with time logic like this.

Reply With Quote
 
  #2 (permalink)
Elite Member
Phoenix AZ USA
 
Trading Experience: Advanced
Platform: SierraChart
Broker/Data: TradePro/TransAct
Favorite Futures: NQ YM
 
Posts: 332 since Nov 2009
Thanks: 142 given, 404 received

There is no way to enter/exit at specific times of day. This is because the chart's time only advances when there is a chart update. You can observe this in J41. The same is true if you use the NOW() function.
The best you can do is bracket a time window that is wide enough so that a chart update occurs between it. In a slow market, this window would need to be wider than in a fast market.

However, since you want to enter at the open of a 60min bar and exit at its close, you can avoid the time window. Try this:

For exits:
- Use a formula like this in L3:
=AND(MROUND(FRACTIME(A3),1/86400)>=TIMEVALUE("15:00:00"),MROUND(FRACTIME(A3),1/86400)<=TIMEVALUE("21:00:00"))
This removes the floating point errors from the timestamp by rounding it to 1 second, and places a 1 in seven consecutive rows at 15:00 to 21:00.
(You don't need to use the IF function if the result is boolean.)

For entries:
- Use a formula like this in K3:
=AND(L3,$J$8=0)
This places a 1 in the same rows as the exits and waits until you are flat to enter.

Use the spreadsheet study settings in the attached.
Since entries are intrabar, they occur at the open, and exits then occur at close of bar.

Attached Thumbnails
date-time in SC Spreadsheet Study for backtesting - simple buy/sell rules Q-ss-settings.png  

Last edited by tomgilb; April 8th, 2019 at 01:26 PM.
Reply With Quote
The following 2 users say Thank You to tomgilb for this post:
 
  #3 (permalink)
Trading Apprentice
Cookeville, TN
 
Trading Experience: Advanced
Platform: R|Trader, Thinkorswim
Favorite Futures: CL, RB, 6E, ZB, DX
 
Posts: 49 since Oct 2011
Thanks: 11 given, 16 received


That'll do it. Thank you for helping, Tom!

Reply With Quote

Reply



futures io > > > > date-time in SC Spreadsheet Study for backtesting - simple buy/sell rules Q

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

Donít Let One Bad Trade Wipe Out Your Entire Account w/GFF Brokers

Apr 23
 

New CME Micro Indices: New Trading Opportunities w/FuturesTrader71

Elite only
 

Benefits of Trading the Micro E-Minis w/Stage 5 & CME Group

Apr 30
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
what should I put in the buy exit or sell exit cell in spreadsheet if I want to clos hmgl Sierra Chart Programming 5 February 15th, 2017 07:52 PM
Rewriting DATE NEXT BAR <> DATE - Simple Help fiverr Traders Hideout 7 May 11th, 2016 05:56 AM
Rollover date vs Expiration date grego Currency Futures 3 March 10th, 2014 06:03 AM
Color bar study always outputting 0 to spreadsheet study vegasfoster Sierra Chart 2 January 3rd, 2013 12:30 PM
'From' date needs to be smaller than 'To' date DavidHP NinjaTrader Programming 2 January 3rd, 2010 10:09 PM


Tags
amp, backtesting, bracket, buy, conditional, dow, es, intrabar, sierra chart, sierra_chart, spreadsheet trading, spreadsheets, strategy, top, trading, update

All times are GMT -4. The time now is 08:26 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, 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
Page generated 2019-04-25 in 0.13 seconds with 14 queries on phoenix