Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Troubleshooting Your Pine Script: Fixing Strategy Exit Issues in a Bollinger Bands Strategy

  • vlogize
  • 2025-10-06
  • 1
Troubleshooting Your Pine Script: Fixing Strategy Exit Issues in a Bollinger Bands Strategy
Strategy Exit is not triggering correctlypine script
  • ok logo

Скачать Troubleshooting Your Pine Script: Fixing Strategy Exit Issues in a Bollinger Bands Strategy бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Troubleshooting Your Pine Script: Fixing Strategy Exit Issues in a Bollinger Bands Strategy или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Troubleshooting Your Pine Script: Fixing Strategy Exit Issues in a Bollinger Bands Strategy бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Troubleshooting Your Pine Script: Fixing Strategy Exit Issues in a Bollinger Bands Strategy

Learn how to solve the `Strategy Exit` issues in your Pine Script trading strategy based on Bollinger Bands and RSI indicators. Follow this guide for a better trading experience!
---
This video is based on the question https://stackoverflow.com/q/64006309/ asked by the user 'Hassan Kanaan' ( https://stackoverflow.com/u/14288157/ ) and on the answer https://stackoverflow.com/a/64036916/ provided by the user 'Eduardo' ( https://stackoverflow.com/u/13478253/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.

Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: Strategy Exit is not triggering correctly

Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l...
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license.

If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com.
---
Troubleshooting Your Pine Script: Fixing Strategy Exit Issues in a Bollinger Bands Strategy

If you're diving into algorithmic trading using Pine Script, you might have encountered issues with your trading strategy not executing exit orders as expected. A common problem among traders is having their exit conditions not triggering correctly, often leading to unexpected losses or missed opportunities. This guide will address a specific instance of this problem by analyzing a trading strategy based on Bollinger Bands and the RSI (Relative Strength Index) indicators.

Understanding the Problem

In this case, the trader created a strategy that:

Buys when the price closes below the lower Bollinger Band and the RSI indicates oversold conditions.

Sells when the price closes above the upper Bollinger Band and the RSI indicates overbought conditions.

The exit condition is triggered when the price closes back above the basis line of the Bollinger Bands for buy orders and below the basis line for sell orders.

However, the trader noticed that the exit condition does not work consistently. Sometimes, it triggers correctly; at other times, it does not. Additionally, the trader included a stop loss that was supposed to close trades if they moved too far (200 pips in the opposite direction), but this was also failing to execute as intended.

Analyzing the Solution

Recognizing the Issue

The fundamental issue arises from how the exit strategy is coded. The 200 pip move is calculated when exit_long or exit_short triggers. This can lead to an exit order being placed at an inappropriate level. For example:

If an exit short triggers at 12000, the order will only take place at 11800, even if the position was initially opened at a much higher price (like 13000).

Suggested Fix

To resolve this, the strategy needs to track the price at which the order was opened and calculate the stop price from that point. Here's how to implement this:

Track Opening Orders:
Use the following line of code to determine if a new order has been opened:

[[See Video to Reveal this Text or Code Snippet]]

This helps in checking when a new position is established.

Calculate the Stop Price:
You need to capture the opening price of the order when it was executed:

[[See Video to Reveal this Text or Code Snippet]]

This captures the closing price at which the trade was opened and adjusts the stop price accordingly.

Define the Stop Loss:
Modify your exit conditions to adapt them for the calculated stop prices:

[[See Video to Reveal this Text or Code Snippet]]

Full Revised Code

Here is the complete corrected code for your Pine Script strategy that includes these changes:

[[See Video to Reveal this Text or Code Snippet]]

Conclusion

By tracking the price at which a trading position is opened and adjusting exit conditions accordingly, you can solve the exit order issues that have been plaguing your strategy. Implementing these changes will ensure that your stop loss reacts appropriately based on your initial entry price, improving your overall trading efficacy.

Feel free to reach out with further questions or for additional tips on optimizing your Pine Script strategies. Happy trading!

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]