convertir Un système de trading de la plateforme de tradingview
Forums › ProRealTime forum Français › Support ProBuilder › convertir Un système de trading de la plateforme de tradingview
- This topic has 4 replies, 2 voices, and was last updated 2 years ago by
Nicolas.
-
-
02/28/2023 at 10:38 PM #210682
Bonjour,
je vous serais éternellement reconnaissant de pouvoir me convertir Un système de trading de la plateforme de tradingview en système de trading automatique pour la plateforme prorealtime, donc vous trouverez en pièce jointe sur bloc note le code d’un système de trading ( SuperTrend STRATEGY de KivancOzbilgic ) de la plateforme trading View. Que je voudrais convertir en code pour la plateforme pro Real time.
les réglages de périodes ATR 10 et multiplicateur de 0.5 il doit être utilisé avec les bougies heikin Hachi en 30 min .
merci .// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © KivancOzbilgic//@version=4
strategy(“SuperTrend STRATEGY”, overlay=true)
Periods = input(title=”ATR Period”, type=input.integer, defval=10)
src = input(hl2, title=”Source”)
Multiplier = input(title=”ATR Multiplier”, type=input.float, step=0.1, defval=3.0)
changeATR= input(title=”Change ATR Calculation Method ?”, type=input.bool, defval=true)
showsignals = input(title=”Show Buy/Sell Signals ?”, type=input.bool, defval=false)
highlighting = input(title=”Highlighter On/Off ?”, type=input.bool, defval=true)
barcoloring = input(title=”Bar Coloring On/Off ?”, type=input.bool, defval=true)
atr2 = sma(tr, Periods)
atr= changeATR ? atr(Periods) : atr2
up=src-(Multiplier*atr)
up1 = nz(up[1],up)
up := close[1] > up1 ? max(up,up1) : up
dn=src+(Multiplier*atr)
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? min(dn, dn1) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
upPlot = plot(trend == 1 ? up : na, title=”Up Trend”, style=plot.style_linebr, linewidth=2, color=color.green)
buySignal = trend == 1 and trend[1] == -1
plotshape(buySignal ? up : na, title=”UpTrend Begins”, location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0)
plotshape(buySignal and showsignals ? up : na, title=”Buy”, text=”Buy”, location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
dnPlot = plot(trend == 1 ? na : dn, title=”Down Trend”, style=plot.style_linebr, linewidth=2, color=color.red)
sellSignal = trend == -1 and trend[1] == 1
plotshape(sellSignal ? dn : na, title=”DownTrend Begins”, location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0)
plotshape(sellSignal and showsignals ? dn : na, title=”Sell”, text=”Sell”, location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
mPlot = plot(ohlc4, title=””, style=plot.style_circles, linewidth=0)
longFillColor = highlighting ? (trend == 1 ? color.green : color.white) : color.white
shortFillColor = highlighting ? (trend == -1 ? color.red : color.white) : color.white
fill(mPlot, upPlot, title=”UpTrend Highligter”, color=longFillColor)
fill(mPlot, dnPlot, title=”DownTrend Highligter”, color=shortFillColor)
FromMonth = input(defval = 9, title = “From Month”, minval = 1, maxval = 12)
FromDay = input(defval = 1, title = “From Day”, minval = 1, maxval = 31)
FromYear = input(defval = 2018, title = “From Year”, minval = 999)
ToMonth = input(defval = 1, title = “To Month”, minval = 1, maxval = 12)
ToDay = input(defval = 1, title = “To Day”, minval = 1, maxval = 31)
ToYear = input(defval = 9999, title = “To Year”, minval = 999)
start = timestamp(FromYear, FromMonth, FromDay, 00, 00)
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59)
window() => time >= start and time <= finish ? true : false
longCondition = buySignal
if (longCondition)
strategy.entry(“BUY”, strategy.long, when = window())
shortCondition = sellSignal
if (shortCondition)
strategy.entry(“SELL”, strategy.short, when = window())
buy1= barssince(buySignal)
sell1 = barssince(sellSignal)
color1 = buy1[1] < sell1[1] ? color.green : buy1[1] > sell1[1] ? color.red : na
barcolor(barcoloring ? color1 : na)03/03/2023 at 10:35 AM #210835Merci de ne pas double poster, j’ai supprimé l’autre sujet.
Cette stratégie c’est un achat / vente sur Supertrend calculé avec le TotalPrice (soit le close d’une bougie HA).
12345678910111213141516171819202122232425262728293031323334353637defparam cumulateorders=false// Average True Range XATRx = AverageTrueRange[10](totalprice) * 0.5IF close crosses over ATRts THENtrend=1ATRts = close - ATRxr=0g=255ELSIF close crosses under ATRts THENtrend=-1ATRts = close + ATRxr=255g=0ENDIFIF close > ATRts THENATRnew = close - ATRxIF ATRnew > ATRts THENATRts = ATRnewENDIFELSIF close < ATRts THENATRnew = close + ATRxIF ATRnew < ATRts THENATRts = ATRnewENDIFENDIFif not longonmarket and trend=1 and trend[1]<>1 thenbuy at marketendifif not shortonmarket and trend=-1 and trend[1]<>-1 thensellshort at marketendifgraphonprice atrts coloured(r,g,0)03/03/2023 at 5:02 PM #210858bonjour
le système que vous avez fait ne fonctione pas proorder me renvoi le message d’erreur suivant : l’instruction ” GRAPH ” ne peut pas être utilise en trading automatique
Remerciements
03/03/2023 at 5:27 PM #210860ps : je travaille à 0.5 en taille de contrat, vous avez entré 1 contrat sur le système, cela est-il un problème parce que j’ai essayé en supprimant la ligne 37 de l’erreur GRAPH et ça fonctionne pas
03/07/2023 at 5:04 PM #211052Ci-dessous la version sans le graph et des lots à 0.5
1234567891011121314151617181920212223242526272829303132333435defparam cumulateorders=false// Average True Range XATRx = AverageTrueRange[10](totalprice) * 0.5IF close crosses over ATRts THENtrend=1ATRts = close - ATRxr=0g=255ELSIF close crosses under ATRts THENtrend=-1ATRts = close + ATRxr=255g=0ENDIFIF close > ATRts THENATRnew = close - ATRxIF ATRnew > ATRts THENATRts = ATRnewENDIFELSIF close < ATRts THENATRnew = close + ATRxIF ATRnew < ATRts THENATRts = ATRnewENDIFENDIFif not longonmarket and trend=1 and trend[1]<>1 thenbuy 0.5 contract at marketendifif not shortonmarket and trend=-1 and trend[1]<>-1 thensellshort 0.5 contract at marketendif -
AuthorPosts
Find exclusive trading pro-tools on