OPEN-SOURCE SCRIPT
Complex Single Trade Strategy

This 'Complex Single Trade Strategy' is a generic trading strategy that features three different types of stops, and four take profits.
It takes a Buy/Sell source input of: [> 0 for Buy, < 0 for Sell, = 0 for Neither]
The first signal will trigger a position to open immediately in that direction, but subsequent signals in the same direction will be ignored whilst the position remains open, as this strategy allows only one position at once.
A signal in the opposite direction to the current position can either be ignored, or it can close the position, or it can close it then immediately open another one in the opposite direction.
It also takes an optional 'Cancel' indicator just to close positions. [> 0 for Buy closes short, < 0 for Sell close long, = 0 no action] Other signals will be ignored.
The three different types of stops, that can be applied individually, or together:
* Regular Stop
* Initial Trailing Stop
* Trailing Stop
The initial trailing stop works like a regular trailing stop until it reaches the cut off level, a percentage of the current asset price above or below the entry level, then it will no longer trail the price, remaining statically at this level.
From here the regular trailing stop can take over trailing the price. This is useful to move the stop to the entry level (or there abouts) fairly quickly. From there you might want to trail the price with a larger trailing stop for the rest of the trade.
0 cut off means it stops trailing the price at your entry level, positive above, negative below, for a long trade. For a short it would be the opposite.
Typically you would want:
Trailing Stop > Initial Trailing Stop >= Stop
The four take profits each specify an amount to reduce the position size by, and at what specified percentage gain in price this is triggered.
My 'Simple Buy/Sell Indicator' and 'Custom Buy/Sell Indicator' (coming soon - watch this space) can be used to combine other indicators together into BUY/SELL strategies, using multiple custom rules. These can then be used as inputs to this strategy.
It takes a Buy/Sell source input of: [> 0 for Buy, < 0 for Sell, = 0 for Neither]
The first signal will trigger a position to open immediately in that direction, but subsequent signals in the same direction will be ignored whilst the position remains open, as this strategy allows only one position at once.
A signal in the opposite direction to the current position can either be ignored, or it can close the position, or it can close it then immediately open another one in the opposite direction.
It also takes an optional 'Cancel' indicator just to close positions. [> 0 for Buy closes short, < 0 for Sell close long, = 0 no action] Other signals will be ignored.
The three different types of stops, that can be applied individually, or together:
* Regular Stop
* Initial Trailing Stop
* Trailing Stop
The initial trailing stop works like a regular trailing stop until it reaches the cut off level, a percentage of the current asset price above or below the entry level, then it will no longer trail the price, remaining statically at this level.
From here the regular trailing stop can take over trailing the price. This is useful to move the stop to the entry level (or there abouts) fairly quickly. From there you might want to trail the price with a larger trailing stop for the rest of the trade.
0 cut off means it stops trailing the price at your entry level, positive above, negative below, for a long trade. For a short it would be the opposite.
Typically you would want:
Trailing Stop > Initial Trailing Stop >= Stop
The four take profits each specify an amount to reduce the position size by, and at what specified percentage gain in price this is triggered.
My 'Simple Buy/Sell Indicator' and 'Custom Buy/Sell Indicator' (coming soon - watch this space) can be used to combine other indicators together into BUY/SELL strategies, using multiple custom rules. These can then be used as inputs to this strategy.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน