Retracement breakout with last few candles in Loop
Forums › ProRealTime English forum › ProBuilder support › Retracement breakout with last few candles in Loop
- This topic has 11 replies, 2 voices, and was last updated 1 year ago by amitoverseas40.
-
-
03/30/2023 at 7:41 PM #212580
Hi Team,
- Anyway I can code the price to buy only if the price reach at the open of bearish candle when condition is met…as of now SELL trade gets opened when condition is met and candle is down , I need that price to retrace to open or therebaouts instead of opening straightaway…on Dow Jones these 5 mins candles are sometimes 100+ points 🙂 I’d rather wait for price to retrace near open etc?
- Is there a way to code and point to a specific candle in last few bars..i.e. condition met for a bearish candle 5 or 7 bars ago..price went down as expected and now traced higher than bearish candle thus signalling a reversal…I trade manually since I do not know how to code that…vice versa for Bullish candle...?
Appreciate your help on this..
03/30/2023 at 8:56 PM #212581Please see attached PIC for example I have colour coded, it took 8 candles for the price to revert…I want someway to track this last candle when condition was met, in this scenario pink/magenta candle – so when price breaks above this candle, we go long!!
vice versa for short if blue breaks..
03/31/2023 at 8:55 AM #212590Please see attached PIC for example I have colour coded, it took 8 candles for the price to revert…I want someway to track this last candle when condition was met, in this scenario pink/magenta candle – so when price breaks above this candle, we go long!!
vice versa for short if blue breaks..
Any help please, not sure if it’s possible to have a for loop and track last candle that meets the condition?
03/31/2023 at 9:08 AM #212591Please don’t quote any of your message for each of your reply.
To check if the close of the current candle breaks one of the candlestick Close X bars ago (from minCandles to maxCandles) and with a retracement > minPoints, use the below code:
12345678910111213mincandles = 3maxcandles = 20minPoints = 20for i = mincandles to maxcandlesif close>close[i] and close[1]<close[i] and min(close,close[i])-lowest[max(1,i)](low)>minPoints*pointsize thendrawarrowup(barindex,low) coloured("green")drawsegment(barindex,min(close,close[i]),barindex[i],min(close,close[i])) style(dottedline2)breakendifnextreturn03/31/2023 at 9:22 AM #212596Hi Nicolas, apologies for duplication via quoting. Thank you for your response, appreciate it. Let me try and revert on the results.
03/31/2023 at 10:16 AM #212599Hi Nicolas,
My condition is simple: c1=close>high[1]
All I want is in a loop is when candle goes below , when this condition was met, an arrow should be drawn or segment as you kindly put in the code already.
I have tried but unable to get the result I expect. Would appreciate your help.
03/31/2023 at 10:23 AM #21260003/31/2023 at 10:32 AM #212602Sorry, goes below c1 (condition) i.e. c1=close>high[1]
So c1 occurred 8 or 10 candles ago , and price was consolidating or going higher, now close is going below c1 after 8-10 candles…I need the arrow/segment at this point please.
03/31/2023 at 10:43 AM #21260303/31/2023 at 10:51 AM #212604Hi Nicolas, sure, and many thanks for your assistance.
Please see the attached chart, I have tried to explain in a simple possible way according to my brain, hope it’s the same message coming across to you as well .
If you actually observe, there are 2 times candle closed below c1 condition. I have only highlighted last 1 for better visibility. it could be 4 candles or 8 when candle closed below c1.
03/31/2023 at 11:56 AM #212606this version plots c1 conditions tested and the arrow on the candle that close below the Open of the c1 candle.
12345678910111213141516minCandles = 3c1 = close>high[1]if c1 thentrigger=openbar=barindexdrawtext("c1",barindex,high)endifif barindex-bar>=minCandles and close crosses under trigger and trigger>0 thendrawarrowdown(barindex,high) coloured("red")trigger=0endifreturn1 user thanked author for this post.
03/31/2023 at 12:30 PM #212607minCandles = 3 c1 = close>high[1] if c1 then trigger=open bar=barindex drawtext(“c1”,barindex,high) endif if barindex-bar>=minCandles and close crosses under trigger and trigger>0 then drawarrowdown(barindex,high) coloured(“red”) trigger=0 endif return
Hi Nicolas, many many thanks for your help, much appreciate it! All works as expected, finally!
-
AuthorPosts
Find exclusive trading pro-tools on