Description of the strategy.
The «Long Explosive V1» strategy calculates the percentage change in price from the last closing price of the candle, so that if it increases by a certain percentage, it goes long, but if it decreases by another percentage, it sends an exit order, so that the percentage limits above and below the current price act as inherent stop loss and take profit, with the advantage of taking advantage of the volatility of the bullish market.
The entries and exits are always made at market price and are based on the percentage changes in price, not on the percentage loss or gain of the current position. Of course, the default setup of the strategy considers a position with a risk control of 5%, a modest initial capital, and standard commissions, which helps achieve realistic results and protects the user from unexpected potential losses. It is reiterated that it is always advisable to properly adjust the parameters of the strategy so that the risk-reward ratio is well controlled.
Explanation of the code.
Block 6-7: In this case, the percentage distances that will separate each order are defined directly in the input variables, whether it is long or short (in this case, it is only as a stop loss). Unlike grid strategies, in this one, the percentage distance can be adjusted differently, that is, x% if it goes up, y% if it goes down.
Block 9-10: In this block of code, it can be observed that two conditions have been defined; the first refers to going long and the second to going short (as a stop loss); however, both are activated if our input variables, expressed nominally, are exceeded either above or below by the price crossing with respect to a previous bar.
Block 12-16: Finally, we define the conditions themselves using if-else; the closing order is always activated before each additional instruction, but the difference is that when the short condition is met, it is definitive, acting as a stop loss, while if it is bullish or long, after closing the previous one, an additional buy order is activated, hence it is called «Long Explosive».
This strategy is available for free use in the TradingView® community library of indicators and strategies.