Skip to content

Quick-tip 69 | Why text objects can appear different in a strategy

Quicktip69

A Gold Pass member sent a short program that was designed to update the value of and reposition a test string on the last bar of the chart. The code worked fine when included in an indicator but seemed to have problems when copied into a strategy. Quicktip 69 explains what was happening and how it can be corrected.

The program itself creates a label if one does not exit and then after that repositions and changes the value of the label each time the program runs.

In order to have the strategy calculate every tick, make sure that 'Enable intrabar order generation and calculation' is selected
In order to have the strategy calculate every tick, make sure that ‘Enable intrabar order generation and calculation’ is selected
In indicators, 'Update value intrabar' must be selected
In indicators, ‘Update value intrabar’ must be selected

In order for the text label to be updated every tick the strategy settings need to be updated to ensure that “intrabar order generation and calculation” is selected. This setting is found by clicking Studies-Edit Strategies. Then click the Customize button and select the Calculate tab.  Finally click the “intrabar order generation and calculation” check box.  See the images in the gallery below.

Video explanation of quick-tip 69

Copy the quick-tip 69 TradeStation EasyLanguage code for Gold Pass members

If you are a Gold Pass member you can copy the tutorial code below, please make sure that you are logged in with your Gold Pass user name and password.

 { THIS INDICATOR IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY 
FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION, AND NO WARRANTY IS MADE REGARDING 
ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION IS AT YOUR OWN RISK. THIS INDICATOR AND ASSOCIATED TECHNIQUES 
IS AN EXAMPLE ONLY, AND HAS BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION DOES NOT RECOMMEND 
THAT YOU USE ANY SUCH TRADING STRATEGIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, 
ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF THIS INDICATOR DOES NOT GUARANTEE 
THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.} 

// Namespaces
Using elsystem.drawing;
Using elsystem.drawingobjects;

Var:	  TextLabel Label1( Null );

// Draw a text object on the last bar of the chart
If LastBarOnChart and Label1 = NULL Then
Begin
	Label1 = TextLabel.Create( );
  	Label1.Persist = True; // Persist set to true otherwise the lable would disappear after one tick
  	Label1.Color = Color.orange;
  	Label1.Font = new Font( "Ariel", 20, Fontstyle.Bold );
  	// A BNPoint refers to the absolute bar index (zero-based) of the collection of bars in a chart. 
  	// This is not the same as the BarNumber function or CurrentBar reserved word which count the number 
  	// of bars available for analysis after MaxBarsBack. 
  	Label1.SetPointValue( BNPoint.Create( CurrentBar + MaxBarsBack - 1, H ) );
  	Label1.TextString = C.ToString( ); // Convert the close to a string
  	DrawingObjects.Add( Label1 );
End;

// Update it and keep it on the last bar
// as new bars are formed
If LastBarOnChart Then
Begin
  	Label1.SetPointValue( BNPoint.Create( CurrentBar + MaxBarsBack - 1, H ) );
  	Label1.TextString = C.ToString( );
End;

{ ** Copyright (c) 2022 Markplex Corporation. All rights reserved. ** 
  ** Markplex Corporation reserves the right to modify or overwrite this analysis technique 
     on its https://markplex.com Web site. ** }

THE TRADING APPS, INDICATORS, SHOW ME STUDIES, STRATEGIES AND OTHER PROGRAMS HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, TRADING APPS, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.