The sole purpose of this script was to provide code snippets allowing one to easily convert their own script/strategy to include incremental order sizes. More control over your pyramiding orders.
**It may repaint, and was not intended for trading but more as an attempt to provide examples for more control with pyramiding.
Dans le plus pur esprit de TradingView, l'auteur de ce texte l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur ! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par les règles internes. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.
It may look like a lot to read, but once you get into it, you'll see that most of it is simply cutting and pasting while changing some numbers.
i have a script with similar structure in parts of the code.
Sometimes I want to run the script in version v4, but unfortunately I can't.
I think this line of code is the problem:
It causes problems when compiling in V4
last_long = long ? time : nz(last_long)
last_short = short ? time : nz(last_short)
Do you know a way to write your code in v4?
Can you encode the same function in v4 and share it as well?
Thanks for the great question.
These variables refer to themselves. In the later versions of Pine, we need now need to use mutable variables and declare it something first.
last_long = 0
last_short = 0
last_long := long? time : nz(last_long)
last_short := short ? time : nz(last_short)
I hope that helps.
PS. Shame on me for notupdating tit o Version 4. Just published the update now.
Thanks for the update.
Ah, such a simple change. I should have thought of it myself ;)
So thanks again.