Trailing stop loss — Helps automate your deals

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    The Best Binary Options Broker 2020!
    Perfect For Beginners!
    Free Demo Account!
    Free Trading Education!

  • Binomo
    Binomo

    Good choice for experienced traders!

issue with mu trailing stop loss

the problem is that it is working only with opened order of buy type, not sell

I my point of view it must work in both buy and sell type of orders

Can anybody help me with this.

Thanks in advance.

the problem is that it is working only with opened order of buy type, not sell

I my point of view it must work in both buy and sell type of orders

Can anybody help me with this.

Thanks in advance.

Looks like your problem is in your ‘ ntrailsl() ‘ function, which you did not include here.

Looks like your problem is in your ‘ ntrailsl() ‘ function, which you did not include here.

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    The Best Binary Options Broker 2020!
    Perfect For Beginners!
    Free Demo Account!
    Free Trading Education!

  • Binomo
    Binomo

    Good choice for experienced traders!

here is the ‘ntrailsl()’ function

here is the ‘ntrailsl()’ function

Your code looks fine (except the missing <> as highlighted below, but no big deal), so I decided to test run it, and everything works! – but of course,with my own “guesses” of what the other parts of your code looks like (e.g. your data declarations, whether you have other supporting functions, etc.).

So I suggest you post your entire code if you want a thorough testing done :)

Your code looks fine (except the missing <> as highlighted below, but no big deal), so I decided to test run it, and everything works! – but of course,with my own “guesses” of what the other parts of your code looks like (e.g. your data declarations, whether you have other supporting functions, etc.).

So I suggest you post your entire code if you want a thorough testing done :)

After applying your suggestion, I did testing and couldnot got solved.

finally i came to know that my function ‘ntrailsl()’ return value for sell position is 0, I could not recognize where is the error that returns value 0 for sell position.

After applying your suggestion, I did testing and couldnot got solved.

finally i came to know that my function ‘ntrailsl()’ return value for sell position is 0, I could not recognize where is the error that returns value 0 for sell position.

That’s weird, because without the braces, you can get zero (in fact when profit is less than zero, all stoplosses are set to zero according to your code, so subsequent call to ‘nTrailsl()’ will also give you zero.

However, with the braces in place I don’t get zero on my end.

That’s weird, because without the braces, you can get zero (in fact when profit is less than zero, all stoplosses are set to zero according to your code, so subsequent call to ‘nTrailsl()’ will also give you zero.

However, with the braces in place I don’t get zero on my end.

when i printed out I got this for sell position

and for buy position

i printed out by this

That’s weird, because without the braces, you can get zero (in fact when profit is less than zero, all stoplosses are set to zero according to your code, so subsequent call to ‘nTrailsl()’ will also give you zero.

However, with the braces in place I don’t get zero on my end.

Did you put stoploss during execution of sell.

mine was with no tp and no sl.

is that the reason.

Did you put stoploss during execution of sell.

Как работает Trailing Stop Loss?

Скользящий Стоп Лосс или Trailing Stop Loss (TSL) – это динамически изменяемый приказ Stop Loss, который способен следовать за изменением цены.

Механизм его действия достаточно прост. Если цена актива движется в нужную для трейдера сторону, TSL автоматически устремляется за ней. Если цена актива находится во флэте или идет в противоположном направлении, то TSL остается неподвижным.

Включить или выключить Трейлинг можно в окне редактирования сделки

Обратите внимание: если активирован Trailing Stop Loss, то функция “Перевод в безубыток” будет недоступна.

Разберем более подробно как работает TSL на примере.

Предположим трейдер совершил покупку актива в точке (1) и определил значение Take Profit (TP) +15%, а значение Stop Loss -3%. Включив переключатель Trailing, трейдер активировал для Stop Loss функцию слежения за ценой с коридором в 3%.

Вот так эти настройки будут выглядеть в терминале

Коридор – это максимальная величина, на которую цена может отдалиться от уровня Stop Loss.

Как мы видим на Рисунке #1 после входа в позицию цена актива начала снижаться. В такой ситуации значение TSL остается неизменным.
Но как только цена изменила свое направление, и значение коридора достигло заданных 3%, TSL начинает следовать вслед за ней.

Говоря простым языком, задача TSL – не отпустить от себя цену дальше заданного значения.

Интересно: как только TSL преодолевает уровень безубыточности, действие этого инструмента начинает напоминать Trailing Take Profit, и теперь сделка будет закрыта с профитом.

В точке (2) направление движения изменяется, и цена начинает снижаться. При падение цены на 3% от локального максимума (2) происходит автоматическая продажа актива в точке (3), и позиция закрывается с прибылью.

Допустим, что в данной конкретной ситуации трейдер не активировал Trailing, а просто воспользовался статичным Stop Loss. В таком случае, когда сделка закроется в точке (4), трейдер вместо прибыли получит убыток в размере 3%.

Казалось бы, какой эффективный инструмент этот Trailing Stop Loss! Активировал переключатель и получай теперь свою прибыль. Но не все так однозначно. Нужно понимать, что использование TSL оптимально далеко не всегда.

Давайте рассмотрим ситуацию из предыдущего примера, но с одним отличием (см. Рисунок #2). В этот раз после прохождения точки (3) цена вновь изменила свое направление и поднялась до уровня TP.

Таким образом, трейдер недополучит существенную часть прибыли в данной сделке, так как использовал Trailing вместо обычного Stop Loss.

Какой вывод мы можем сделать из этой статьи?
Trailing показывает хороший результат в рамках идеального тренда — когда цена активно движется в одном направлении без значительных коррекций. Для эффективной работы с TSL необходимо уметь анализировать рынок, учитывать волатильность активов и понимать механизм работы самого инструмента.

How Trailing Stop Loss works?

Trailing Stop loss order is typically used as a closing order to limit losses or lock in your profits on a long or short position. But they can also be used to open a position.

Stop Loss: Triggers a next order type when the last market price hits the stop price. Next order can be Market Sell, Limit Sell or Trailing Stop Sell.

According to Investopedia:

What Is a Stop-loss Order?

A stop-loss is designed to limit an investor’s loss on a security position. Setting a stop-loss order for 10% below the price at which you bought the stock will limit your loss to 10%. For example, let’s say you just purchased BCH at 0.11 BTC. Right after buying the stock you enter a stop-loss order for 0.09 BTC. This means that if the stock falls below 0.09 BTC, your coin will then be sold with next order type.

Positives and Negatives

The advantage of a stop order is you don’t have to monitor on a daily basis how a stock is performing. This is especially handy when you are on vacation or in a situation that prevents you from watching your stocks for an extended period of time.

The disadvantage is that the stop price could be activated by a short-term fluctuation in a stock’s price. The key is picking a stop-loss percentage that allows a stock to fluctuate day to day while preventing as much downside risk as possible. Setting a 5% stop loss on a stock that has a history of fluctuating 10% or more in a week is not the best strategy. You’ll most likely just lose money on the commissions generated from the execution of your stop-loss orders.

There are no hard and fast rules for the level at which stops should be placed. This totally depends on your individual investing style: an active trader might use 5% while a long-term investor might choose 15% or more.

How to place Stop Loss Limit:

  • Select Stop Loss order type.
  • Select Base and Quote coin.
    • E.g. Market: BTC/LTC
  • Select the number of coins needs to be sold.
    • E.g. 10 coins. (quantity could be in the fraction)
  • Now, click on the drop-down menu near Take Profit. It will pop up 3 options: Market, Limit, and Trailing. Selection of an option means when market price (ask price) rises to the Stop value, the selected order in the drop-down menu will be executed (Market Sell, Limit Sell or Trailing Sell).
    • E.g if the current ask price of LTC is 0.011189 BTC.
    • Stop value can be a place at 0.011000,

      2% below the current price.

    • Suppose market hit0.011000. This will trigger subsequent order. Below are the possibilities:
      • Market Sell: A Market Sell order will be placed.
      • Limit Sell: A Limit Sell order will be placed having limit value mentioned during placing the order.
      • Trailing Stop Sell: A trailing Stop sell order will be placed with the mentioned offset during placing the order.

Caution : Stop price should be a less current market price (ask price).

TRAILING STOP LOSS TO LONG AND SHORT

This TradingView strategy it is designed to integrate with other strategies with indicators.
It performs a trailing stop loss from entry and exit conditions.
In this strategy you can add conditions for long and short positions.
The strategy will ride up your stop loss when price moviment 1%.
The strategy will close your operation when the market price crossed the stop loss.
Also is possible to select the period that strategy will execute the backtest.
The strategy has the following parameters:

+ **INITIAL STOP LOSS** – Where can isert the value to first stop.
+ **POSITION TYPE** – Where can to select trade position.
+ **BACKTEST PERIOD** – To select range.

## DISCLAIMER

1. I am not licensed financial advisors or broker dealers. I do not tell you when or what to buy or sell. I developed this software which enables you execute manual or automated trades multiple trades using TradingView. The software allows you to set the criteria you want for entering and exiting trades.
2. Do not trade with money you cannot afford to lose.
3. I do not guarantee consistent profits or that anyone can make money with no effort. And I am not selling the holy grail.
4. Every system can have winning and losing streaks.
5. Money management plays a large role in the results of your trading. For example: lot size, account size, broker leverage, and broker margin call rules all have an effect on results. Also, your Take Profit and Stop Loss settings for individual pair trades and for overall account equity have a major impact on results. If you are new to trading and do not understand these items, then I recommend you seek education materials to further your knowledge.

**YOU NEED TO FIND AND USE THE TRADING SYSTEM THAT WORKS BEST FOR YOU AND YOUR TRADING TOLERANCE.**

**I HAVE PROVIDED NOTHING MORE THAN A TOOL WITH OPTIONS FOR YOU TO TRADE WITH THIS PROGRAM ON TRADINGVIEW.**

## NOTE

+ Authors: @exit490
+ Revision: v1.0.0
+ Date: 03-Aug-2020
+ Pinescript version: 4

## LICENSE

Copyright 2020 Mauricio Pimenta / exit490

Trailing Stop Loss script may be freely distributed under the MIT license.

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    The Best Binary Options Broker 2020!
    Perfect For Beginners!
    Free Demo Account!
    Free Trading Education!

  • Binomo
    Binomo

    Good choice for experienced traders!

Like this post? Please share to your friends:
How To Make Money on Binary Options Trading
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: