Code pinescript vers ProBuilder
Forums › ProRealTime forum Français › Support ProBuilder › Code pinescript vers ProBuilder
- This topic has 2 replies, 2 voices, and was last updated 4 months ago by Emanuel_.
Viewing 3 posts - 1 through 3 (of 3 total)
-
-
07/02/2024 at 2:04 PM #234701
Bonjour à tous,
j’ai codé un indicateur dans trading_view avec pinescript et j’aimerais l’adapté pour pouvoir l’utilisé dans ProRealTime mais je ne trouve pas de documentation complète et donc je suis un peux perdu avec le langage.
Voici mon code :
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101//@version=5indicator("Parabolic SAR with High and Low Lines", overlay=true)// Calculate Parabolic SARsar = ta.sar(0.02, 0.02, 0.2)// Signalssignal_up = ta.crossover(close, sar)signal_down = ta.crossover(sar, close)// Variables to store the high and the low prices, and the start time of the linesvar float highPrice = navar float lowPrice = navar int highBar = navar int lowBar = navar line highLine = navar line lowLine = na// Check for signal_up and signal_downif (signal_up)highPrice := highhighBar := bar_index// Remove the previous lines if they existif (na(highLine) == false)line.delete(highLine)highLine := na // Reset the high line variableif (signal_down)lowPrice := lowlowBar := bar_indexif (na(lowLine) == false)line.delete(lowLine)lowLine := na // Reset the low line variable// Update the highest high and the lowest low between signal_up and signal_downif not na(highPrice)highPrice := math.max(highPrice, high)if not na(lowPrice)lowPrice := math.min(lowPrice, low)// Plot the horizontal lines from signal_up to signal_downif not na(highPrice) and not signal_down// Remove the previous high line if it existsif (na(highLine) == false)line.delete(highLine)highLine := line.new(highBar, highPrice, bar_index, highPrice, color=color.red, width=2)if not na(lowPrice) and not signal_up// Remove the previous low line if it existsif (na(lowLine) == false)line.delete(lowLine)lowLine := line.new(lowBar, lowPrice, bar_index, lowPrice, color=color.green, width=2)if signal_downhighPrice := nahighLine := na // Reset the high line variableif signal_uplowPrice := nalowLine := naplot(sar, style = plot.style_circles, linewidth = 1, color = sar < close ? color.green : color.red)Si quelqu’un saurait comment je peux faire des arrays et ensuite tracer mes lignes je suis preneurs, merci d’avance.
07/02/2024 at 4:11 PM #234705Holà. Vraiment pas de tableaux de fautes. De toutes les formes, il est programmé avec des tableaux pour que vous puissiez fonctionner.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051//------------------------------------------------------------//Psar=SAR[0.02,0.02,0.2]//----SignalssignalUP=close crosses over psarsignalDN=close crosses under psar//----Store pricesif signalUP then$price[t+1]=high$bar[t+1]=barindex$crossidx[t+1]=barindex$type[t+1]=1t=t+1elsif signalDN then$price[t+1]=low$bar[t+1]=barindex$crossidx[t+1]=barindex$type[t+1]=-1t=t+1endif//----Update prices between signalsif not signalUP and $type[t]=1 and high>$price[t] then$price[t]=high$bar[t]=barindexendifif not signalDN and $type[t]=-1 and low<$price[t] then$price[t]=low$bar[t]=barindexendif//----Parabolic Sar colorsif close < psar thenr=255g=0elser=0g=255endif//----Draw Parabolic Sar pointsdrawpoint(barindex,psar,2)coloured(r,g,0)//----Draw Horizontal linesif islastbarupdate thenfor i=t downto 1 doif $type[i]=1 thendrawsegment($crossidx[i],$price[i],$crossidx[i+1],$price[i])coloured("red")style(line,2)elsif $type[i]=-1 thendrawsegment($crossidx[i],$price[i],$crossidx[i+1],$price[i])coloured("green")style(line,2)endifnextendifreturn //psar as "P.Sar" coloured(r,g,0)style(dottedline,2)07/02/2024 at 4:15 PM #234707 -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
Find exclusive trading pro-tools on
Similar topics: