Reputation: 1
// Calcule le VWAP sur une période de 10 jours
vwap = vwap(10)
// Définit les bandes de VWAP comme étant +/- 2 écart-types du VWAP
vwap_lower_band = vwap - stdev(vwap, 10) * 2
vwap_upper_band = vwap + stdev(vwap, 10) * 2
// Vérifie si le prix actuel est inférieur à la bande inférieure de VWAP
if (close < vwap_lower_band) then
// Achete si le prix actuel est inférieur à la bande inférieure de VWAP
strategy.entry("Long", strategy.long)
// Vérifie si le prix actuel est supérieur à la bande supérieure de VWAP
if (close > vwap_upper_band) then
// Vends si le prix actuel est supérieur à la bande supérieure de VWAP
strategy.entry("Short", strategy.short)
I expected to get an error as always. I already added the version but i dont know how to solve the error
Upvotes: 0
Views: 1746
Reputation: 103
As well as removing the "then" statement..
Add:
//version=5
strategy("My Script")
At the top of your code
Change:
vwap(10)
For:
ta.vwap(10)
Change:
stdev
For:
ta.stdev
Also, you might need to Tab those strategy.entry() functions in another tab :)
Upvotes: 0