Jouer au cross

Auteur:ChaoZhang est là., Date: 2022-05-11 15h01:50
Les étiquettes:Le taux d'intérêt

Pour ce scénario, j'ai utilisé Kijun-sen de Ichimoku Cloud et de Moving Average.

Kijun-sen est la ligne de base du Nuage Ichimoku ou le prix moyen des 26 dernières périodes. La moyenne mobile est un prix moyen constamment mis à jour d'une fourchette donnée. Dans ce script j'ai utilisé les paramètres standard Kijun-sen et la moyenne mobile, 55 longueur.

Vous recevrez un signal rouge ou vert lorsque les lignes se croisent. Essayez l'indicateur vous-même pour voir pourquoi il pourrait être utile.

Un merci spécial à @norok et @happyCloud1537 pour m'avoir appris! Ça me donnera plus de scripts de mon côté, puisque j'aime vraiment programmer et échanger.

test de retour img


// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Glenn234

//@version=5
indicator("Playing the cross", shorttitle="PtC", overlay=true)

// Ichimoku code - Kijun-Sen
basePeriods = input.int(26, minval=1, title="Kijun-Sen length")
donchian(len) => math.avg(ta.lowest(len), ta.highest(len))

KijunSen = donchian(basePeriods)
plot(KijunSen, color=color.green, title="Kijun-Sen")


// Moving Average Exponential code
len = input.int(55, minval=1, title="EMA length")
src = input(close, title="Source")

MovingAverage = ta.ema(src, len)
plot(MovingAverage, title="EMA", color=color.red)


// Cross code
Up = MovingAverage > KijunSen and MovingAverage[1] < KijunSen[1]
Down = MovingAverage < KijunSen and MovingAverage[1] > KijunSen[1]

bgcolor(Up ? color.new(color.green, 60) : na, title="Up Cross")
bgcolor(Down ? color.new(color.red, 60) : na, title="Down Cross")

if Down
    strategy.entry("Enter Long", strategy.long)
else if Up
    strategy.entry("Enter Short", strategy.short)


Relationnée

Plus de