DRAWARROWUP (and DOWN) doesnt display?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #50818 quote
    margincallcat
    Participant
    Average

    I have made an indicator that consists among other things two lines that i want to draw arrows on when crossed.

    The code for the specific area is at the bottom here:

    hhatrx=highest[lookback](atrxlineh)
    llatrx=lowest[lookback](atrxlinel)
    
    
    mitten=(hhatrx+llatrx)/2
    midatrx=mitten
    midatrx2=average[SlowMid,1](mitten)
    
    if midatrx crosses over midatrx2 then
    drawarrowup(barindex[1],llatrx)
    elsif midatrx crosses under midatrx2 then
    drawarrowdown(barindex[1],hhatrx)
    endif

    but no arrows are drawn. Even if i try different colors, same result.

     

    I have read several descriptions including the Pro Builder manual, but  i cant get it to work.

     

    Any takers?

     

    Thanks!

    #50819 quote
    Nicolas
    Keymaster
    Master

    What are atrxlineh and atrxlinel, please?

    #50820 quote
    margincallcat
    Participant
    Average

    I see now that its DRAWONLASTBARONLY that seems to be the issue. Is it possible to have it drawn even though this setting is =true? Will the drawn arrows stay in the future?

    #50821 quote
    margincallcat
    Participant
    Average

    This is the full code:

     

    defparam DRAWONLASTBARONLY=true
    //defparam CALCULATEONLASTBARS=200
    
    if on=1then
    x=ATRperiod
    a=AverageTrueRange[x](close)[1]
    //atrma=Average[10,1](a)
    //xfactor=a/atrma
    multiplier=a*atrx//*xfactor
    alpha=255
    //
    
    //atrxlineh=(highest[lookback](high)+multiplier) // ÖVRE LINJE
    atrxlineh=high+multiplier
    //atrxlinel=(lowest[lookback](low)-multiplier) // UNDRE LINJE
    atrxlinel=low-multiplier
    
    if atrxlineh>atrxlineh[1] then
    atrxlineh=atrxlineh[1]
    endif
    if close[1]>atrxlineh[1] then
    atrxlineh=close[1]+a
    atrxlinel=close[1]-multiplier
    elsif high[1]>atrxlineh[1] then
    atrxlineh=high[1]
    endif
    
    if atrxlinel<atrxlinel[1] then
    atrxlinel=atrxlinel[1]
    endif
    if close[1]<atrxlinel[1] then
    atrxlinel=close[1]-a
    atrxlineh=close[1]+multiplier
    elsif low[1]<atrxlinel[1] then
    atrxlinel=low[1]
    endif
    
    //GAMLA GRUNDKODEN INNAN IHOPFLÄTAT
    //if atrxlinel<atrxlinel[1] then
    //atrxlinel=atrxlinel[1]
    //endif
    //if low[1]<atrxlinel[1] then
    //atrxlinel=low[1]
    //endif
    //if close[1]<atrxlinel[1] then
    //atrxlinel=close[1]-a
    //endif
    
    //OKLAR KOD SOM SKA DRA UPP STOPLOSSEN OM CLOSE BRYTS
    //if close[1]>atrxlineh[1] then
    //atrxlinel=open[1]-a
    //endif
    //if close[1]<atrxlinel[1] then
    //atrxlineh=open[1]+a
    //endif
    //
    //hhatrx=atrxlineh
    //llatrx=atrxlinel
    hhatrx=highest[lookback](atrxlineh)
    llatrx=lowest[lookback](atrxlinel)
    
    
    mitten=(hhatrx+llatrx)/2
    midatrx=mitten
    midatrx2=average[SlowMid,1](mitten)
    
    
    if midatrx[1] crosses over midatrx2[1] then
    drawarrowup(barindex[1],llatrx+a)
    elsif midatrx[1] crosses under midatrx2[1] then
    drawarrowdown(barindex[1],hhatrx-a)
    endif
    
    //
    if Numbers=1 then
    drawtext("ATR:#a#(X:#multiplier#)",barindex,hhatrx+a/2,sansserif,standard,12)
    drawtext("ATR:#a#(X:#multiplier#)",barindex,llatrx-a/2,sansserif,standard,12)
    endif
    
    if Lines=1 then
    drawsegment(barindex-20,hhatrx,barindex,hhatrx)coloured(30,144,255,alpha)
    drawsegment(barindex-20,llatrx,barindex,llatrx)coloured(30,144,255,alpha)
    endif
    
    
    endif
    
    return hhatrx as "ATRx High", llatrx as "ATRx Low", midatrx as "ATRx Mid", midatrx2 as "ATRx Mid Slow"
    

    Dont know if it helps.. Some of it is in Swedish 🙂

    #50863 quote
    Nicolas
    Keymaster
    Master

    Did set line 1 to false solve the problem?

    #50882 quote
    margincallcat
    Participant
    Average

    If i do that all other drawings get all over the chart, so i need to have that setting to false.

    #51073 quote
    Nicolas
    Keymaster
    Master

    Please share with us the settings of the indicator in order to help.

    #51141 quote
    margincallcat
    Participant
    Average

    Its solved – it was “Drawonlastbaronly” that was the issue, and after recoding some other drawlines/segments it works to have it set to =false without having the whole chart cluttered. 🙂

     

    ps. I would appreciate some help in the “How do i stop repeat signlas”-thread.

     

    Thanks

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

DRAWARROWUP (and DOWN) doesnt display?


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by margincallcat
8 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/29/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...