Bars Since (BarsSince) This function can be accessed only in the Toolbox. Bars Since counts the number of bars since a specified event occurred. Example: BarsSince(@XABOVE 11000,1,300) would count the number of bars, up to a maximum of 300, since the selected symbol (@) first crossed above 11000. Like other functions, the Bars Since function facilitates the creation of custom studies. Example: BarsSince( High(@)> HiLevel(@,20,0)[-1],1,400) Parameter Description NEvents Allows the user to specify an occurrence number other than one before the count begins. Max Bars to Search Selects the maximum number of bars to cover.
Set/Reset (SetRst) This function is available on the Add Study window and in the Formula Toolbox. Set/Reset creates a picture of binary data for you, using two conditions. The first condition is displayed as an uptick on a line graph. The line continues on that level until the second condition is satisfied. Then the line returns to its baseline until the first condition occurs again. On a bar graph, the bars change colors to reflect the set and reset conditions. For example: mval := MACD(@,13,26); diff := mval - MACDA(@,13,26,9); SetReset(mval XABOVE 0, diff < diff[-1]) In this example on a bar graph, this formula would color bars when MACD crossed above zero and would stop marking the bars when the difference between the MACD and the MACDA turned down. Example: SetRst(Hour(@)=9,Hour(@)=12) Parameter Description Display Opens a sub-window with display properties: Color = Select a line color. Weight = Type a value for line thickness. Display = Select line style: line, histogram, or dash. ShareScale = Assign a behavior for functions and studies sharing the vertical scale: Auto = System determine whether sharing is feasible. On = Scale is shared regardless of the functions and studies displayed. Off = Scale is not shared. MarkIt Opens the Specify Conditions for Marking Bar window. Condition 1 Formula that defines the condition to return a positive response. Condition 2 Formula that defines the condition to end the response started by the first condition. Use Edges SetRst(Hour(@)=9,Hour(@)=12) with Use Edges will not trip to 1 on a 5min bar chart until the first bar on which it turns is complete the 9:00 bar. It actually returns 1 or true on the bar immediately following the first condition 9:05, hence the term “use edges.” Rather than show true at start of the start condition bar, it waits until the starting condition - start bar is completed. Without Use Edges, it will immediately turn to true when the start condition (Hour(@)=9) bar is first formed.
Custom Study Definitions CQG provides several custom studies that you can use as a basis for your own custom studies. Find preset custom studies on the Add Studies window (click the Studies button on the chart toolbar): Find them on Formula Builder and in the Toolbox:
Creating Trade Systems Description Trade systems provide a way to test trading strategies using past data. Formula components Trade systems are composed of studies and conditions. Formula example AMA(@,ERPeriod,FastPeriod,SlowPeriod)[-1] XABOVE MA(@,Sim,MAPeriod)[-1] Signal is true and initiates a long entry when yesterday’s Adaptive Moving Average crosses over yesterday’s Simple Moving Average Location Formula Builder, Trade Systems window Toolbox Add Study window (ATS and XTS only here) Pre-defined formulas ATS (Auto Trade system) XTS (External Trade system) cqg.AMASamp cqg.StochSample
To e-mail the results of an Auto Run Activating e-mail Click the Setup button and then Auto Run. The Auto Run Market Scan window opens. In the Results section, either enter a name in the Save results to file field or use the drop down to select an existing file. Click the Send EMail check box. Enter the recipient’s e-mail address. Enter your e-mail address. Click Save. Results will be e-mailed after the scan is completed. Results will include the market scan name, portfolio name, and the date and time of both the search start and end. If your results are greater than 200K, you will receive an e-mail that contains notice only and not the scan results.