Algorithmic Trading Weighted Strategy developed in Pine Script for TradingView
Note
This project is on hold until further news. The idea is to take it up again when I defend my PhD in June 2023.
Best,
Alberto
I have been developing a fully customizable Algorithmic Trading Weighted Strategy in Pine Script for the last year in my spare time. The algorithm is based on a set of well-documented strategies, each with its own weight (weighted strategy). Currently a set of 5 strategies have been implemented:
MACD
Stochastic RSI
RSI
Supertrend
MA crossover
Moreover, the algo includes stop losses criteria and a taking profit strategy. The algo must be optimized for the desired asset to achieves its full potential. The 4H dataframe gives good results. The algo has been tested for several asset (same dataframe, different optimization values).
To set an order, first, the algorithm calculates the weight_strategy, which represents a value from 0 to 5 of the number of strategies that are satisfied (in case the weight of each strategy is the same, i.e., same relevance over the rest). To open a position, the value of weight_strategy must be greater than the value of weight_signal, by default 2. Modify the indicator parameters for the desired asset and data frame. Set stop-loss and take profit criteria.
There are two additional new versions of the algorithm under development:
Backtest the algorithm
over a defined interval (data stamp), e.g., from 01/01/2021 to 01/01/2022.detects a potential Top/Bottom
.
moves the stoploss
every time the algo takes profit (TP)Take profit
based on a percentage of the open position. It is possible to define different values for short positions. Define the percentage of TP to close from the open position.Define delays
to evaluate the strategies of more previous candles:
Buy/sell labels for possible reentries
.⚠️ NOTE
+
represent the next Take Profit (TP) target in teal and the Stop-Loss (SL) in gray.
Search for Acrypto - Weighted strategy
in the indicator tab using TradingView
and add it to your layout. Modify the indicator parameters for the desired asset and data frame.
If you consider paying for a subscription on TradingView (which is not required for this script), I would be very grateful if you could use my referral link :)
Referral link:
https://www.tradingview.com/gopro/?share_your_love=accry
Original post:
https://www.tradingview.com/script/OF3TzrNS-Acrypto-Weighted-Strategy/
The monthly table performance was developed by @QuantNomad. I have only changed some colors and also adapted the calculations to the last previous candle. The purpose of this change is to make this script compatible with this weighted strategy. Thanks again to @QuantNomad for this amazing script!
For discussions, questions, or just to share some settings, please leave a comment here in the discussion channel.
Support this project by giving me an extra dose of caffeine :coffee:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.