This post focuses on a very powerful feature of Amibroker - the ability to identify hand drawn trendline breakouts.
Following chart is of INFY and I have drawn 3 trendlines... the red is for resistance (RE), blue for support (SU) and the black line is the standard trendline (TE).
For various reasons, you may want to know when the stock crosses the resistance or breaks the support or crosses the black trendline.
The trick is to label each line as a STUDY. Built-in study functions are RE,SU,UP,DN and ST. In addition, you can define your own using any 2 alphabets.
Double clicking the line will throw up the dialog box... this is where you set the color and define the STUDY ID.
Now I need something called ChartID.... I get this by right clicking anywhere on the chart and opening the Parameters dialog box... this is a one time excercise for a chart window.
Note that the Chart ID in my chart/ window is 1000... it will be different for different windows.
The actual code:
Now make a list of stocks with the support and resistance lines defined as a STUDY. Better still, add these stocks to a watchlist and then run the exploration... whenever you get a breakout or a crossover, you will get the name of the stock along with a color indication as to what has happened.
In above example, blue means stock has closed above resistance, red means stock has closed below support and yellow means stock has closed above the trendline.
I use a similar code like to this to keep track of the SL of all my open positions... it does not matter whether I have 40 stocks or 100 stocks... I will always know when my trailing stoploss gets it.
This is an example of the output with the chart in the background showing SL hit today for COAL INDIA.
EDIT: refer INFY example.... today stock closed below SUpport... this is the screenshot of the exploration.
Following chart is of INFY and I have drawn 3 trendlines... the red is for resistance (RE), blue for support (SU) and the black line is the standard trendline (TE).
For various reasons, you may want to know when the stock crosses the resistance or breaks the support or crosses the black trendline.
The trick is to label each line as a STUDY. Built-in study functions are RE,SU,UP,DN and ST. In addition, you can define your own using any 2 alphabets.
Double clicking the line will throw up the dialog box... this is where you set the color and define the STUDY ID.
Now I need something called ChartID.... I get this by right clicking anywhere on the chart and opening the Parameters dialog box... this is a one time excercise for a chart window.
Note that the Chart ID in my chart/ window is 1000... it will be different for different windows.
The actual code:
Now make a list of stocks with the support and resistance lines defined as a STUDY. Better still, add these stocks to a watchlist and then run the exploration... whenever you get a breakout or a crossover, you will get the name of the stock along with a color indication as to what has happened.
In above example, blue means stock has closed above resistance, red means stock has closed below support and yellow means stock has closed above the trendline.
I use a similar code like to this to keep track of the SL of all my open positions... it does not matter whether I have 40 stocks or 100 stocks... I will always know when my trailing stoploss gets it.
This is an example of the output with the chart in the background showing SL hit today for COAL INDIA.
EDIT: refer INFY example.... today stock closed below SUpport... this is the screenshot of the exploration.
No comments:
Post a Comment