Lowest from Y1 to Y2
Forums › ProRealTime English forum › ProBuilder support › Lowest from Y1 to Y2
- This topic has 22 replies, 5 voices, and was last updated 2 years ago by ZeroCafeine.
-
-
03/10/2022 at 1:49 PM #189750
Hi all,
I saw the Lowest fonction can find a lowest of a variable on the last X periodes for exemple, but how to find a lowest between 2 barindex for exemple between Y1 and Y2 ?
for exemple on this photo how to find the lowest Low between Candle[5] and Candle[36] ( Y2=36 / Y1=5) ?entre ces 2 valeurs
03/10/2022 at 1:56 PM #189752From 5 to 36, there are 36-5+1 = 32 candles, we simply ask what was 5 candles ago the lowest among 32:
1234a=lowest[32](low)b=a[5]return b1 user thanked author for this post.
03/10/2022 at 2:00 PM #189753or if you want to easily change Y1 and Y2 (with Y2>Y1 implied, haven’t added an IF statement to protect against the opposite):
123456Y1=5Y2=36a=lowest[Y2-Y1+1](low)b=a[Y1]return b1 user thanked author for this post.
03/10/2022 at 3:56 PM #189767Lowest Low between candle[5] and candle[36]:
a = Lowest[36](Low[5])
1 user thanked author for this post.
03/11/2022 at 12:22 PM #189798tks to all for your answers,
and how to get the barindex number of this lowest candle ?
I saw some solution like doing a For y = 0 to 38 for exemple and compare the Lowest we get before with your solution with the Low[y] of each candle for get the barindex, but maybe they have other short soluttion ?
03/11/2022 at 12:56 PM #189801There you go:
1x = LowestBars[36](low[5]) //HighestBars for the highest1 user thanked author for this post.
03/11/2022 at 1:25 PM #189803tks for your answer but I’m totaly confused, I don’t understand why it’s not working or mabt I don’t know how to use it, with my result I find the barindex 21 the blue cyrcle but with yous I find barindex = 8 the red cyrcle, where I’m wrong ? I want the fast solution for using less of computer ic
123456789101112131415161718Defparam drawonlastbaronly = truea = Lowest[36](Low[13])// Roberto Solutionx = LowestBars[36](low[13])For i = 0 to 36 DoIF Low[i] = a ThenX1 = idrawtext("Barindex = #i#",barindex[i],Low[i])// Roberto Barindexdrawtext("Barindex = #x#",barindex[x],Low[x])breakENDIFNextReturnBest Reguards
03/11/2022 at 1:34 PM #189805This is my Elder Triple screen now and headache, I’m sure your solution will be on 2 or 3 lines 🤣🤣🤣
03/11/2022 at 2:36 PM #18980703/11/2022 at 4:33 PM #189809I don’t know why I don’t know to use you solution, but I found this one :
12345678910111213Defparam drawonlastbaronly = truea = Lowest[36](Low[13])// Roberto Solutionx = LowestBars[36](low[13])Roberto = 13 + xIF X Thendrawtext("RobertoIndex = #Roberto#",barindex[Roberto],Low[Roberto])ENDIFReturnif I the drawtext fonction with out IF condition, I get error because the LowestBars fonction can get -1 as a result
now the good barindex is 22 instead 21 because I got one candle more in H4 TF
03/11/2022 at 5:18 PM #189813Because the 13th bar is bar 12 (0 to 12 is 13 bars), so you will have to adjust your calculations.
1 user thanked author for this post.
03/11/2022 at 5:28 PM #18981403/12/2022 at 8:39 AM #189842It is of course possible I misunderstood the initial query, or even if I hadn’t I would easily concede perhaps I made the explanation too short alongside my proposal. But I would have to respectfully disagree with the other proposal.
If you write: a = Lowest[36](Low[5]) , it doesn’t give you the lowest low between candle[5] and candle[36], it would give the lowest low below candle[5] and candle[41], because at candle[36] what was lowest[5] at that time is a lowest[41] seen from now. So on one hand yes it would easily get rid of unwanted candles[0] through [4] in the search, but on the other hand it adds unwanted extra 5 candles [37] through [41] beyond [36].
Which is why I suggested: to first assess the span of the search (Y2–Y1+1 = 36-5+1 = 32 candles wide), to search that span for lowest low (that’s “a”), and from there to offset it by Y1=5 (that’s “b”), with:
1234Y1=5Y2=36a=lowest[Y2-Y1+1](low)b=a[Y1]as a way of eliminating candles [0] through [4] and simultaneously avoiding addition of unwanted extra candles beyond Y2 at the other end of the spectrum in the search interval.1 user thanked author for this post.
03/12/2022 at 10:05 AM #189848Hi @JC_Bywan,
You are right about adding 5 extra candles…
The starting point is low[5] and from there your look back period is [36] = 5 + 36
So this must also give the right answer: a = Lowest[Y2-Y1+1](Low[Y1])
1 user thanked author for this post.
03/12/2022 at 7:48 PM #189887Perhaps a system can be made of this?
When you know where the Lowest Low (LL) and the Highest High (HH) occur, you can say in the simplest form;
When the HH occurs after the LL then you are in an ascending phase and vice versa when the LL occurs after the HH then you are in a downward phase.
With the formulas:
LLBar = LowestBars[n](Low) you determine the bar where the LL occurs
HHBar = HighestBars[n](High) you determine the bar where the HH occurs
When LLBar > HHBar (Bullish)
When LLBar < HHBar (Bearish)
Of course, this is the simplest form but maybe with MTF, SL, TP, etc. we can improve this system.
LLBar HHBar12345678910111213DefParam CumulateOrders = FalseLLBar = LowestBars[n](Low)HHBar = HighestBars[n](High)If LLBar > HHBar thenBuy 1 Contracts at MarketElsIf LlBar < HHBar thenSellShort 1 Contracts at MarketEndIfGraph LLBar as "LowestBar"Graph HHBar as "HighestBar"1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on