gtfParticipant
New
Bonjour,
Je souhaite transformer ce code suivant de tradingview en prorealtime : rentrer en achat lorsque le cours est en dehors des Bollinger acec un stop sous le 5 dernier plus bas et objectif sur le 20 dernier plus haut
f open[1] < lwr[1] and close[1] < lwr[1] // Previous price lower than lower band and current close is higher than lower band
stop_level=lowest(5)
profit_level=highest(20)
strategy.entry(id=’bb_buy’,long=true)
strategy.exit(“TP/SL”,”bb_buy”,stop=stop_level,limit=profit_level)
if open[1] > upr[1] and close[1] > upr // Previous price is higher than higher band & current close is lower the higher band
stop_level=highest(5)
profit_level=lowest(20)
strategy.entry(id=’bb_sell’,long=false)
strategy.exit(“TP/SL”,”bb_sell”,stop=stop_level,limit=profit_level)
Bonjour Il n'y a pas de cohérence entre ce que dit le code et l'explication… Je vais vous donner un exemple : f open[1] < lwr[1] and close[1] < lwr[1] // Previous price lower than lower band and current close is higher than lower band Dans ce cas, le code dit que vous devez remplir deux conditions simultanément : 1.- l'ouverture de la barre précédente en dessous de la bande inférieure de Bollinger (je suppose que lwr fait référence à Bollinger car le code n'est pas complet soit que vous facilitiez) 2.- fermez la barre précédente en dessous de la bande de Bollinger inférieure. Cela n'est pas cohérent avec l'explication selon laquelle « la clôture actuelle est supérieure à la bande inférieure ». La question est donc la suivante. Voulez-vous la traduction littérale du code que vous avez fourni ou ce qu'il y a dans l'explication… ?
gtfParticipant
New
Bonjour,
Merci pour la prise en compte de ma demande.
Je n arrive pas a coder la stratégie suivante : lorsque le prix sort en dehors des bandes de bollinger basse ou haute ( une bulle ) je passe en position avec un stop sur le 5 derniers plus bas avec comme objectif le 5 dernier plus haut .
Muchas gracias para la ayuda
gtfParticipant
New
Bonjour,
Un complement j ouvre une position lorsque le cours apres une bulle reintégre la bande de bollinger avec un bas plus haut que le précedent et un haut plus haut que le precedent
Ici c'est
upr = bollingerup[20](close)
lwr = BollingerDown[20](close)
///setup long
b1 = close[1]<lwr[1] // if you want all candle below the line write high[1]<lwr[1]
b2 = close>lwr // if you want all candle above the line write low > lwr
b3 = high>high[1]
b4 = low>low[1]
setuplong = b1 and b2 and b3 and b4
if not onmarket and setuplong then
buy 1 shares at market
set stop price lowest[5](low)
set target price highest[20](high)
endif
//setup short
sh1 = close[1]>upr[1]// if you want all candle above the line write low[1]>upr[1]
sh2 = close<lwr// if you want all candle below the line write high < lwr
sh3 = low<low[1]
sh4 = high<high[1]
setupshort = sh1 and sh2 and sh3 and sh4
if not onmarket and setupshort then
sell 1 shares at market
set stop price highest[5](high)
set target price lowest[20](low)
endif
gtfParticipant
New
je teste tout a l’heure Gracias
gtfParticipant
New
est il possible d avoir pour entrer position un prix qui a le plus et le plus haut en dehors de la Bollinger ? avec un take profit mm7
gtfParticipant
New
j ai modifie cela fonctionne uniquement sur des positions longues
// Définition des paramètres du code
DEFPARAM CumulateOrders = False // Cumul des positions désactivé
upr = bollingerup[20](close)
lwr = BollingerDown[20](close)
///setup long
b1 = close[1]<lwr[1] // if you want all candle below the line write high[1]<lwr[1]
b5=high[1]<lwr[1]
b2 = close>lwr // if you want all candle above the line write low > lwr
b3 = high>high[1]
b4 = low>low[1]
setuplong = b1 and b2 and b3 and b4 and b5
if not onmarket and setuplong then
buy 1 shares at market
set stop price lowest[20](low)
set target price highest[20](high)
endif
//setup short
sh5= low[1]>upr[1]
sh1 = close[1]>upr[1]// if you want all candle above the line write low[1]>upr[1]
sh2 = close<lwr// if you want all candle below the line write high < lwr
sh3 = low<low[1]
sh4 = high<high[1]
setupshort = sh1 and sh2 and sh3 and sh4 and sh5
if not onmarket and setupshort then
sell 1 shares at market
set stop price highest[20](high)
set target price lowest[20](low)
endif