0
Suivre
0
Abonnés

S'il vous plaît, aidez-moi, comment puis-je mettre en œuvre le cycle de commande dans la stratégie de langage pine ? Maintenant, je ne peux passer qu'une seule commande mais pas de suivi

Créé le: 2022-11-14 10:11:47, Mis à jour le:
comments   7
hits   990

//@version=4 strategy(title=“EMA crosses”, overlay=true)

// Inputs priceData = input(title=“Price data”, type=input.source, defval=hl2) ema1Length = input(title=“EMA 1”, type=input.integer, defval=12) ema2Length = input(title=“EMA 2”, type=input.integer, defval=24) ema3Length = input(title=“EMA 3”, type=input.integer, defval=36)

// Compute values ema1 = ta.ema(priceData, ema1Length) ema2 = ta.ema(priceData, ema2Length) ema3 = ta.ema(priceData, ema3Length)

enterLong = ema1 > ema2 and ema2 > ema3 enterShort = ema1 < ema2 and ema2 < ema3

// Plot values plot(series=ema1, color=color.orange, linewidth=2) plot(series=ema2, color=color.maroon, linewidth=2) plot(series=ema3, color=color.blue, linewidth=2)

// Submit orders if (enterLong) strategy.entry(id=“Enter Long”, long=strategy.long)

if (enterShort) strategy.entry(id=“Enter Short”, long=strategy.short)

Pour le moment, il y a toujours une commande au début de la répétition, et les autres ne semblent pas être déclenchés, quel grand-père peut nous guider sur la façon de faire exécuter la boucle de stratégie, merci.