wouterpruym1828

Combining Trailing Stop and Stop loss (% of instrument price)

wouterpruym1828 تم تحديثه   
Both a trailing stop and a stop loss are necessary tools for every trader, for locking in as much profit in any given trade, while on the other hand minimizing the risks involved in trading.
I started to write this scipt to give an answer to many traders who wanted these two tools combined, but didn't find any way to program this.
TV has some shortcomings in the built-in functions regarding this topic. You can use 'stop' and 'limit', or 'loss' and 'profit' and even functions with trailing stops. But all of these lack the flexibility of the use of percentages.
I used many ideas of the community, and with this scrip I want to give back to the community.

The strategy is just a simple crossing of two Exponential Moving Averages, so do not start trading based solely on this script.
Also keep in mind that no two assets are the same, and adjustments should be made in the configuration for every asset.
This script should be viewed as a template, just take out the chunks of code you need. A savvy programmer can undoubtedly implement a 'take profit' of 50% halfway down the trade.

The features are:
-Everything is easily adjustable through the configuration section
-2 EMA's which form the strategy to go Long or Short
-Trailing stop, which adjust itself every bar according to the configuration
-Stop loss, which uses the entry price of the trade and stays at the same level according to the configuration
-The chart provides a visual reference for the levels of both stops

Happy trading!
ملاحظات الأخبار:
-Added take profit option, at a chosen price in % for a chosen % of equity
-After take profit took place, the stop loss updates to a chosen price level in % in advance of the entry price, thereby securing profit.
ملاحظات الأخبار:
Adjusted how the script calculates the stop loss after taking profit
نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟