This strategy uses a TTM (based on EMAs of highs and lows) to determine the market's trend direction. It then deploys a grid trading system around a dynamically updated base price, with the grid's direction and levels adjusting based on the trend. Trades are executed as the price crosses the predefined grid levels, with the strategy risking a set percentage of equity per trade.
Core Strategy Logic:
TTM State Calculation (ttmState() function): * Calculates two EMAs based on the `ttmPeriod`: one for the lows (`lowMA`) and one for the highs (`highMA`). * Defines two threshold levels: `lowThird` (1/3 from the bottom) and `highThird` (2/3 from the bottom) of the range between `highMA` and `lowMA`. * Returns the current TTM state as an integer: + `1` if the close price is above `highThird` (indicating an uptrend). + `0` if the close price is below `lowThird` (indicating a downtrend). + `-1` if the close price is between `lowThird` and `highThird` (indicating a neutral state).
In pieno spirito TradingView, l'autore di questo script lo ha pubblicato open-source, in modo che i trader possano comprenderlo e verificarlo. Un saluto all'autore! È possibile utilizzarlo gratuitamente, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.