Example how to select and set date range window to be backtested. Normally when you change chart period it changes the number of days being backtested which means as you increas the chart period (for example from 5min to 15min) you also increase the number of days traded, so you can not compare apples to apples for which period would yield best returns for your...
*** THIS IS JUST AN EXAMPLE OF STRATEGY RISK MANAGEMENT CODE IMPLEMENTATION ***
For my own future reference, and for anyone else who needs it.
Pine script strategy code can be confusing and awkward, so I finally sat down and had a little think about it and put something together that actually works (i think...)
Code is commented where I felt might be necessary...
An example of binary option arrows for candlestick patterns bearish and bullish harami. With results as colored background and an option to choose your expiration (one candle by default). It's just an example for those who has their own strategy and wants to make nice arrows in their chart. All you need to do is rewrite piece of script in lines 9:13 - feel free to...
Simple script to view Heiken-Ashi candles below a normal candles chart.
Could also be useful for using HA calcs in strategy scripts on normal candles chart for proper backtesting.
I adapted this to v4 from original v2 script by @samtsui. If you like please remember to give him a Thumbs Up for his original version! ->...
An example of Binary Option Arrows (BOA) for candlestick patterns bearish and bullish harami.
With results as coloured background and an option to choose your expiration (one candle by default).
It's just an example for those who has their own strategy and wants to make nice arrows in their chart.
All you need to do is rewrite piece of script in lines 9:13 -...
Example of how to apply and use Dynamic Zones with an indicator by injecting it's source into my adaptation of the original idea by Leo Zamansky, Ph.D., and David Stendahl.
• Load your desired oscillating indicator on your chart (CCI, RSI, etc).
• Load my "How To Use Dynamic Zones" indicator on your chart.
• In the "How To Use Dynamic Zones" indicator settings...
Example how to automatically set the date range window to be backtested from X days or weeks ago to present. Additional options are also included to manually set the date range or to show entire range available.
Normally when you change chart period it changes the number of days being backtested, which means as you increase the chart period (for example from 5min...
Example how to backtest specific date(s) which can be useful for testing seasonality strategy ideas such as "Sell in May", etc.
If using Daily period with wild card dates it will not trade on 1st day of month. If market is closed will trade on next open day.
Works only with Daily or lower timeframes. When using on Daily timeframe set dates 1 day earlier to...
*** THIS IS JUST AN EXAMPLE OF STRATEGY TIME LIMITING CODE IMPLEMENTATION ***
This is a follow up to my example for risk management implementation here:
Code remains mostly unchanged, but now includes a time limiting implementation.
Relevant code blocks for the time factor are...
Simple signals example for Risk Management Wrapper
The unique part is that there is a single variable used for both Buy and Sell conditions.
Technically, a variable can have an infinity of values, so why not use that in our favour.
A value of -1 is used for the SELL alert condition, and a value of +1 is used for the BUY alert condition.
The Risk Management...
Pinescript v3 Compatibility Framework (v4 Migration Tool)
This code makes most v3 scripts work in v4 with only a few minor changes below. Place the framework code before the first input statement.
You can totally delete all comments.
- to port to v4 you only need to make a few simple changes, not affecting the core v3 code functionality