Adaption/addition to Last man standing indicator

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #221006 quote
    edktradingedktrading
    Participant
    New

    Hi, I am using https://www.prorealcode.com/prorealtime-indicators/lastmanstanding-swing-indicator/.

    Is it possible to draw a line between the last minor highs and the last minor lows. And how can I realize that?

    See attatchment and code below.

    Thanx in advance, Erik

    //PRC_LastManStandingIndicator | indicator
    //14.11.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //translated from MQL4 code
    
    // --- settings
    PeriodsInMajorSwing=13
    PeriodsInMinorSwing=5
    MovingAverageMethod=1
    MovingAveragePeriods= 55
    // --- end of settings
    
    EMA = average[MovingAveragePeriods,MovingAverageMethod](close)
    
    hhminorprice=0
    llminorprice=close*1000
    for i = 1 to PeriodsInMinorSwing*2 do
    if high[i]>hhminorprice then
    hhminorbar = barindex[i]
    hhminorprice = high[i]
    endif
    if low[i]<llminorprice then
    llminorbar=barindex[i]
    llminorprice=low[i]
    endif
    next
    
    hhmajorprice=0
    llmajorprice=close*1000
    for i = 1 to PeriodsInMajorSwing*2 do
    if high[i]>hhmajorprice then
    hhmajorbar = barindex[i]
    hhmajorprice = high[i]
    endif
    if low[i]<llmajorprice then
    llmajorbar=barindex[i]
    llmajorprice=low[i]
    endif
    next
    
    atr=averagetruerange[14]
    if barindex-hhminorbar=PeriodsInMinorSwing  then
    //drawtext("●",hhminorbar,hhminorprice,Dialog,Bold,10) coloured(100,149,237)
    drawtext("●",hhminorbar,hhminorprice,Dialog,Bold,10) coloured(255,255,0)
    endif
    if barindex-llminorbar=PeriodsInMinorSwing then
    //drawtext("●",llminorbar,llminorprice,Dialog,Bold,10) coloured(100,149,237)
    drawtext("●",llminorbar,llminorprice,Dialog,Bold,10) coloured(255,255,0)
    endif
    if barindex-hhmajorbar=PeriodsInMajorSwing then
    drawtext("●",hhmajorbar,hhmajorprice+atr/2,Dialog,Bold,20) coloured(128,0,128)
    endif
    if barindex-llmajorbar=PeriodsInMajorSwing then
    drawtext("●",llmajorbar,llmajorprice-atr/2,Dialog,Bold,20) coloured(128,0,128)
    endif
    
    
    return EMA coloured(184,134,11) as "lastman standing"
    #221007 quote
    edktradingedktrading
    Participant
    New

    and the attatchment.

    lastman-standing-addition.png lastman-standing-addition.png
    #221019 quote
    NicolasNicolas
    Keymaster
    Legend

    Please find below the modified version that draw segments between the minor yellow points:

    //PRC_LastManStandingIndicator | indicator
    //14.11.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //translated from MQL4 code
    
    // --- settings
    PeriodsInMajorSwing=13
    PeriodsInMinorSwing=5
    MovingAverageMethod=1
    MovingAveragePeriods= 55
    // --- end of settings
    
    EMA = average[MovingAveragePeriods,MovingAverageMethod](close)
    
    hhminorprice=0
    llminorprice=close*1000
    for i = 1 to PeriodsInMinorSwing*2 do
    if high[i]>hhminorprice then
    hhminorbar = barindex[i]
    hhminorprice = high[i]
    endif
    if low[i]<llminorprice then
    llminorbar=barindex[i]
    llminorprice=low[i]
    endif
    next
    
    hhmajorprice=0
    llmajorprice=close*1000
    for i = 1 to PeriodsInMajorSwing*2 do
    if high[i]>hhmajorprice then
    hhmajorbar = barindex[i]
    hhmajorprice = high[i]
    endif
    if low[i]<llmajorprice then
    llmajorbar=barindex[i]
    llmajorprice=low[i]
    endif
    next
    
    atr=averagetruerange[14]
    if barindex-hhminorbar=PeriodsInMinorSwing  then
    //drawtext("●",hhminorbar,hhminorprice,Dialog,Bold,10) coloured(100,149,237)
    drawtext("●",hhminorbar,hhminorprice,Dialog,Bold,10) coloured(255,255,0)
    drawsegment(hhminorbar,hhminorprice,prevhhminorbar,prevhhminorprice)
    prevhhminorbar=hhminorbar
    prevhhminorprice=hhminorprice
    endif
    if barindex-llminorbar=PeriodsInMinorSwing then
    //drawtext("●",llminorbar,llminorprice,Dialog,Bold,10) coloured(100,149,237)
    drawtext("●",llminorbar,llminorprice,Dialog,Bold,10) coloured(255,255,0)
    drawsegment(llminorbar,llminorprice,prevllminorbar,prevllminorprice)
    prevllminorbar=llminorbar
    prevllminorprice=llminorprice
    endif
    if barindex-hhmajorbar=PeriodsInMajorSwing then
    drawtext("●",hhmajorbar,hhmajorprice+atr/2,Dialog,Bold,20) coloured(128,0,128)
    endif
    if barindex-llmajorbar=PeriodsInMajorSwing then
    drawtext("●",llmajorbar,llmajorprice-atr/2,Dialog,Bold,20) coloured(128,0,128)
    endif
    
    
    return EMA coloured(184,134,11) as "lastman standing"
    #221023 quote
    edktradingedktrading
    Participant
    New

    Thank you very much Nicolas! This is very helpful for me.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Adaption/addition to Last man standing indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
edktrading @edktrading Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by edktradingedktrading
3 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/14/2023
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...