Strategy on PINE (tradingview)
Initially, we implement the opening/partial closing of positions based on RSI (Long - crossing from below upwards 30, Short - crossing from above downwards 70). In the future, leave the option to add indicators for opening/partial closing of positions.
Add settings:
Open/partially close position based on RSI: Long - 30, Short - 70.
We take Long signal (if the price is above the average entry price): 3%
We take Short signal (if the price is above the average entry price): 3%
Take Profit %: 1.5%
Take Profit $, L+S =>: 15$
Take Profit SUM % =>: 0.5%
Coefficient for partial closing: 1.4.
First entry: 100 $ (it can be either long or short, depending on what the first signal will be)
Second coefficient: 2
Third coefficient: 3
Fourth coefficient: 4
Fifth coefficient: 5
Logic if the first signal was Long:
Long signal 1 (accumulation) 100 $ we close at 1.5% otherwise we wait for a Short signal and so on.
Short signal 2 (accumulation, so 100 * 2 = 200$) 200$
Long signal 3 (accumulation, so 100 * 3 = 300$) 300$
Short signal 4 (accumulation, so 100 * 4 = 400$) 400$
Long signal 5 (accumulation, so 100 * 5 = 500$) 500$
Total in longs: 900$. Total in shorts: 600$
Coefficient for partial closing: 1.4.
Short signal 6 → Close longs at 471.43$ (Short 600$/1.4=428.57, Long 900$-428.57=471.43$)
Total in longs: 428.57$. Total in shorts: 600$. Unloaded longs.
Long signal 7 → Close shorts at 293.88$ (Long 428.57$/1.4=306.12, Short 600$-306.12=293.88$)
Total in longs: 428.57$. Total in shorts: 306.12$. Unloaded shorts.
Short signal 8 → Close longs ... and so on
Long signal 9→ Close shorts .... and so on
...and so on
Make it for 20 signals and 5 accumulations.
Number the openings: Long 1, Short 2, Long 3, Short 4, Long 5,
Number the closings: Short (Close Long) 6, Long (Close Short) 7, Short (Close Long) 8, Long (Close Short) 9 and so on up to 25.
It is necessary to show the numbering, the sum (of opening or partial closing of the position) and the remaining sum of the position. If the position is fully closed, then show the closing sum and the remaining 0 will be.
If the profit of one position covers the loss of the opposite position, then we close both positions, long and short, under the following conditions. Set the profit of this in three variants:
- in Take Profit $, L+S (if profit Long + Short => +15$);
- and/or Take Profit SUM % (sum the long and short positions and wait until the profit is for example more than 0.5% considering the negative position);
- and/or Take Profit: 1.5% provided that the negative position is covered by the profit of the positive position.
If three conditions are selected, then one of them will work.