Bonjour les experts, pouvez vous m’aider à trouver un code qui puisse stopper mon trade quand il se trouve dans la configuration suivante (voir PJ), c’est à dire le stopper quand il est à son pic et éviter la chute qui arrive et annule la belle progression. Par avance merci.
Le voici, vous pouvez voir à partir des variables affichées avec GRAPH lorsque les modèles de sortie se produisent (à condition que l’opération soit en profit):
ONCE N = 10
Sma100 = average[100,0](close)
LongCond = close CROSSES OVER Sma100
ShortCond = close CROSSES UNDER Sma100
Body = abs(close - open)
BodyCond = Body > (range * 0.75) //Body must be > 75% of the range
RangeCond = range >= average[N,0](range)
Bullish = close > open
Bearish = close < open
HH = max(high,high[1]) = highest[N](high)
LL = min(low,low[1]) = lowest[N](low)
UpperSwing = HH AND Bearish AND Bullish[1] AND BodyCond AND RangeCond
LowerSwing = LL AND Bullish AND Bearish[1] AND BodyCond AND RangeCond
IF Not OnMarket THEN
IF LongCond THEN
BUY 1 CONTRACT AT MARKET
ELSIF ShortCond THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
SET TARGET pPROFIT 500
SET STOP pLOSS 100
ELSE
IF PositionPerf > 0 THEN
IF LongOnMarket AND UpperSwing THEN
SELL AT MARKET
ELSIF ShortOnMarket AND LowerSwing THEN
EXITSHORT AT MARKET
ENDIF
ENDIF
ENDIF
graph LongOnMarket AND (PositionPerf > 0) AND UpperSwing coloured("Red")
graph ShortOnMarket AND (PositionPerf > 0) AND LowerSwing coloured("Blue")
Bonjour Roberto, merci beaucoup, je dois donc insérer cette partie de code dans mon code original….jeune saisis pas trop la notion de graph.
Le code de Roberto (2 articles ci-dessus) ajouté en tant que journal 389 ici…
Bibliothèque de liens d’extraits
Je pense qu'on pourra rarement sortir au point le plus haut ou entrer au point le plus bas d'une opération… Pour tenter de sortir avant une correction vous pouvez utiliser par exemple un oscillateur comme RSI, Stochastic, CCI, etc. qui vous permettent de détecter les zones extrêmes.
@RICOU
Insérez cette partie dans votre code, peu importe où, tant que votre code ne contient pas de variables du même nom, auquel cas vous devrez la modifier même en ajoutant un seul caractère.
ONCE N = 10
Sma100 = average[100,0](close)
LongCond = close CROSSES OVER Sma100
ShortCond = close CROSSES UNDER Sma100
Body = abs(close - open)
BodyCond = Body > (range * 0.75) //Body must be > 75% of the range
RangeCond = range >= average[N,0](range)
Bullish = close > open
Bearish = close < open
HH = max(high,high[1]) = highest[N](high)
LL = min(low,low[1]) = lowest[N](low)
UpperSwing = HH AND Bearish AND Bullish[1] AND BodyCond AND RangeCond
LowerSwing = LL AND Bullish AND Bearish[1] AND BodyCond AND RangeCond
IF OnMarket AND PositionPerf > 0 THEN
IF LongOnMarket AND UpperSwing THEN
SELL AT MARKET
ELSIF ShortOnMarket AND LowerSwing THEN
EXITSHORT AT MARKET
ENDIF
ENDIF
Stratégie de sortie ci-dessus ajoutée en tant que journal 390 ici…
Snippet Link Library