Latest News

2022 Start working on a new website

BBS Trading Expert
Watch the Youtube BBS video and here is a crude oil trading example

 

Want to know more about:

NinjaTrader formulas.

MetaStock formulas.

MetaTrader formulas.

My YouTube videos.

AXIOM business books awards, bronze medal! Thank You!

No longer available!

 

 

Favorite articles in 2010, 11, 12, 14 and 2015 S&C Readers' Choice Awards.

readers choice awards

AXIOM Business Books Awards, bronze medal.

AXIOM award

 

 

 

 


 

Stock Market Proprietary Indicators Part 5

ATR (Average True Range) trailing stop

Once a buying order is executed, you must always limit the risk by keeping an initial stop. The initial stop itself is variable from trade to trade because it will be based on different technical analysis techniques.

On the other hand, you must use a trailing stop as the ultimate selling signal to avoid losing too much profit.

Special offer: "Capturing Profit with technical Analysis"

AdvancedStop.dll is an external DLL file that is available free of charge thanks to Richard Dale http://www.premiumdata.net

This external DLL file allows the fixing of a result until it is reset (flip-flop function) and exits  when the closing price breaks the initial or trailing stop condition.
We use this external DLL file function in the next formula for the graphical representation of an initial and trailing stop. At the time of writing, this free DLL file was available at
http://www.tradernexus.com/advancedstop/advancedstop.html

ATR was developed by J. Welles Wilder and introduced in his book, “New concepts in technical trading systems” (1978). The Average True Range (ATR) indicator measures a security's volatility.

Wilder started the true range concept defined as the greatest value of:

  • The current High less the current Low.
  • The absolute value of the current High less the previous Close.
  • The absolute value of the current Low less the previous Close.

He then calculated an average of this value for creating the Average True range.
Like most technical analysis programs, MetaStock® has a predefined ATR indicator (ATR(period)).

If you need to calculate it yourself, it can be created as follows:

{Get the required ATR period;}
period:=Input("ATR Period :",1,100,5);
{Calculate the biggest difference based on the true range concept;}
diff1:=Max(H-L,Abs(H-Ref(C,-1)));
diff2:=Max(diff1,Abs(L-Ref(C,-1)));
{Use Wilders’ moving average method to calculate the Average True Range;}
Mov(diff2,period*2-1,E)

With this formula you could create an ATR value based on something else than the closing price, an average price for example.

To create a trailing stop based on the ATR value, we calculate the maximum allowed loss based on the ATR value multiplied by a factor.

Since the number of input parameters in MetaStock® is limited to six, we have to create separate formulas for a long or a short position.


The following MetaStock® formula “SVE_StopLong_Trail_ATR_Date”  creates an initial and long position ATR  trailing stop on the price chart from an entry date:
{SVE_StopLong_Trail_ATR_Date - ATR trailing stop from date}
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,1);
InpYear:=Input("Year",1800,2050,2008);
InitStop:=Input("Initial Stop Price",0.1,10000,10);
atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
Entry:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();
StopLong:=ExtFml( "AdvancedStop.StopLong", Entry,InitStop,0,C-Loss,0,0,0,0);
StopLong

The following MetaStock® formula “SVE_StopShort_Trail_ATR_Date”  creates an initial and short position ATR  trailing stop on the price chart from an entry date:
{SVE_StopShort_Trail_ATR_Date - ATR trailing stop short from date}
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,1);
InpYear:=Input("Year",1800,2050,2008);
InitStop:=Input("Initial Stop Price",0.1,10000,10);
atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
Entry:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();
StopShort:=ExtFml("AdvancedStop.StopShort",Entry,InitStop,0,C+Loss,0,0,0,0);
StopShort

Formula construction

First we ask for the starting date:
InpMonth:=Input("Month",1,12,1);
InpDay:=Input("Day",1,31,1);
InpYear:=Input("Year",1800,2050,2008);

For the initial stop, we are simply asking for the stop price because it is set based on technical analysis. That way you can put the exact initial stop price:
InitStop:=Input("Initial Stop Price",0.1,10000,10);

Then we ask for the ATR average period to be used. Default we use a 5 day average as we found this value to be the most common profitable value using the more volatile stocks.
atrper:=Input("ATR period :",1,100,5);

Next we ask for the ATR average multiplication factor. Default we use a value of 3.5 as this value seems to be the most common profitable value when using more volatile stocks.
atrfact:=Input("ATR multiplication :",1,10,3.5);

Next we calculate the loss value based on the ATR value and the multiplication factor.
loss:=atrfact*ATR(atrper);

We reach the entry point in the daily price data series when the required starting date corresponds with a date displayed in the chart. Please make sure the requested date does exist in the chart, otherwise nothing will be displayed.
Entry:= InpYear=Year() AND InpMonth=Month() AND InpDay=DayOfMonth();

To fix the entry point, the initial stop and the trailing stop and to track the price move we use the “Advanced Trailing Stop” external function, a free of charge MetaStock® extension from Trader Nexus created by Richard Dale;

“http://www.tradernexus.com/advancedstop/advancedstop.html”

Put the “AdvancedStop.dll” file in the “External Function DLLs” folder below the \MetaStock directory.

StopLong:=ExtFml( "AdvancedStop.StopLong", Entry,InitStop,0,C-Loss,0,0,0,0);
StopLong

Trailing stop nicely captures a five wave Elliott up move

Figure 8.15: Trailing stop nicely captures a five wave Elliott up move.

 

Figure 8.15 is a chart of Salesforce Com Inc. You can see how the trailing stop nicely captures a five wave Elliott up move.

The formula input settings are displayed in the chart.

The trailing stop is broken when the closing price falls below the trailing stop line.

Proprietary Technical Indicators Previous -Part 1 -Part 2 -Part 3 -Part 4 -Part 5

STOCATA Stocks Technical Analysis HOME

 
 

Risk Disclosure: Futures and forex trading contains substantial risk and is not for every investor. An investor could potentially lose all or more than the initial investment. Risk capital is money that can be lost without jeopardizing ones’ financial security or life style. Only risk capital should be used for trading and only those with sufficient risk capital should consider trading. Past performance is not necessarily indicative of future results.

Hypothetical Performance Disclosure: Hypothetical performance results have many inherent limitations, some of which are described below. no representation is being made that any account will or is likely to achieve profits or losses similar to those shown; in fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. One of the limitations of hypothetical performance results is that they are generally prepared with the benefit of hindsight. In addition, hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk of actual trading. for example, the ability to withstand losses or to adhere to a particular trading program in spite of trading losses are material points which can also adversely affect actual trading results. There are numerous other factors related to the markets in general or to the implementation of any specific trading program which cannot be fully accounted for in the preparation of hypothetical performance results and all which can adversely affect trading results.

See more 'Legal Disclosures' in the bottom menu bar!

Copyright © 2007 Stocata.org, All rights reserved.
-->