Bonjour Nicolas,
Est il possible de fabriquer le même screener de sorties de triangle avec le code de Swapping ?
// Swapping Trendline area 3
//PRC_TrendLine_Area | Indicator 16.01.2019 (release 1.3)
//Nicolas @ www.prorealcode.com
// ( Modification du code "PRC_Quick Fib" afin de visualiser les lignes de tendances obliques ou leurs segments avec réglage de l'épaisseur des traits et les zones support ou resistance
// AJOUT de style(line,3) aux segments et lignes dans la version 3
Defparam calculateonlastbars = 100
DefParam DrawOnLastBarOnly = true
// --- property settings
//Period = 150 perso = 100 // Lookback period of the Fibonacci Retracement
//TrendLine = 0 // (0= Segment, 1= Trend Line)
//Fibonacci = 0 // (0= Empty, 1= Fibonacci)
//Invert = 0 // (0= Fibo normal, 1= Fibo invert)
//Area = 0 // (0= Empty, 1= Rectangle)
//Thickness = 2 // Thickness Area rectangle (default 2)
// --- end of settings
hh = 0
ll = low
shiftlowest = barindex
for i = period downto 1 do
if high[i]>hh then
hh = high[i]
shifthighest = barindex[i]
endif
if low[i]<ll then
ll = low[i]
shiftlowest = barindex[i]
endif
next
isSwingDown = shiftHighest < shiftLowest
if isSwingDown then
fullrange = abs(hh-ll)
fibo100 = hh
fibo0 = ll
fibo236 = ll+(fullrange*0.236)
fibo382 = ll+(fullrange*0.382)
fibo50 = ll+fullrange/2
fibo618 = ll+(fullrange*0.618)
fibo764 = ll+(fullrange*0.764)
startbar = min(shifthighest,shiftlowest)
r = 255 // Orange // rouge 200
g = 136 // Orange // rouge 0
b = 0 // rouge 0
DrawText("HI #hh#",shifthighest,hh+fullrange*0.03,dialog,standard,10) coloured(r,g,b) // plot price at 0% and 100% levels
DrawText("LO #ll#",shiftlowest,ll-fullrange*0.03,dialog,standard,10) coloured(r,g,b)
else
fullrange = abs(hh-ll)
fibo100 = ll
fibo0 = hh
fibo236 = hh-(fullrange*0.236)
fibo382 = hh-(fullrange*0.382)
fibo50 = hh-fullrange/2
fibo618 = hh-(fullrange*0.618)
fibo764 = hh-(fullrange*0.764)
startbar = min(shifthighest,shiftlowest)
r = 247 // Jaune // vert 0
g = 255 // Jaune // vert 200
b = 0 // Jaune // vert 0
DrawText("HI #hh#",shifthighest,hh+fullrange*0.03,dialog,standard,10) coloured(r,g,b) // plot price at 0% and 100% levels
DrawText("LO #ll#",shiftlowest,ll-fullrange*0.03,dialog,standard,10) coloured(r,g,b)
endif
if Fibonacci = 1 and invert = 0 then // plot fibonacci levels
DrawSegment(startbar,fibo0,barindex,fibo0) coloured(r,g,b)style (line,3)
DrawText(" 0%",barindex,fibo0,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo236,barindex,fibo236) coloured(r,g,b)style (line,3)
DrawText(" 23.6%",barindex,fibo236,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo382,barindex,fibo382) coloured(r,g,b)style (line,3)
DrawText(" 38.2%",barindex,fibo382,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo50,barindex,fibo50) coloured(r,g,b)style (line,3)
DrawText(" 50.0%",barindex,fibo50,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo618,barindex,fibo618) coloured(r,g,b)style (line,3)
DrawText(" 61.8%",barindex,fibo618,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo764,barindex,fibo764) coloured(r,g,b)style (line,3)
DrawText(" 76.4%",barindex,fibo764,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo100,barindex,fibo100) coloured(r,g,b)style (line,3)
DrawText(" 100%",barindex,fibo100,Dialog,Standard,20) coloured(r,g,b)
elsif Fibonacci = 1 and invert = 1 then // plot invert fibonacci levels
DrawSegment(startbar,fibo0,barindex,fibo0) coloured(r,g,b)style (line,3)
DrawText(" 100%",barindex,fibo0,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo236,barindex,fibo236) coloured(r,g,b)style (line,3)
DrawText(" 76.4%",barindex,fibo236,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo382,barindex,fibo382) coloured(r,g,b)style (line,3)
DrawText(" 61.8%",barindex,fibo382,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo50,barindex,fibo50) coloured(r,g,b)style (line,3)
DrawText(" 50.0%",barindex,fibo50,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo618,barindex,fibo618) coloured(r,g,b)style (line,3)
DrawText(" 38.2%",barindex,fibo618,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo764,barindex,fibo764) coloured(r,g,b)style (line,3)
DrawText(" 23.6%",barindex,fibo764,Dialog,Standard,20) coloured(r,g,b)
DrawSegment(startbar,fibo100,barindex,fibo100) coloured(r,g,b)style (line,3)
DrawText(" 0%",barindex,fibo100,Dialog,Standard,20) coloured(r,g,b)
endif
// contour lines
shiftContourDown = barindex-shiftHighest
highestSlope = 0
counth = max(1,(barindex-shifthighest))
for i = 2 to counth do
thisSlope = (high[i] - hh) / ((barindex-shiftHighest) - i)
if (thisSlope >= highestSlope or highestSlope = 0) then
shiftContourDown = i
highestSlope = thisSlope
endif
next
shiftContourUp = barindex-shiftLowest
LowestSlope = 0
countl = max(1,(barindex-shiftLowest))
for i = 2 to countl do
thisSlope = (low[i] - ll) / ((barindex-shiftLowest) - i)
if (thisSlope <= LowestSlope or LowestSlope = 0) then
shiftContourUp = i
LowestSlope = thisSlope
endif
next
// retracement blocks
if Area then
if isSwingDown then
blockprice = hh
startbar = barindex-shifthighest
for i = startbar downto 2 do
if low[i]<blockprice then
blockprice = low[i]
blockbar = barindex[i]
endif
next
//DrawRectangle(blockbar,blockprice,barindex,ll) coloured(r,g,b) // program init with box "DrawRectangleBlocks"
DrawRectangle(shifthighest,blockprice-(thickness),barindex,ll+(thickness)) coloured(r,g,b) // Option Zone with Thickness
else
blockprice = ll
startbar = barindex-shiftlowest
for i = startbar downto 2 do
if high[i]>blockprice then
blockprice = high[i]
blockbar = barindex[i]
endif
next
//DrawRectangle(blockbar,blockprice,barindex,hh) coloured(r,g,b) // program init with box "DrawRectangleBlocks"
DrawRectangle(blockbar+60,blockprice-(thickness),shiftlowest,hh+(thickness)) coloured(r,g,b) // Option Zone with Thickness
endif
endif
if TrendLine = 0 then
DrawSegment(shifthighest,hh,barindex[shiftcontourdown],high[shiftcontourdown]) coloured(r,g,b) style (line,3) // only Segment
DrawSegment(shiftlowest,ll,barindex[shiftcontourup],low[shiftcontourup]) coloured(r,g,b) style (line,3) // only Segment
elsif TrendLine = 1 and Invert = 0 then
DrawLine(shifthighest,hh,barindex[shiftcontourdown],high[shiftcontourdown]) coloured(r,g,b) style (line,3) // program init
DrawLine(shiftlowest,ll+(thickness),barindex[shiftcontourup],low[shiftcontourup]+(thickness)) coloured(r,g,b) style (line,3) // add double shiftlowest inside
DrawLine(shiftlowest,ll,barindex[shiftcontourup],low[shiftcontourup]) coloured(r,g,b) style (line,3) // program init
DrawLine(shifthighest,hh-(thickness),barindex[shiftcontourdown],high[shiftcontourdown]-(thickness)) coloured(r,g,b) style (line,3) // add double shifthighwest inside
else
DrawLine(shifthighest,hh,barindex[shiftcontourdown],high[shiftcontourdown]) coloured(r,g,b) style (line,3) // program init
DrawLine(shiftlowest,ll-(thickness),barindex[shiftcontourup],low[shiftcontourup]-(thickness)) coloured(r,g,b) style (line,3) // add double shifthilowest outside
DrawLine(shiftlowest,ll,barindex[shiftcontourup],low[shiftcontourup]) coloured(r,g,b) style (line,3) // program init
DrawLine(shifthighest,hh+(thickness),barindex[shiftcontourdown],high[shiftcontourdown]+(thickness)) coloured(r,g,b)style (line,3) // add double shifthighest outside
endif
return