Logistic RSI, STOCH, ROC, AO, ... by DGT

ที่อัปเดต:
Experimental attemt of applying Logistic Map Equation for some of widly used indicators.
With this study "Awesome Oscillator (AO)", "Rate of Change (ROC)", "Relative Strength Index (RSI)", "Stochastic (STOCH)" and a custom interpretation of Logistic Map Equation is presented

Calculations with Logistic Map Equation makes sense when the calculated results are iterated many times within the same equation.

Here is the Logistic Map Equation : Xn+1 = r * Xn * (1 - Xn)

Where, the value of r is the key for this equation which changes amazingly the behaviour of the Logistic Map.

The value we have asigned for r is less then 1 and greater than 0 ( 0 < r < 1) and in this case the iterations performed with the maximum number of output series allowed by Pine is quite enough for our purpose and thanks to arrays we can easiliy store them for further processing

What we have as output:
Each iteration result is then plotted (excluding plotting the first iteration), as circles or line based on user preference

สแนปชอต

สแนปชอต


Values above and below zero level (0) are coloured differently to emphasis bull and bear power

สแนปชอต

Finally Standard Deviation of Array's Elements is ploted as line. Users may choose to display this line only

สแนปชอต


So where it comes the indicators "Awesome Oscillator (AO)", "Rate of Change (ROC)", "Relative Strength Index (RSI)", "Stochastic (STOCH)".
Those are the indicators whose values are assigned to our key varaiable in the Logistic Map equation forulma which is r

สแนปชอต

Further details regarding Logistic Map can found under the description of “Logistic EMA w/ Signals by DGT” study

Logistic EMA w/ Signals by DGT


Disclaimer:
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
The script is for informational and educational purposes only. Use of the script does not constitute professional and/or financial advice. You alone have 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
เอกสารเผยแพร่
backtest ability added that will help to
- compare different techniques available within the study
- observe performance statistics of an financial instruments on different time frames
- observe performance statistics of different types of financial instruments (stocks, forex, crypto, etc)

optimization ability kept minimal to keep the study simpler

ps: multi time frame ability disabled
เอกสารเผยแพร่
it is better to have optimization ability ;-)

ability to change the length and source of the selected indicator and observe the performance effects.

ps : not applied to Awesome Oscillator (AO)
เอกสารเผยแพร่
little tweaking for labels, few more stats

also, added labels for entries and exits with some basic stats
เอกสารเผยแพร่
exit price calculation error fixed when stop loss condition meets

many many thanks for your highly valuable comments sotiri 🙏
เอกสารเผยแพร่
enchanced non-repainting backtest ability

thanks for the warning canpp
เอกสารเผยแพร่
typo correction

entry/exit price assumption default value changed to close
เอกสารเผยแพร่
Updates with this release

Enhancements in BackTest Framework

• 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 behaviour and all plottings, 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 what ever 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


• Early Warning : Alert + Label
As a rule as explaind 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 awerness, 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 immediatly 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 opoortunity 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.

Example of warning label
สแนปชอต


• 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 caculated 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 corss 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 inconsistancy that may apear on statistical panel and observe results of the trades executed without stop loss.



Other updates in Study

  • - Added stepline plotting option, beside line and dotted plotting
    - Added option to hide trading statistical panel
    - Increased Label plotting count
    - Finally, Organized Script Inputs in Sections

เอกสารเผยแพร่
have received so many request to add alerts for all conditions separately and this update includes them (both for Logistic 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

also, some cosmetic changes
เอกสารเผยแพร่
typo correction of alert messages
เอกสารเผยแพร่
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.

"❗❗❗ Simulate Trade on Next Bar : Only For Test Purpose (REPAINTS)", group = "Backtest Framework") 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

arraysbacktestDGTexperimentallogisticlogisticmapequationoptimizationRate of Change (ROC)Relative Strength Index (RSI)Stochastic Oscillatorstrategysuccessrate

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?

คำจำกัดสิทธิ์ความรับผิดชอบ