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...
type: pine series basic example
time required: 10 minutes
level: medium (need to know the "array" data variable as a generic programming concept, basic Pine syntax)
tl;dr how variables and series work in Pine
Pine is an array/vector language. That's something that twists how it behaves, and how we have to think about it. A lot of misunderstandings come from...
This simple strat fires up on green bars, down on red bars. cannot get any simpler. So, it's a good example to check how returns are calculated.
First, the internal firing mechanism for the strategy.entry function is something hardcore. As result, the entry points can be confusing, and seem to appear in a wrong bar (as the 2nd and 3rd signals are good examples),...
Pine's implementation of the security() function behaves differently in realtime vs. historical bars. Specifically, for historical bars, calling security() for a time frame (TF) larger/slower than the current chart's TF will return information about the last completed bar of the higher TF. However, for realtime bars (i.e. if you allow the chart to...
In this second tutorial we build upon the previous tutorial. We add color shading for each different day and highlight Wednesday.
The idea here is to manually count if on Wednesdays close is bigger then open.
Hope it helps.
Feel free to comment.
If you are just like me and cant just get your head around pine script, I have created this simple code so you get the main concept.
Unfortunately there are no good step by step tutorials out there teaching scripting.
Hope this helps.
Comments are welcome.
Um tutorial introdutório para quem está interessado em aprender a linguagem PINE para criar indicadores e backtests. Neste primeiro vídeo, explico alguns conceitos básicos e mostro como criar um indicador de médias com um filtro de cor.
Criei também um canal para quem quiser conversar sobre o assunto.
Vídeo --> www.filedropper.com
I was curious to see what Pine uses to accumulate numbers. It looks like it uses the simple "add em up" approach, rather than a compensated summation. This means that especially for large numbers, there is an inherent error amount.
This script implements the Kahan Summation Algorithm, also known as compensated summation....
While trying to figure out how to make the STDEV function use an exponential moving average instead of simple moving average , I discovered the builtin function doesn't really use either.
Check it out, it's amazing how different the two-pass algorithm is from the builtin!
Eventually I reverse-engineered and discovered that STDEV uses the Naiive algorithm and...