[STOCK] [Strategy][TRADINGVIEW][Tutorial] Using strategy.order in PINE SCRIPT to complete multiple trades strategy
Objective
In a trading strategy, if you want to add positions midway, you can use the strategy.order function to achieve this. The following example will be:
1. Buy once when it rises above the quarterly line, and the order quantity is 0.
2. Buy again when it rises above the 10-day line.
3. Sell all when it falls below the 60-day line.
P.S. If you don't want to sell all at once, you can adjust the quantity to be sold by adding the qty parameter to the strategy.close function.
strategy.close("buy", comment = '全賣', qty = 1 )
if the article is helpful to you, please click on an advertisement to provide me with additional income, which is also an encouragement for me.
Strategy Script
For instructions on how to add the script to the chart, please refer to [STOCK][TRADINGVIEW][Tutorial] Adding your own indicators & strategies to TRADINGVIEW charts.
留言