Print Most Recent Price Bar Statistics (Point-and-Click TradeStation® Strategy)
Original Trading Strategy
Links to the section of the video titled “Using & Customizing the Built-In Strategies in Quagensia T Edition” in which this built-in strategy is covered.
Peer Reviews, Modifications & Responses
Thanks for Sharing!
Trading Strategy Summary
This strategy prints out common price bar statistics for the most recent price bars of an instrument to the EasyLanguage® Print Log.
You can quickly and easily use this strategy for a faster way to obtain price bar statistics than manually interacting with the price bars in a TradeStation® chart then manually entering open, high, low, and close price values into a calculator to calculate the statistics manually.
You can also easily add your own price bar statistics to this strategy without code by simply clicking choices on a screen as you would verbally describe your price bar statistics by following the instructions in the message near the bottom of this Quagensia Strategy.
The “Print Most Recent Price Bar Statistics” strategy helps you create *other* Quagensia Strategies that allow you to test some interesting price action that you see at the right edge of a price chart that your intuition tells you is probably bullish or bearish.
You can determine if some price action was bullish, bearish, or non-predictive in the past for a particular instrument or for all similar instruments, for instance every stock in the S&P 500, by quickly creating a Quagensia Strategy based on the price bar statistics you copy and paste from the “Print Most Recent Price Bar Statistics” strategy’s price bar statistics in the EasyLanguage® Print Log. Then you can generate the custom Quagensia Strategy’s code and copy it to the clipboard with the click of a button, then paste this strategy’s code into TradeStation® and run a backtest of your strategy from within TradeStation® by applying the strategy to a chart in TradeStation®.
This strategy is meant to reduce the time it takes to create a Quagensia Strategy whose entry or exit logic uses common price bar statistics by printing them out to the EasyLanguage® Print Log. You can then copy and paste the statistical values of interest from the EasyLanguage® Print Log to a text box in Quagensia or you can use the statistical values of interest to help you determine a good minimum and maximum value for the statistic that you decide would identify another price bar in the backtest as being similar to a price bar at the right edge of the chart whose statistics this strategy prints to the EasyLanguage® Print Log.
You can open the EasyLanguage® Print Log from TradeStation®’s main window by clicking on “VIEW” on the main menu and then “EasyLanguage® Print Log”.
Note that the outputted data is formatted in the ideal way for consumption by a trading strategy within TradeStation® rather than being formatted in a way that numbers are formatted in the part of the world where you live. For instance, the number 1,234.56 is ideally formatted for someone in the US and the number 1.234,56 is ideally formatted for most people in Europe, but TradeStation® code needs this number to be written like 1234.56, i.e. without thousands separators of any kind and using the period ( . ) character as the decimal separator.
This strategy does not place orders. It merely prints out information to save you time by avoiding manual calculations. It is meant to be run as a backtest only, not in a live trading environment.
Here is an example of what this strategy prints out for each of the most recent price bars of an instrument on a TradeStation® chart:
11/11/2021 3:00:00 PM (Bar End Date and Time as Julian Date and Time)
2021-11-11 15:00:00 (Date and Time (Quagensia Format, for Pasting into Quagensia))
Date and Time as Julian Date and Time Decimal: 44511.6250000000000000000000000000000000000000
EL Date: 1211111
EL Time: 1500
Open: 465.21
High: 465.29
Low: 463.75
Close: 463.77
Volume (For Daily (And Above) Time-Based Bars): 34848733
“Ticks” (i.e. Volume For All Except Daily (And Above) Time-Based Bars): 34848733
Median ((H + L)/2): 0.770
High – Low: 1.54
Close – Prev Close: 0.15
Close – Open: -1.44
Open – Prev Close: 1.59
Close – Low: 0.02
High – Close: 1.52
Open – Low: 1.46
High – Open: 0.08
Pct Diff (Low to High) ((H – L)/L) (0.10 is 10%): 0.00332075
Pct Chg (Prev Close to Close) (0.10 is 10%): 0.00032354
Pct Chg (Open to Close) (0.10 is 10%): -0.00309538
Pct Chg (Prev Close to Open) (0.10 is 10%): 0.00342953
Close as Pct of High – Low, from Low (0.10 is 10% Between the Low and High, Closer to the Low): 0.01298701
Close as Pct of High – Low, from High (0.10 is 10% Between the High and Low, Closer to the High): 0.98701299
Open as Pct of High – Low, from Low (0.10 is 10% Between the Low and High, Closer to the Low): 0.94805195
Open as Pct of High – Low, from High (0.10 is 10% Between the High and Low, Closer to the High): 0.05194805
True Range (Max Diff Between H, L, and Prev Close): 1.67
ATR(14): 3.28357143
Ratio of True Range to ATR(14): 0.50859256
Add your custom price bar statistic here, and add many more price bar statistics beneath this one: 0.15
If you will only be running this strategy as-is, i.e. if you will not be adding your own custom price bar statistics to the output, the value in the “Maximum number of bars study will reference” field in TradeStation®’s “Strategy Properties for All Strategies on this Chart” window can be as low as the higher of 1 + the “Number of Most Recent Bars to Include” input parameter and 1 + the “ATR Period” input parameter. To open the “Strategy Properties for All Strategies on this Chart” window from the TradeStation® user interface, click on the “Properties for All…” button in the “Customize Studies & Strategies” window, which is the window that shows the list of strategies being applied to the chart or about to be applied to the chart which opens whenever you add or edit a TradeStation® strategy. If you will be running this strategy with your own custom price bar statistics, the value in the “Maximum number of bars study will reference” field will likely have to be larger to account for things like a 10-period simple moving average needing at least 10 price bars of initial data before it can provide a valid result for a given price bar. The larger you make this number, the less likely you will experience run-time errors or logic errors, but the more initial price bars will be required before the first price bar will be considered for inclusion in the results outputted by this strategy.
WARNING: THIS STRATEGY IS NOT INTENDED FOR CHARTS OF BARS WITH SUB-SECOND TIME FRAMES, INCLUDING TICK CHARTS. This is due to the following reason: If the last bar on the chart has the same time stamp as one or more previous bars up to and including the seconds component, as could occur with tick-based charts and other non-time-based charts that can contain more than one bar per second, the first bar with the same time stamp as the last bar on the chart, up to and including the seconds component, will be identified as being the last bar on the chart by EasyLanguage®’s LastBarOnChartEx keyword, which is what Quagensia T Edition’s “Bar Is Last Bar On Chart (Considers Seconds)” function uses to identify the last bar on the chart. In this scenario, the output would be not be printed for ticks or other sub-second bars occurring after the first tick or sub-second bar with the same time stamp, up to and including the seconds component, of the last tick or sub-second bar on the chart.
Copyright © 2023 Quagensia, Inc. All rights reserved.
How to Get the Quagensia Strategies
This point-and-click trading strategy is built into Quagensia T Edition (for TradeStation®).
Customize Quagensia Strategies with Your Own Ideas
Tweaking Quagensia Trading Strategies using point-and-click with the Quagensia Desktop Application is easy for non-programmers. If you get stuck you can usually find the answer you need in our online help documentation or you can ask a question in our friendly Discord community.
If you don’t want to tweak a Quagensia Trading Strategy with point-and-click to add your own proprietary trading logic, you can still download a Quagensia Trading Strategy file, open it up in the Quagensia Desktop Application, and generate its code, then backtest and optimize the trading strategy on different instruments, different bar periods (weekly bars, daily bars, hourly bars, 15-minute bars, etc.), or different bar types (time-based bars, volume-based bars, tick-based bars, etc.), and use different start and end dates.
Some tweaks you can make to the Quagensia Trading Strategies you download include:
Modify the entry & exit logic.
- Add more conditions, remove conditions, or change them by choosing from among a very large number of components, including many exotic indicators.
- Add or modify stop losses, trailing stops, and profit targets. Make them tighter, less tight, or based on an entirely different calculation.
- Add or modify time stops. For example, exit after a certain number of bars either unconditionally or only if the post-entry price action did or did not exhibit certain characteristics.
Enhance the output of the strategy to go beyond simply placing orders.
- Draw lines, shapes, and text on the chart. For instance, you can mark times or prices where each entry or exit condition of a multi-condition entry or exit was true, even if all the necessary entry or exit conditions were not true at the same time so an entry or exit did not occur.
- Write information to NinjaTrader®’s NinjaScript® Output window or TradeStation®’s EasyLanguage® Print Log window.
- Write information to a file. You can even output a report that can be opened in Microsoft Excel or consumed by another application that reads comma-delimited, semicolon-delimited, or otherwise character-delimited tabular data files.


