BreezeTrades808

Two MAs (nextSignals)

Hi folks, just some quick work inspired by ThinkScript code from @stephenharlinmd (the Doc).

This indicator seems to be intended for lower timeframes (3 min was used for example), and indicates long and short opportunities based on crossovers of the two lines.

The slow reference line is an EMA20. The fast line is referred to as an "Instantaneous Moving Average", which attempts to use OHLC4 values to create a realtime reference line for price instead of a lagging average. Its calculation is as follows:

1. The OHLC4 value is calculated by taking the average of the open, high, low, and close prices for each bar.

2. The ta.highest function is used to find the highest value of OHLC4 over the last 5 bars, and this value is stored in the ON variable.

3. The ta.lowest function is used to find the lowest value of ON over the last 5 bars, and this value is stored in the O1 variable.

4. The for loop is used to find the index of O1 in the P data series, which represents the OHLC4 values over the last 6 bars. If the value at the current index is equal to O1, and O1Loc has not already been set, then O1Loc is set to the current index.

5. The O2 variable is initialized to ON, and another for loop is used to find the index of the second lowest value of OHLC4 over the last 6 bars, which is not at the same index as O1. If the value at the current index is equal to O2, and O2Loc has not already been set, and the current index is not equal to O1Loc, then O2Loc is set to the current index.

6. The O3 variable is initialized to ON, and another for loop is used to find the minimum value of OHLC4 over the last 6 bars, excluding the values at the indices of O1 and O2. If the current index is not equal to O1Loc or O2Loc, then the minimum of the current value of O3 and the value at the current index of P is stored in O3.

7. Finally, the "IMA" variable is set to the value of O3, which represents the "IMA" over the last 6 bars.

Skrip open-source

Dalam semangat TradingView, penulis dari skrip ini telah mempublikasikannya ke sumber-terbuka, maka trader dapat mengerti dan memverifikasinya. Semangat untuk penulis! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.

Inggin menggunakan skrip ini pada chart?