Création d’un screener ob block
Forums › ProRealTime forum Français › Support ProScreener › Création d’un screener ob block
- This topic has 1 reply, 2 voices, and was last updated 6 months ago by Iván.
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
06/10/2024 at 3:09 PM #233686
Bonjour,
Sur la base de l’indicateur suivant modifié par @ivan qui se place dans une fenêtre sous le prix, j’aimerais avoir le code d’un screener détectant les instruments dont la valeur de l’indicateur est +1 et -1.
Merci d’avance pour votre aide.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155// Sonarlabs - Order Block Finder// converted from TradingView// Lower the sensitivity to show more order blocks. A higher sensitivity will show less order blocksdefparam drawonlastbaronly=trueTransparency = 80sens = 0once obcreatedbear = 0once obcreatedbull = 0once crossindexbear = 0once crossindexbull = 0// Custom Rate of Change (ROC) calculation. This is to calculate high momentum moves in the market.pc = ((open - open[4]) / open[4]) * 100// -----------------sens = sens/100 //ExponentialAverage[8](pc) //sens/100OBBullMitigation = close[1]OBBearMitigation = close[1]// If the ROC crossover our Sensitivty input - Then create a Bearish Order Block// Sensitivty is negative as this is a Bearish OBif pc crosses under -sens thenobcreatedbear = 1crossindexbear = barindexendif// If the ROC crossover our Sensitivty input - Then create a Bullish Order Blockif pc crosses over sens thenobcreatedbull = 1crossindexbull = barindexendif////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Calculation////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------------// Bearish OB Creation// -------------------------------// Check if we should create a OB. Also check if we haven't created an OB in the last 5 candles.if obcreatedbear and (crossindexbear - crossindexbear[1]) > 5 thenlastgreen = 0hhighest = 0// Loop through the most recent candles and find the first GREEN (Bullish) candle. We will place our OB here.for i = 4 to 15if close[i] > open[i] thenlastgreen = i//populate the arrays of order block to draw them later$left[plot]= barindex[lastgreen]$top[plot]=high[lastgreen]$bottom[plot]=low[lastgreen]$right[plot]=barindex[lastgreen]plot=plot+1 //increase the array column for next databreakendifnextendif// -------------------------------// Bullish OB Creation// -------------------------------// Check if we should create a OB, Also check if we haven't created an OB in the last 5 candles.if obcreatedbull and (crossindexbull - crossindexbull[1]) > 5 thenlastred = 0hhighest = 0// Loop through the most recent candles and find the first RED (Beaarish) candle. We will place our OB here.for ibull = 4 to 15if close[ibull] < open[ibull] thenlastred = ibull//populate the arrays of order block to draw them later$leftbull[plotbull]= barindex[lastred]$topbull[plotbull]=high[lastred]$bottombull[plotbull]=low[lastred]$rightbull[plotbull]=barindex[lastred]plotbull=plotbull+1 //increase the array column for next databreakendifnextendif////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Cleanup//////////////////////////////////////////////////////////////////////////////////////////////////////////////////Clean up Bearish OB boxesif plot>0 thenfor j = plot-1 downto 0 //0 to plot-1// If the two last closes are above the high of the bearish OB - Remove the OBif $left[j]>0 then //check if the zone still existitop = $top[j]breakout = summation[max(1,barindex-$left[j])](OBBearMitigation>itop)>=1 //2if breakout then$left[j]=0endifendifnextendif//Clean up Bullish OB boxesif plotbull>0 thenfor jbull = plotbull-1 downto 0 //0 to plotbull-1// If the two last closes are below the low of the bullish OB - Remove the OBif $leftbull[jbull]>0 then //check if the zone still existibot = $bottombull[jbull]breakoutbull = summation[max(1,barindex-$leftbull[jbull])](OBBullMitigation<ibot)>=1if breakoutbull then$leftbull[jbull]=0endifendifnextendif////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Drawing////////////////////////////////////////////////////////////////////////////////////////////////////////////////if islastbarupdate then//plot the Bearish boxesif plot>0 then //islastbarupdate andfor j = plot-1 downto 0 //0 to plot-1if $left[j]>0 then//drawrectangle($left[j],$top[j],barindex,$bottom[max(0,j)]) coloured("red",Transparency)bordercolor("red",Transparency)for k=0 to barindex doif barindex[k]>$left[max(0,j)] and high[k] > $bottom[max(0,j)] and high[k]<$top[max(0,j)] thendrawrectangle(barindex[k],0,barindex[k],-1)coloured("red")endifnextendifnextendif//plot the Bullish boxesif plotbull>0 then //islastbarupdate andfor jbull = plotbull-1 downto 0 //0 to plotbull-1if $leftbull[jbull]>0 then//drawrectangle($leftbull[jbull],$bottombull[jbull],barindex,$topbull[jbull]) coloured("green",Transparency)bordercolor("green",Transparency)for i=0 to barindex doif barindex[i]>$leftbull[max(0,jbull)] and low[i] < $topbull[max(0,jbull)] and low[i]>$bottombull[max(0,jbull)] thendrawrectangle(barindex[i],0,barindex[i],1)coloured("green")endifnextendifnextendifendifreturn06/10/2024 at 4:59 PM #233698salut. Vous avez contesté dans le fil antérieur. Voici le code :
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126sens = 0once obcreatedbear = 0once obcreatedbull = 0once crossindexbear = 0once crossindexbull = 0// Custom Rate of Change (ROC) calculation. This is to calculate high momentum moves in the market.pc = ((open - open[4]) / open[4]) * 100// -----------------sens = sens/100 //ExponentialAverage[8](pc) //sens/100OBBullMitigation = close[1]OBBearMitigation = close[1]// If the ROC crossover our Sensitivty input - Then create a Bearish Order Block// Sensitivty is negative as this is a Bearish OBif pc crosses under -sens thenobcreatedbear = 1crossindexbear = barindexendif// If the ROC crossover our Sensitivty input - Then create a Bullish Order Blockif pc crosses over sens thenobcreatedbull = 1crossindexbull = barindexendif////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Calculation////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------------// Bearish OB Creation// -------------------------------// Check if we should create a OB. Also check if we haven't created an OB in the last 5 candles.if obcreatedbear and (crossindexbear - crossindexbear[1]) > 5 thenlastgreen = 0// Loop through the most recent candles and find the first GREEN (Bullish) candle. We will place our OB here.for i = 4 to 15if close[i] > open[i] thenlastgreen = i//populate the arrays of order block to draw them later$left[plot]= barindex[lastgreen]$top[plot]=high[lastgreen]$bottom[plot]=low[lastgreen]$right[plot]=barindex[lastgreen]plot=plot+1 //increase the array column for next databreakendifnextendif// -------------------------------// Bullish OB Creation// -------------------------------// Check if we should create a OB, Also check if we haven't created an OB in the last 5 candles.if obcreatedbull and (crossindexbull - crossindexbull[1]) > 5 thenlastred = 0// Loop through the most recent candles and find the first RED (Beaarish) candle. We will place our OB here.for ibull = 4 to 15if close[ibull] < open[ibull] thenlastred = ibull//populate the arrays of order block to draw them later$leftbull[plotbull]= barindex[lastred]$topbull[plotbull]=high[lastred]$bottombull[plotbull]=low[lastred]$rightbull[plotbull]=barindex[lastred]plotbull=plotbull+1 //increase the array column for next databreakendifnextendif////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Cleanup//////////////////////////////////////////////////////////////////////////////////////////////////////////////////Clean up Bearish OB boxesif plot>0 thenfor j = plot-1 downto 0 //0 to plot-1// If the two last closes are above the high of the bearish OB - Remove the OBif $left[j]>0 then //check if the zone still existitop = $top[j]breakout = summation[max(1,barindex-$left[j])](OBBearMitigation>itop)>=1 //2if breakout then$left[j]=0endifendifnextendif//Clean up Bullish OB boxesif plotbull>0 thenfor jbull = plotbull-1 downto 0 //0 to plotbull-1// If the two last closes are below the low of the bullish OB - Remove the OBif $leftbull[jbull]>0 then //check if the zone still existibot = $bottombull[jbull]breakoutbull = summation[max(1,barindex-$leftbull[jbull])](OBBullMitigation<ibot)>=1if breakoutbull then$leftbull[jbull]=0endifendifnextendif////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Drawing////////////////////////////////////////////////////////////////////////////////////////////////////////////////if islastbarupdate then//plot the Bearish boxesif plot>0 then //islastbarupdate andfor j = plot-1 downto 0 //0 to plot-1if $left[j]>0 then//drawrectangle($left[j],$top[j],barindex,$bottom[max(0,j)]) coloured("red",Transparency)bordercolor("red",Transparency)if barindex>$left[max(0,j)] and high > $bottom[max(0,j)] and high<$top[max(0,j)] thensignal=-1elsesignal=0endifendifnextendif//plot the Bullish boxesif plotbull>0 then //islastbarupdate andfor jbull = plotbull-1 downto 0 //0 to plotbull-1if $leftbull[jbull]>0 thenif barindex>$leftbull[max(0,jbull)] and low < $topbull[max(0,jbull)] and low>$bottombull[max(0,jbull)] thensignalbull=1elsesignalbull=0endifendifnextendifendifscreener[signal or signalbull](signal as "SignalBear",signalbull as "SignalBull") -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on
Similar topics: