TradingView
dgtrd
Jul 1, 2020 11:01 AM

Elliott Wave Oscillator Signals by DGT 

Ethereum / TetherUSBinance

Description

Elliott Wave Principle, developed by Ralph Nelson Elliott, proposes that the seemingly chaotic behaviour of the different financial markets isn’t actually chaotic. In fact the markets moves in predictable, repetitive cycles or waves and can be measured and forecast using Fibonacci numbers. These waves are a result of influence on investors from outside sources primarily the current psychology of the masses at that given time. Elliott wave predicts that the prices of the a traded currency pair will evolve in waves: five impulsive waves and three corrective waves. Impulsive waves give the main direction of the market expansion and the corrective waves are in the opposite direction (corrective wave occurrences and combination corrective wave occurrences are much higher comparing to impulsive waves)

The Elliott Wave Oscillator (EWO) helps identifying where you are in the 5-3 Elliott Waves, mainly the highest/lowest values of the oscillator might indicate a potential bullish/bearish Wave 3. Mathematically expressed, EWO is the difference between a 5-period and 35-period moving average based on the close. In this study instead 35-period, Fibonacci number 34 is implemented for the slow moving average and formula becomes ewo = ema(source, 5) - ema(source, 34)

The application of the Elliott Wave theory in real time trading gets difficult because the charts look messy. This study (EWO-S) simplifies the visualization of EWO and plots labels on probable reversals/corrections. The good part is that all plotting’s are performed on the top of the price chart including a histogram (optional and supported on higher timeframes). Additionally optional Keltner Channels Cloud added to help confirming the price actions.

What to look for:
Plotted labels can be used to follow the Elliott Wave occurrences and most importantly they can be considered as signals for possible trade setup opportunities. Elliott Wave Rules and Fibonacci Retracement/Extensions are suggested to confirm the patters provided by the EWO-S

Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely

Disclaimer: The script is for informational and educational purposes only. Use of the script does not constitutes professional and/or financial advice. You alone the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd TradingView user liable for any possible claim for damages arising from any decision you make based on use of the script

Release Notes

non-repaint with alert added version

Release Notes

backtest ability added, try to optimize by changing the setting

non-repaint version made optional (default repaint version)

Release Notes

exit price calculation error fixed when stop loss condition meets

many many thanks for your highly valuable comments @sotiri 🙏

Release Notes

removed "Enable Non-repaint Version" option and made Alerts and BackTest Non-Repaint

Entry/Exit Price Assumption default value changed from hlc3 to close

Release Notes

Enhancements in BackTest Framework

1-) Historical Data Evaluation
in the real-time processing when the condition is satisfied to avoid repainting the signals are presented on the next bar, this feature was already available with this study
change implemented with this update is to made historical data evaluation behavior same as real-time behavior and all plotting, statistical panel calculations are performed based on the next bar

Hence;
- traders will observe the same behavior both in real-time and in historical bars (even when the study is reloaded)
- trade statistics will display whatever the user traded on the real-time bars with the signals generated
- since the signals are generated on the next bar, “Entry/Exit Price Assumption” input necessity is no longer required, trades with the backtest framework will be assumed as open price on the next candle

2-) Early Warning : Alert + Label
As a rule as explained above, signals are triggered on the next bar in case the condition is still valid and the logic of the study is already aware of the likelihood of an signal occurrence on the next bar but the trader who is analyzing the chart is not (according to this study’s logic of course). So to increase the awareness, with this update ;
- a label with a warning sign is going to be plotted which of course is subject to repaint but will warn the trader to keep eyes closer on the instrument and proceed trading immediately on the next bar if the signal is confirmed and presented on the chart.
- for the same warning also an alert is defined (using new alert() function call), so the trader will be able to be notified with the probable not yet confirmed trade opportunity in advance, even if the trader is not monitoring the instrument.
Having said that, I would like to remind : Trading success is all about following your trading strategy and the indicators should fit within your trading strategy, and not to be traded upon solely.

3-) Improved Conditions
Since the long/short conditions are triggered on next bar there might be cases where a sudden change in price direction may occur especially in sideway market conditions with low volatility, so to avoid such cases the conditions are improved.

Please note : stop loss condition will be executed when price fall below the calculated value and trade will be closed with the close price on bar close (not yet able to get the price value at the moment of the cross). Stop loss condition is subject to repainting and to avoid any further loss an alert can be triggered at the moment the first cross is observed. Since stop loss is subject to repaint and in case it happens the statistical panel calculation will not be able to calculate till the bar is closed. You may disable application of stop loss from user dialog box to avoid any inconsistency that may appear on statistical panel and observe results of the trades executed without stop loss.

Other updates in Study
• Signals from Elliott Wave Oscillator are kept as they are (repainting) and modified Alert setup to have two alerts settings, one with the repaint version (early warning as the signals appears on chart) and one non-repaint version (on the next bar if still condition holds true).

• Made Keltner Channels highly customizable by users, besides added alerts related to Keltner Channels, cross over the most upper and middle band and crossunder the most lower and middle band (both 2nd and 3rd Levels)

• Finally, Organized Script Inputs in Sections

Usage info and descriptions:

Release Notes

made a small tweak in long/short trade conditions which resulted with better outcome

Release Notes

cosmetic changes

important note : newly added option for further confirmation based on candle direction may cause repainting. use with caution or for test purpose

Release Notes

have received so many request to add alerts for all conditions separately and this update includes them (both for EWO-S Part and Backtest Framework)

made "Candle Direction as Confirmation" and "Avoid Sudden Price Changes" long/shot conditions optional
Important note : If these options are selected Backtest Framework Signals may repaint, use with caution and for test purpose

Release Notes

A quick update, added an option with message to avoid any misuse

Please be informed that if any of the "Candle Direction as Confirmation" and "Avoid Sudden Price Changes" options selected Backtest Framework will execute trade simulation on the second bar after the STUDY detects a signal, otherwise on the next bar.

"❗❗❗ Only For Test Purpose (REPAINTS) ❗❗❗" option is for test purpose and when this option is selected the Backtest Framework will simulate trades on the next bar regardless of the above options

Release Notes

Changed option title from "❗❗❗ Only For Test Purpose (REPAINTS) ❗❗❗" to "❗❗❗ Simulate Trade on Next Bar : Only For Test Purpose (REPAINTS)"

Release Notes

update : improved histogram display - now histogram is available for all timeframes on both log and linear scale
Comments
Erialos
Just wanted to first get a thank you out to you Dgtrd. I was looking at developing a EW based strategy but after finding yours, not anymore
Erialos
@EffOfX, You're code is clean and well organized! Love that.
Similar to schulaz's question, might be the same answer, What alert settings does the backtest use for trading? When adding alerts, I have 2 options for long and short. One is Confirmed, the other is a Potential. Does the backtest use the confirmed? Or would I need to write a custom alert to do what it's doing? Similar to what you mentioned below with Schulza, where the alert is set to notify only if a trade is not in progress?

Im not familiar with Keltner bands, I have been meaning to look them up. How do you personally use these to filter out extra signal noise/confirm placements of long or shorts?

Thank you again!
dgtrd
Thank You @EffOfX,

Keltner Channels are volatility-based (ATR) bands around exponential moving average, mainly used here for confirmation but they just visually presented not combination in the logic.

let me forward one of my replies related with your query of alerts

All the studies where Backtest Framework is adapted we have the following structure for alerts (and signals on chart if any)

Backtest Framework is optional framework that aim to simulate trades and allow users to optimize the main studies parameters (such as lengths, thresholds, methods etc)

1. The main study LOGISTIC, EWO-S, MACD-X, MaMA and MomentumAccelaration (the one where the backtest framework is adapted) have their own alerts and/or signals BUT no filtering, where the users are able to configure alerts using

"Long : Early Warning"
"Long : Trading Opportunity"
"Short : Early Warning"
"Short : Trading Opportunity"

Early Warnings are repaint and to be used for early notification, when you receive this alert it does not mean the setup is ready.
Trading Opportunity ones are non-repaint and confirmed alerts (based on main study's logic) BUT as stated above no filtering is applied. For those ones it is suggested to configure alert with "once per bar" option since they are non-repaint. "once per bar close" option will lead to receive alerts on the second bar

2. Backtest Framework, as stated above is aiming to simulate trades (ONLY long trades) to add the ability for users to optimize the study. Backtest Framework benefits from signals generated by the studies and have the ability to apply some basic filtering and has his own Alerts (labels that appears with letter L, TP or SL).

All the alerts are defined under "Any alert() function call" and CAN NOT be configured separately, once you configure you will get all the following when the conditions met

"long : probable trading opportunity, price ..."
"short : probable trading opportunity, price ..."
"long : early warning : probable trading opportunity, awaiting confirmation (next candle), price ..."
"short : early warning : probable trading opportunity, awaiting confirmation (next candle), price ..."
"stop loss condition, price ..."

Early Warnings and STOP LOSS condition are repaint and to be used for early notification, when you receive this alert it does not mean the setup is ready.
“probable trading opportunity” are confirmed based on the option selected and main studies conditions

Backtest Framework filtering options
If NONE selected – ALERTS will be the same as with its STUDY version (explained in the first item). “probable trading opportunity” will be triggered on next bar

Selecting "Avoid Sudden Price Changes" or any of “Candle Direction as Confirmation” filtering options will lead the alerts the be triggered on the second bar. Selecting "❗❗❗ Simulate Trade on Next Bar : Only For Test Purpose (REPAINTS)" option will case to simulate on next bar but as the option states they are repaint
Erialos
@dgtrd, Regarding this and Long: Trading Opportunity alerts.

So the backtest uses the Long: trading opportunity, correct? Where the 'L' Marks are for any given chart, there should be 'Strong Longs' there as well too right? Assuming default settings and no confirmation on long/short in the extra options. I just want to be sure I deploy it how I'm seeing the backtest work is all.

I am not seeing strong longs in the same location as 'L' from the backtest. Is the 'Long: Trading Opportunity' following the backtest logic or would those alerts be whereever strong longs are marked on the chart?
dgtrd
hello @EffOfX,

So the backtest uses the Long: trading opportunity, correct?

backtest alerts are the ones configured with "Any alert() function call" and once alert configured with this opiton you will receive the folowing alerts

"long : probable trading opportunity, price ..."
"short : probable trading opportunity, price ..."
"long : early warning : probable trading opportunity, awaiting confirmation (next candle), price ..."
"short : early warning : probable trading opportunity, awaiting confirmation (next candle), price ..."
"stop loss condition, price ..."

early warnings are alerts received when backtest is enabled and warning sign apears on the chart

long alaer is received when "L" apears
short alerrt is received when "TP" apears

and stop loss when "SL" apears, where stop losss condition is subject to repaint and the sign may disapear so the alert is there to warn traders to watch closely



Erialos
@dgtrd, "Any alert() function call" --> I feel dumb, I thought this was a 'default' entry. I apologize for my confusion.

I am trying to set this up for a 3Commas bot, I'll probably need to code a new Alert. I'm unsure if you are familiar, but once you create a bot you just need to cut and paste the corresponding message inside the alert message and add the webhook url.

My tunnel vision gets me. Hahah. I guess I had the mind set of an alert for 'each step' if that makes sense.

Is the Strong Long indicator for the 'Long Probable..' alert?

Thank you again for clearing the above up.

**EDIT**
Just noticed the Any Alert Function Call doesn't have the message box i'd need for the webhook to work. Is it possible to get the backtest to have an alert, each for it's 'L' and 'TP' indicators?
dgtrd
hello @EffOfX, i do not have any experience with 3Commas bot but as understand the alerts created by alertcondition() functions are the ones you are able to use with the bot. i will try to consider this with next release of the backtest framework
Erialos
@dgtrd, Whoops, my message got deleted. lol, my mouse is double clicking when i do not want it to. NEW MOUSE TIME!

So these messages from 3commas work with their webhook. Each message they offer has different fuctions, turn on bot, stop bot, place market order, place market sell, start trailing....etc. etc.
One message per alert currently, TV support said they have the feature in the works to allow multiple messages for one webhook.

Thank you for you help so far as well!! Have a great weekend!
dgtrd
@EffOfX, :) thanks for the info. Have a great weekend too
More