amibroker

HomeKnowledge Base

Getting X, Y co-ordinates of Study()

The following code sample shows how to get date/time (X co-ordinate) and value (Y co-ordinate) of starting and ending point of manually drawn study.

In order to use this sample you need to follow these steps:

  1. open Formula Editor,
  2. paste code below,
  3. press “Apply Indicator”,
  4. draw a trend line on this newly inserted chart pane,
  5. double-click on the trend line to bring up properties dialog
  6. select “SU” as study ID and press OK
PlotC"Price"colorBlackstyleCandle );

trendline Study("SU"GetChartID() );

StartX LastValueValueWhenExRemtrendline), DateTime() ) );
EndX LastValueValueWhentrendlineDateTime() ) );
StartY LastValueValueWhenExRemtrendline), trendline ) );
EndY LastValueValueWhentrendlinetrendline ) );

if( 
StartX == )
  
Title "No trend line drawn - please draw it and use 'SU' as study ID";
else
  
Title "{{NAME}} {{DATE}}n"+
  
"Start at X = " WriteValStartXformatDateTime ) + ", Y = " StartY +
  
"nEnd at X = " WriteValEndXformatDateTime ) + ", Y = " EndY;

No comments yet. Be the first.

Leave a reply