Code pinescript vers ProBuilder
- This topic has 2 replies, 2 voices, and was last updated 5 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
Similar topics:
Forums › ProRealTime forum Français › Support ProBuilder › Code pinescript vers ProBuilder
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 :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
//@version=5 indicator("Parabolic SAR with High and Low Lines", overlay=true) // Calculate Parabolic SAR sar = ta.sar(0.02, 0.02, 0.2) // Signals signal_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 lines var float highPrice = na var float lowPrice = na var int highBar = na var int lowBar = na var line highLine = na var line lowLine = na // Check for signal_up and signal_down if (signal_up) highPrice := high highBar := bar_index // Remove the previous lines if they exist if (na(highLine) == false) line.delete(highLine) highLine := na // Reset the high line variable if (signal_down) lowPrice := low lowBar := bar_index if (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_down if 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_down if not na(highPrice) and not signal_down // Remove the previous high line if it exists if (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 exists if (na(lowLine) == false) line.delete(lowLine) lowLine := line.new(lowBar, lowPrice, bar_index, lowPrice, color=color.green, width=2) if signal_down highPrice := na highLine := na // Reset the high line variable if signal_up lowPrice := na lowLine := na plot(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.
Holà. Vraiment pas de tableaux de fautes. De toutes les formes, il est programmé avec des tableaux pour que vous puissiez fonctionner.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
//------------------------------------------------------------// Psar=SAR[0.02,0.02,0.2] //----Signals signalUP=close crosses over psar signalDN=close crosses under psar //----Store prices if signalUP then $price[t+1]=high $bar[t+1]=barindex $crossidx[t+1]=barindex $type[t+1]=1 t=t+1 elsif signalDN then $price[t+1]=low $bar[t+1]=barindex $crossidx[t+1]=barindex $type[t+1]=-1 t=t+1 endif //----Update prices between signals if not signalUP and $type[t]=1 and high>$price[t] then $price[t]=high $bar[t]=barindex endif if not signalDN and $type[t]=-1 and low<$price[t] then $price[t]=low $bar[t]=barindex endif //----Parabolic Sar colors if close < psar then r=255 g=0 else r=0 g=255 endif //----Draw Parabolic Sar points drawpoint(barindex,psar,2)coloured(r,g,0) //----Draw Horizontal lines if islastbarupdate then for i=t downto 1 do if $type[i]=1 then drawsegment($crossidx[i],$price[i],$crossidx[i+1],$price[i])coloured("red")style(line,2) elsif $type[i]=-1 then drawsegment($crossidx[i],$price[i],$crossidx[i+1],$price[i])coloured("green")style(line,2) endif next endif return //psar as "P.Sar" coloured(r,g,0)style(dottedline,2) |
Find exclusive trading pro-tools on