Help with Higher Lows Price sync with Higher Low MACD when candle crosses MA

Viewing 15 posts - 16 through 30 (of 73 total)
  • Author
    Posts
  • #106881 quote
    Malend
    Participant
    Average

    Oh…I am sorry Vonasi, I didn’t see that before. It showed up after I refreshed the internet link (F5 Windows). And that was after I posted. I will refresh my link before I post again. I keep learning :-).
    Thanks

    #106883 quote
    Malend
    Participant
    Average

    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.

    #106886 quote
    Malend
    Participant
    Average

    Hi 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?

    //start of cycle
    MD1 = LM(close) <= Signalline and LM[1] > LM(close)
     
    If MD1 then
    MCL = 1
    mclst = LM
    endif
     
    //END OF CYCLE LOW MACD
    MD2 = LM(close) => Signalline and LM[1] < LM(close)
     
    If MD2 then
    MCL = 0
    endif
     
    //lowest LM in cycle
    if mcl then
    mclst = min(mclst, LM)
    endif
     
    <br>
    #106887 quote
    Vonasi
    Moderator
    Master

    It’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.

    //start of cycle
    MD1 = 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 cycle
    MCL = 1// set a flag so we know we are in a low cycle
    mclst = LM// set a first value to compare against for our lowest LM 
    endif
     
    //END OF CYCLE LOW MACD
    MD2 = 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 ended
    MCL = 0 //turn the flag off so we know we are no longer in the cycle
    endif
     
    //lowest LM in cycle
    if mcl then //we are still in a cycle
    mclst = min(mclst, LM) //if this LM is lower than last value for mclst then make it the new value
    endif
    
    #106891 quote
    Malend
    Participant
    Average

    Thanks 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.

    #106893 quote
    Vonasi
    Moderator
    Master

    Something like this?

    //start of cycle
    MD1 = 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 cycle
    MCL = 1// set a flag so we know we are in a low cycle
    mclst = LM// set a start value to compare against for our lowest LM
    LowestLMPrice = LM//set a start value for price at lowest LM
    endif
     
    //END OF CYCLE LOW MACD
    MD2 = 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 ended
    MCL = 0 //turn the flag off so we know we are no longer in the cycle
    endif
     
    //lowest LM in cycle
    if mcl then //we are still in a cycle
    mclst = min(mclst, LM) //if this LM is lower than last value for mclst then make it the new value
    if mclst = LM then//if this LM is the same as the lowest then
    LowestLMPrice = close//store the price at lowest LM
    endif
    endif
    
    
    #106914 quote
    Malend
    Participant
    Average

    Hi 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 Signalline

    But 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.

    #106919 quote
    Malend
    Participant
    Average

    And the endresult I am looking or is to have a Signal when…… See this attachment.

    #106931 quote
    Vonasi
    Moderator
    Master

    This is how I would code it for finding the values at the bottom of the cycle. I’ve tested it and it works.

    macdl = macdline[12,26,9]
    macds = exponentialaverage[9](macdl)
     
    //start of cycle
    If macdl < macds and macdl[1] > macds[1] then 
    incycle = 1
    macdlowest = macdl
    LowestPrice = macdl
    endif
     
    //end of cycle
    If macdl > macds and macdl[1] < macds[1] then
    incycle = 0
    endif
     
    //lowest macd and price in cycle
    if incycle then 
    macdlowest = min(macdlowest, macdl) 
    if macdlowest = macdl then
    LowestPrice = low
    endif
    endif
    
    return macdlowest as "lowest macd in cycle", lowestprice as "lowest price in cycle"
    #106932 quote
    Malend
    Participant
    Average

    That is awesome !!! How do you test it? I mean where do you insert the indicator? In the chart? In the MACD? I only get a big white areau, no matter where I insert it.

    #106936 quote
    Vonasi
    Moderator
    Master

    Just add it as a separate indicator. It simply returns two lines so that you can check the values.

    Malend thanked this post
    #106956 quote
    Malend
    Participant
    Average

    Yes…. It works. You are a genious Vonasi. :-).
    I am gonna continue to find a way to get a Signal as in the attachment.
    Thanks a lot.
    Marc

    #106957 quote
    Vonasi
    Moderator
    Master

    If 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.

    #106964 quote
    Malend
    Participant
    Average

    No 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.

    #106976 quote
    Vonasi
    Moderator
    Master

    Finding the value of the previous MACD cycle low and price at that point is easy – we just store it when a new cycle starts.

    macdl = macdline[12,26,9]
    macds = exponentialaverage[9](macdl)
     
    //start of cycle
    If macdl < macds and macdl[1] > macds[1] then
    macdlowest2 = macdlowest
    lowestprice2 = lowestprice
    incycle = 1
    macdlowest = macdl
    LowestPrice = macdl
    endif
     
    //Eend of cycle
    If macdl > macds and macdl[1] < macds[1] then
    incycle = 0
    endif
     
    //lowest macd and price in cycle
    if incycle then
    macdlowest = min(macdlowest, macdl)
    if macdlowest = macdl then
    LowestPrice = low
    endif
    endif
    
    return 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"
    
Viewing 15 posts - 16 through 30 (of 73 total)
  • You must be logged in to reply to this topic.

Help with Higher Lows Price sync with Higher Low MACD when candle crosses MA


ProBuilder support

New Reply
Author
author-avatar
Malend @malend Participant
Summary

This topic contains 72 replies,
has 3 voices, and was last updated by GraHal
6 years, 4 months ago.

Topic Details
Forum: ProBuilder support
Language: English
Started: 09/06/2019
Status: Active
Attachments: 12 files
Logo Logo
Loading...