Strategy with current, real price when trigger is met ... not OHLC

Solution
Most folks write their strategies to trigger on the close of a bar, not an intra-bar condition, as there is no way to back test against anything but OHLCV values (and tickSize(), actually). You can set the price to be anything you want for backtesting, but again by convention, most folks use OPEN[-1] to catch the first price of the bar immediately following the condition triggering on close.

Just the way it is. ToS does not keep trade by trade history for back testing, and so there is no ability to get prices other than OHLC historically.

-mashume
Most folks write their strategies to trigger on the close of a bar, not an intra-bar condition, as there is no way to back test against anything but OHLCV values (and tickSize(), actually). You can set the price to be anything you want for backtesting, but again by convention, most folks use OPEN[-1] to catch the first price of the bar immediately following the condition triggering on close.

Just the way it is. ToS does not keep trade by trade history for back testing, and so there is no ability to get prices other than OHLC historically.

-mashume
 
Solution
Thank you for the explanation.

Unfortunately, this limitation creates inaccurate P/L values as a lot can happen in 1 minute. A second crucial limitation is lack of futures trading through the API. This may be the end of ToS for me. A shame, as the interface and plotting capabilities are beautiful. :/
 
Since you brought up the TDA API, I'll mention that if you can do some serious programming (the kind that usually isn't free and therefore available on great places like useThinkScript), the TDA API does offer a stream in real time of trade by trade data. You can, conceivably, capture that data and write it to pandas dataframes or some other database and run your aggregations on whatever timeframes you need. I'm not saying that HFT is an easy thing to program, but if that's the direction you're leaning you'll probably need to be proficient in developing your own code well beyond ThinkScript. I've written a bit of code to do some of this but it was never streamlined for efficiency and doesn't really work very well.

As for the inability to trade futures via API, I find that with several (TDA and Alpaca specifically) and wonder whether the CBOE makes it difficult or whether there is some other reason for the lack of futures trading via API... but I can't do anything about it and so I move on.

Best of luck to you, and do let us know if you find someplace good to trade futures via API,
-mashume
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
425 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top