OPEN-SOURCE SCRIPT

ComiCo - Joel on Crypto - MACD Scalping

Aggiornato
This is a modified (hopefully improved) version of the "Joel on Crypto - MACD Scalping" indicator. It got turned into a strategy, and added some extra filters, like number of trades after EMA cross, minimal EMA distance (EMA 50's distance from the EMA 200). It is just an experiment to see how good this scalping strategy can get.

Play around with it and let me know if you found good settings, or just have a comment on it.


I could get fairly good results on BTCUSDT 5m with these settings (all others left on default values):

Ticks Avg. Multiplier = 1.4
Max trades after EMA cross = 16
Limit Price Difference = 0
Take Profit = 0.0065
Stop Loss = 0.0085
Min EMA difference = 110

Pyramiding = 3
Note di rilascio
Updated some inputs to be more meaningfull, expressed in %
New "best " values (based on deep backtest between 2019-01-01 and 2022-07-12) (all the other values left default):

Ticks Avg . Multiplier = 1.4
Max trades after EMA cross = 22
Limit Price Difference (%) = 0
Take Profit (%) = 0.65
Stop Loss (%) = 0.9
Min EMA difference (%) = 0.85

Pyramiding = 3
Note di rilascio
Added a new parameter: "Max. EMA difference" to limit value from the top as well. It was worth it.
I am doing deep backtesting from 2019-01-01 till today (2022-07-15) and the backtested profit seems to be not only comfortably high, but also fairly consistent throughout the years. Of course as a scalping strategy, it is very sensitive to broker fees. (And past results are no way a guarantee of future performance, of course:) )

I could reach good results with the following settings (all the other values left default):

Ticks Avg . Multiplier = 1.4
Max trades after EMA cross = 20
Limit Price Difference (%) (0-> market order) = 0
Take Profit (%) = 0.85
Stop Loss (%) = 1.1
Min. EMA difference (%) = 0.8
Max. EMA difference (%) = 3.1
Note di rilascio
Added controls to limit which signals to take as valid in case there are signals directly after each other.

I could reach good results with the following settings (all the other values left default):

Ticks Avg . Multiplier = 1.4
Max trades after EMA cross = 19
Act on the first N signal (min) = 1
Act on the first N signal (max) = 5
Limit Price Difference (%) (0-> market order) = 0
Take Profit (%) = 0.85
Stop Loss (%) = 1.25
Min. EMA difference (%) = 0.82
Max. EMA difference (%) = 3.1
Note di rilascio
Adapted the strategy to the aleeert service, a connector between trading view and binance.

Parameters are mostly the same, but here is a guide how to enter my tested parameters:
Change the following settings (all the other values left default):

Ticks Avg . Multiplier = 1.4
Max trades after EMA cross = 19
Act on the first N signal (min) = 1
Act on the first N signal (max) = 5
Limit Price Difference (%) (0-> market order) = 0
Take Profit (%) = 0.9
Stop Loss (%) = 1.3
Min. EMA difference (%) = 0.82
Max. EMA difference (%) = 3.1

Pyramiding = 20

the "ALEERT" section is for aleeert specific settings, you will probably get it if you got aleeert.

Of course ask if anything is unclear :)
Note di rilascio
minor typo corrections
Note di rilascio
Added a basic User's Guide, if you get lost any time, try to use it, hopefully it will help.
Note di rilascio
Chart and User's Guide updated.
Note di rilascio
Chart updated again.
Note di rilascio
Added a new Time Filter, so that you can restrict trading to weekdays, and to two time-periods.

Parameters are mostly the same, but here is a guide on how to enter my favourite parameters (your favourite may differ from these):
Apply the following settings (all the other values left default):

Symbol: BTCBUSD PERPETUAL FUTURES from Binance
Timezone: UTC-4
Timeframe: 5 min

Ticks Avg . Multiplier = 1.39
Max trades after EMA cross = 19
Act on the first N signal (min) = 1
Act on the first N signal (max) = 6
Limit Price Difference (%) (0-> market order) = 0
Take Profit (%) = 0.9
Stop Loss (%) = 1.3
Min. EMA difference (%) = 0.82
Max. EMA difference (%) = 3.1
Use Weekdays filter? = true
Weekdays to select: Mon, Tue, Wed, Thu, Fri
Use Session Filter = true
Time Period: 02:00-11:30
Use 2ND Session Filter = true
Time Period: 13:00-00:00

Pyramiding = 14

The "ALEERT" section is for aleeert specific settings, you will probably get it if you got aleeert.

Of course ask if anything is unclear :)

The User's Guide is updated as well.
Note di rilascio
Added a new option to be able to switch from EMA to SMA, DEMA, TEMA for determining the overall trend. I don't have the best settings for it, but go on and experiment with it :)

The values that need to be readjusted after changing a moving average method are at least the following:
Fast MA lenght
Slow MA lenght
Min. MA difference (%)
Max. MA difference (%)

The default value is still EMA, so all the old settings function like before.
Note di rilascio
Added another automated trading option, namely "TradingView To Anywhere" - mt4 version.
Added an economic news event effect avoidance option, where you can select which events to exclude from trading using an adjustable time window. These events had to be added to the source code, so it can only contain the latest news schedule available right now. It is "2022 Feb 02, 15:30 - Continuing Jobless Claims". After this event, the strategy will work like it worked before without "news effect avoidance". Of course I plan to give you an update before that date:)
The "best" values I concluded to with my backtestings are the actual default values.
Note di rilascio
There is an economic news event effect avoidance option, where you can select which events to exclude from trading using an adjustable time window by selecting the "true" or "false" values. These events had to be added to the source code, so it can only contain the latest news schedule available right now. It is "2023 Feb 28, 15:30 - Goods Trade Balance (Jan)". After this event, the strategy will work like it worked before without "news effect avoidance". Of course I plan to give you an update before that date:)
The "best" values I concluded to with my backtestings are the actual default values.
Note di rilascio
Fixed a bug in the News Avoidance module.
Note di rilascio
Economic calendar updated till the 14th of April 2023.
Note di rilascio
Fixed a problem on the aleeert automaiton side:
Rarely by closing the positions, a tiny portion was left open. Than if the stategy wanted to open an opposing direction position, aleeert gave an error, because of the position that was unintentionally left there. Now it is fixed by intentionally always closing the opposing direction position.
Note di rilascio
Added an extra time filter for Friday market close.
Note di rilascio
Added a dedicated time filter for Sundays.
Note di rilascio
Economic calendar updated till the 26th of May 2023.
Changed Sunday to be selected together with the active the Sunday filter.
Note di rilascio
It is a hotfix for the situation if the price moves so fast, that aleeert can't place the TP or SL, as the price is over the trigger price. Now with the fix whenever TradingView detects that a trade should be closed, a maket close is sent to aleeert. Than either the TP or SL order is executed, or the market close, whichever if faster. Most probably the TP or SL will be faster, but if for whatever reason it couldn't be placed, the market close kicks in.
Note di rilascio
Economic calendar updated till 2023.07.07.
Note di rilascio
- Added a way to limit how many trade groups can be traded after the EMA cross. Couldn't find a profitable way to use it, however just try it out :)
- Added trailing stop as well. The aleeert automated trading is adapted to it, but I never tested, be aware if you plan to use it. First it's better to play around with the settings. Be aware, that the trailing stop backtesting can return greatly differing results if you don't know what you do. Bar Magnifier is your friend in this case, but also be sure you understand how it works ;)
Note di rilascio
The economic news calendar was accidentally used from an older version. It got fixed now, the new last date of the economic calendar is 2023.07.07.
Please update to this version if you use the previous one. Otherwise the news effect avoidance won't work.
Note di rilascio
It should be a usual update of the economic calendar, but my source of the calendar website is not available, so I had to fabricate the next some events by hand. So, now we are only covered till the 18th of july 2023.
Note di rilascio
Economic calendar updated till 2023.09.14.
Note di rilascio
Added optional display for the actual TP and SL levels.
Note di rilascio
advanced the TP and SL display
Note di rilascio
Added experimental features - doesn't effect the normal operation.
Note di rilascio
Economic calendar updated until 2023.11.22.
Note di rilascio
Updated till the end on January 2024.
Exponential Moving Average (EMA)Moving Average Convergence / Divergence (MACD)Moving Averagestimefilter

Script open-source

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.

Vuoi usare questo script sui tuoi grafici?

Declinazione di responsabilità