This script is for a triple moving average indicator where the user can select from different types of moving averages. It is meant as an educational script with well formatted styling, and references for specific functions.
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),...
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...
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....
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