Help with Higher Lows Price sync with Higher Low MACD when candle crosses MA
Forums › ProRealTime English forum › ProBuilder support › Help with Higher Lows Price sync with Higher Low MACD when candle crosses MA
- This topic has 72 replies, 3 voices, and was last updated 5 years ago by GraHal.
-
-
09/08/2019 at 6:51 PM #10688109/08/2019 at 7:18 PM #106883
Oh…. I am sorry Vonasi, I didn’t see your posts from 09/08/2019 at 3:58 PM and 09/08/2019 at 4:03 PM. I just found out I have to refresh my link to see the new post. So I just saw them after I posted the last coding. I thought it would refesh automatically. I keep learning.
I am take your comments and I am working on them rght now, Thanks a lot.09/08/2019 at 8:25 PM #106886Hi Vonasi, I attached your past down here again, because I don’t understand the connection between mclst = LM in line 6 and mclst = min(mclst, LM) in line 18. The line 6 is actually not valid because there is no end of the MACD Cycle Low defined. And what is <br> (break line?) at the bottom? Do I need that here?
123456789101112131415161718192021//start of cycleMD1 = LM(close) <= Signalline and LM[1] > LM(close)If MD1 thenMCL = 1mclst = LMendif//END OF CYCLE LOW MACDMD2 = LM(close) => Signalline and LM[1] < LM(close)If MD2 thenMCL = 0endif//lowest LM in cycleif mcl thenmclst = min(mclst, LM)endif<br>09/08/2019 at 9:23 PM #106887It’s easier if you post a complete code as otherwise I have to go back and find out what variables actually are!
I have no idea how the <br> got in the code – delete it.
Have you found and read the documentation here as most of the answers to your questions can be found in there:
https://www.prorealcode.com/prorealtime-documentation/
Here is your code with some notes.
12345678910111213141516171819//start of cycleMD1 = LM(close) <= Signalline and LM[1] > LM(close)//your condition to say we are in a cycle (I have no idea if it is correct!)If MD1 then //we are in a low cycleMCL = 1// set a flag so we know we are in a low cyclemclst = LM// set a first value to compare against for our lowest LMendif//END OF CYCLE LOW MACDMD2 = LM(close) => Signalline and LM[1] < LM(close)// your conditions to say we are out of a cycle (I have no idea if they are correct!)If MD2 then// our cycle has endedMCL = 0 //turn the flag off so we know we are no longer in the cycleendif//lowest LM in cycleif mcl then //we are still in a cyclemclst = min(mclst, LM) //if this LM is lower than last value for mclst then make it the new valueendif09/09/2019 at 12:09 AM #106891Thanks a lot for the ProRealTime documentation link. That is really helpfull.
What I see is that most of the periods are based on number of bars. Like what is the lowest MACDline over the last 25 bars.
What I am looking for is how to define a whole period when the MACDline < ExponentialAverage(Mline) and how to define/name the lowest MACDline in that period, and to define and name the Price Low at the bar with the Lowest MACD line. These period don’t happen in a fixed number of bars.
This is the essence of what I am working on.
09/09/2019 at 1:14 AM #106893Something like this?
1234567891011121314151617181920212223//start of cycleMD1 = LM(close) <= Signalline and LM[1] > LM(close)//your condition to say we are in a cycle (I have no idea if it is correct!)If MD1 then //we are in a low cycleMCL = 1// set a flag so we know we are in a low cyclemclst = LM// set a start value to compare against for our lowest LMLowestLMPrice = LM//set a start value for price at lowest LMendif//END OF CYCLE LOW MACDMD2 = LM(close) => Signalline and LM[1] < LM(close)// your conditions to say we are out of a cycle (I have no idea if they are correct!)If MD2 then// our cycle has endedMCL = 0 //turn the flag off so we know we are no longer in the cycleendif//lowest LM in cycleif mcl then //we are still in a cyclemclst = min(mclst, LM) //if this LM is lower than last value for mclst then make it the new valueif mclst = LM then//if this LM is the same as the lowest thenLowestLMPrice = close//store the price at lowest LMendifendif09/09/2019 at 9:36 AM #106914Hi Vonasi,
Line 2: I was wondering if the second condition is correct, because when the LM < Signalline there will be a moment when the LM starts to move upwards, but the LM is still below the Signalline. And then we are still in the Cycle low. In your description the cycle low stops when the LM starts to move upwards and the cycle stops when the LM => Signalline.My idea to crack this cookie is to find a way to pinpoint the starting and the ending of the cycle low. That is easy. But then to pinpoint the bar with the lowest MACDline value and the lowest Price in between those 2 points is where I get stuck. See my attachment what I am looking for.
So the starting point of the cycle is when:
MD1 = LM(close) <= Signalline and LM[1]=>Signalline[1] ……………….or another way to descibe it ………….Mline crosses under Signalline
The end point of the cycle low is when:
D1 = LM(close) >= Signalline and LM[1]=<Signalline[1] ……………….or another way to descibe it ………….Mline crosses over SignallineBut now I only have pinpointed the start and ending. the next step is to pinpoint the bar with the lowest MACDline between those two points. And that is where I get stuck.
09/09/2019 at 10:01 AM #10691909/09/2019 at 11:45 AM #106931This is how I would code it for finding the values at the bottom of the cycle. I’ve tested it and it works.
123456789101112131415161718192021222324macdl = macdline[12,26,9]macds = exponentialaverage[9](macdl)//start of cycleIf macdl < macds and macdl[1] > macds[1] thenincycle = 1macdlowest = macdlLowestPrice = macdlendif//end of cycleIf macdl > macds and macdl[1] < macds[1] thenincycle = 0endif//lowest macd and price in cycleif incycle thenmacdlowest = min(macdlowest, macdl)if macdlowest = macdl thenLowestPrice = lowendifendifreturn macdlowest as "lowest macd in cycle", lowestprice as "lowest price in cycle"09/09/2019 at 11:55 AM #10693209/09/2019 at 12:09 PM #10693609/09/2019 at 1:36 PM #10695609/09/2019 at 1:40 PM #106957If you are wanting to compare the latest lowest point in a cycle to the previous one then you have the issue that you will not know what the latest low of a cycle is until the cycle has ended by which time you have missed the boat.
09/09/2019 at 2:03 PM #106964No I don’t want to compare that.
.
What I want to compare is
WHEN
-1) a new cycle low has started
-2) and a candle crosses over the SMA50 after the candle is closed (open < SMA 50 and close > SMA50)THEN
– if the lowest price of that crossing candle is higher thean the lowest of the price of previous cycle low
AND
– if the MACD of that crossing candle is higher then the lowest MACD of the previous cycle low.
.See attachment.
09/09/2019 at 2:52 PM #106976Finding the value of the previous MACD cycle low and price at that point is easy – we just store it when a new cycle starts.
1234567891011121314151617181920212223242526macdl = macdline[12,26,9]macds = exponentialaverage[9](macdl)//start of cycleIf macdl < macds and macdl[1] > macds[1] thenmacdlowest2 = macdlowestlowestprice2 = lowestpriceincycle = 1macdlowest = macdlLowestPrice = macdlendif//Eend of cycleIf macdl > macds and macdl[1] < macds[1] thenincycle = 0endif//lowest macd and price in cycleif incycle thenmacdlowest = min(macdlowest, macdl)if macdlowest = macdl thenLowestPrice = lowendifendifreturn macdlowest as "lowest macd in cycle", lowestprice as "lowest price in cycle", macdlowest2 as "previous lowest macd in cycle", lowestprice2 as "previous lowest price in cycle" -
AuthorPosts
Find exclusive trading pro-tools on