OPEN-SOURCE SCRIPT

Close v Open Moving Averages Strategy (Variable) [divonn1994]

This is a simple moving average based strategy that works well with a few different coin pairings. It takes the moving average 'opening' price and plots it, then takes the moving average 'closing' price and plots it, and then decides to enter a 'long' position or exit it based on whether the two lines have crossed each other. The reasoning is that it 'enters' a position when the average closing price is increasing. This could indicate upwards momentum in prices in the future. It then exits the position when the average closing price is decreasing. This could indicate downwards momentum in prices in the future. This is only speculative, though, but sometimes it can be a very good indicator/strategy to predict future action.

What I've found is that there are a lot of coins that respond very well when the appropriate combination of: 1) type of moving average is chosen (EMA, SMA, RMA, WMA or VWMA) & 2) number of previous bars averaged (typically 10 - 250 bars) are chosen.
Depending on the coin.. each combination of MA and Number of Bars averaged can have completely different levels of success.

Example of Usage:
An example would be that the VWMA works well for BTCUSD (BitStamp), but it has different successfulness based on the time frame. For the 12 hour bar timeframe, with the 66 bar average with the VWMA I found the most success. The next best successful combo I've found is for the 1 Day bar timeframe with the 35 bar average with the VWMA.. They both have a moving average that records about a month, but each have a different successfulness. Below are a few pair combos I think are noticeable because of the net profit, but there are also have a lot of potential coins with different combos:
It's interesting to see the strategy tester change as you change the settings. The below pairs are just some of the most interesting examples I've found, but there might be other combos I haven't even tried on different coin pairs..
Some strategy settings:


BTCUSD (BitStamp) 12 Hr Timeframe : 66 bars, VWMA=> 10,387x net profit
BTCUSD (BitStamp) 1 Day Timeframe : 35 bars, VWMA=> 7,805x net profit
BNBUSD (Binance) 12 Hr Timeframe : 27 bars, VWMA => 15,484x net profit
ETHUSD (BitStamp) 16 Hr Timeframe : 60 bars, SMA => 5,498x net profit
XRPUSD (BitStamp) 16 Hr Timeframe : 33 bars, SMA => 10,178x net profit

I only chose these coin/combos because of their insane net profit factors. There are far more coins with lower net profits but more reliable trade histories.

Also, usually when I want to see which of these strategies might work for a coin pairing I will check between the different Moving Average types, for example the EMA or the SMA, then I also check between the moving average lengths (the number of bars calculated) to see which is most profitable over time.

Features:
-You can choose your preferred moving average: SMA, EMA, WMA, RMA & VWMA.
-You can also adjust the previous number of calculated bars for each moving average.

-I made the background color Green when you're currently in a long position and Red when not. I made it so you can see when you'd be actively in a trade or not. The Red and Green background colors can be toggled on/off in order to see other indicators more clearly overlayed in the chart, or if you prefer a cleaner look on your charts.

-I also have a plot of the Open moving average and Close moving average together. The Opening moving average is Purple, the Closing moving average is White. White on top is a sign of a potential upswing and purple on top is a sign of a potential downswing. I've made this also able to be toggled on/off.

Please, comment interesting pairs below that you've found for everyone :) thank you!

I will post more pairs with my favorite settings as well. I'll also be considering the quality of the trades.. for example: net profit, total trades, percent profitable, profit factor, trade window and max drawdown.

*if anyone can figure out how to change the date range, I woul really appreciate the help. It confuses me -_- *
binancecoinBitcoin (Cryptocurrency)divonn1994Ethereum (Cryptocurrency)Moving Averagesopenvsclosestrategy

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian