How To Write Your Own Simple Metastock Stop Loss Formula

Metastock Stop Loss Formula

The primary objective of any kinds of investment is to make maximum profit with minimum risk. Stock Market is such a volatile field for investment. In this market, traders first purpose should be protecting the principle then try for profit. In order to protect the principle or minimize the loss, there is a tool which refers to Stop-Loss. The name itself implies its meaning, by using the tool, traders can hedge the risk. You may check our previous article on Stop-Loss. This article will cover a brief description of SL along with Metastock Stop Loss Formula.

Definition and Types of SL Orders

Stop-Loss in other words terms as “Stop-Order”, by placing the order investors provide instructions to automatically buy or sell securities if it drops or arises at a certain price. In order to stop the excessive loss, traders can apply various types of SL orders.

There are Market SL, Limit SL, and Trailing SL which are described below:

Limit SL

In stop loss limit order there is two section available, price and trigger price. As before hitting the SL price, trigger becomes activated, trigger price always comes first. The only drawback of limit SL is if the price doesn’t hit the SL limit, an order may get canceled.

Market SL

Market stop loss order or SL M is quite different from limit SL. Here, you get only the trigger price option. When price hit the trigger, an order will automatically be executed. In this type, there is no fear of canceling orders.

Trailing SL

Trailing stop loss comes under BO (Bracket Order). It basically uses for intraday trading. Now, the question is what is meant by it. Trailing Sl goes ups and down automatically according to the movement of the selected stock by a particular number of ticks.

The advantage of the order is you don’t have to monitor the market and price fluctuation often. By placing Trailing SL, your SL will be adjusted automatically. Therefore, it considers more flexible in comparison to fixed SL. Trailing SL can be used in stocks, option, future exchange. It acts as a support of an SL order.

Now, come to the Metastock Formula which is attached below:

Metastock Stop Loss Formula

After opening Metastock, put the formula described below.

Metastock Stop Loss Formula

In Metastock. Go to Tools –> Indicator Builder (or Ctrl+B). Select New. From here, you can open the Indicator Editor window. Put the following code:

Stop1:=If( PREV = PREV,
( H – 4.5ATR(14) ),
( H – 4.5
ATR(14) ));

Stop2:=If( PREV = PREV,
( C – 3.5ATR(14) ),
( C – 3.5
ATR(14) ));


Stop1:=If( PREV > H,
If(( L + 4ATR(14) ) H,
If(( C + 3.5
ATR(14) ) <= PREV,
( C + 3.5ATR(14) ),
( C + 3.5
ATR(14) ));


If( ((Year()<=2012) OR (Year()=2050 AND Month()<=6 AND DayOfMonth()<=31)),
If((BarsSince(LBarsSince(H>Ref(StopShort,-1)) ),StopLong,StopShort),C);

Now you have to click on Apply and Ok. After that, you will have the Metastock stop loss formula ready in your indicators list. Now you need to apply Metastock stop loss formula indicator from Insert –> Indicators (or Ctrl+I), select the Simple Trail Stop Loss indicator.


Don't Start Trading Until You Read This Free Ebook..


  • 4 rules of making millions in the stock market.
  • How to follow these rules in your investing.
  • How to retire as a multi millionaire.

Author: Indrajit Mukherjee

Indrajit is a professional blogger and trading system developer. Amibroker expert, Wordpress expert, SEO expert and stock market analyst.Trading since 2002, he has started the journey of on 2008. He follows Indian and world stock markets closely.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.