Code conversion needed: LEDGE ATR indicator

Viewing 15 posts - 16 through 30 (of 36 total)
  • Author
    Posts
  • #63574 quote
    crolakstrading
    Participant
    Senior

    Hi Nicolas..

    This is great. thanks very much! the enter lines were going 2o pips above from ATR so i changed it and made it in.. and change the colours.. please see pic + Red line is 20 pips below from ATR to short entry + Green line is 20 pips above from ATR to go long is there a way to move those RED and GREEN lines easily like adding variables.. lets i want go 30 pips instead of 20 pip? is there away to move them both 30 pips each way without going in and edit it!!..  is this possible?? thanks
    #63624 quote
    Nicolas
    Keymaster
    Master
    Of course that’s possible. Just replace the points distance number in the code with a new variable and add it into the external variable tool. Easy.
    #63964 quote
    crolakstrading
    Participant
    Senior
    Hi Nicolas.. i have tried hard to add these point distance… please can you check what im doing wrong.. it doesn’t do anything???
    defparam drawonlastbaronly=true
    // --- parameters
    ATRperiod = 14
    // ---
    
    dTR = 0
    for i = 0 to ATRperiod
    dTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))
    next
    
    avg = dTR/ATRperiod
    converted = round(avg/pointsize*10)/10
    
    htr = Dlow(0)+avg[1]
    ltr = Dhigh(0)-avg[1]
    
    if intradaybarindex=0 then
    begin=barindex
    endif
    
    // --- parameters
    //EP = 20
    // ---
    drawsegment(begin,htr,barindex,htr) coloured(200,100,0)
    drawsegment(begin,htr-20*pointsize,barindex,htr-20*pointsize) coloured(255,0,0) //EP
    drawtext("#htr# - (D1atr: #converted#)",barindex,htr+10*pointsize,Dialog,Bold,10) coloured(200,100,0)
    drawsegment(begin,ltr,barindex,ltr) coloured(200,100,0)
    drawsegment(begin,ltr+20*pointsize,barindex,ltr+20*pointsize) coloured(0,255,0)//EP
    drawtext("#ltr# - (D1atr: #converted#)",barindex,ltr-10*pointsize,Dialog,Bold,10) coloured(200,100,0)
    drawsegment(begin,Dopen(0),barindex,Dopen(0)) coloured(255,250,250)
    
    return
    
    #64079 quote
    crolakstrading
    Participant
    Senior
    Hi Nicolas.. a little help on this to make it work… really appreciated!!
    #64241 quote
    crolakstrading
    Participant
    Senior
    Hi Nicolas.. is there a way keep the daily ATR price the same from market open price without changing???? what mean is the opening price at midnight, the ATR at that time, then the high/low price that remains static throughout the day.  one we get the daily ATR price when market opens 0000.. that ART price remins the same place without changing?? please advice?   Many thanks
    #64442 quote
    Nicolas
    Keymaster
    Master
    Just make only one time the dTR calculation at first bar of the day:
    if intradaybarindex=0 then 
     for i = 0 to ATRperiod
      dTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))
     next
    endif
    #64486 quote
    crolakstrading
    Participant
    Senior
    Hi nicolas, Please can you check below.. it doesn’t seem to work properly..  also attached a pic below what i meant!! sorry to bother you again still learning.. I really appreciate your help!!!
    defparam drawonlastbaronly=true
    
    // --- parameters
    ATRperiod = 14
    // ---
    
    dTR = 0
    if intradaybarindex=0 then
    for i = 0 to ATRperiod
    dTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))
    next
    endif
    
    avg = dTR/ATRperiod
    converted = round(avg/pointsize*10)/10
    
    htr = Dlow(0)+avg[1]
    ltr = Dhigh(0)-avg[1]
    
    if intradaybarindex=0 then
    begin=barindex
    endif
    
    drawsegment(begin,htr,barindex,htr) coloured(255,255,0)
    drawsegment(begin,htr+20*pointsize,barindex,htr+20*pointsize) coloured(255,0,0)
    drawtext("#htr# - (D1atr: #converted#)",barindex,htr+10*pointsize,Dialog,Bold,10) coloured(255,255,0)
    drawsegment(begin,ltr,barindex,ltr) coloured(255,255,0)
    drawsegment(begin,ltr-20*pointsize,barindex,ltr-20*pointsize) coloured(0,255,0)
    drawtext("#ltr# - (D1atr: #converted#)",barindex,ltr-10*pointsize,Dialog,Bold,10) coloured(255,255,0)
    drawsegment(begin,Dopen(0),barindex,Dopen(0)) coloured(255,250,250)
    
    return
    #64556 quote
    Nicolas
    Keymaster
    Master
    Try this one:
    defparam drawonlastbaronly=true
    
    // --- parameters
    ATRperiod = 14
    // ---
    
    if intradaybarindex=0 then
    begin=barindex
    reset=0
    dTR = 0
    endif
    
    if reset=0 then
    for i = 1 to ATRperiod
    dTR=dTR+max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1))))
    next
    reset=1
    endif
    
    avg = dTR/ATRperiod
    converted = round(avg/pointsize*10)/10
    
    htr = Dlow(0)+avg[1]
    ltr = Dhigh(0)-avg[1]
    
    drawsegment(begin,htr,barindex,htr) coloured(255,255,0)
    drawsegment(begin,htr+20*pointsize,barindex,htr+20*pointsize) coloured(255,0,0)
    drawtext("#htr# - (D1atr: #converted#)",barindex,htr+10*pointsize,Dialog,Bold,10) coloured(255,0,0)
    drawsegment(begin,ltr,barindex,ltr) coloured(255,255,0)
    drawsegment(begin,ltr-20*pointsize,barindex,ltr-20*pointsize) coloured(0,255,0)
    drawtext("#ltr# - (D1atr: #converted#)",barindex,ltr-10*pointsize,Dialog,Bold,10) coloured(255,0,0)
    drawsegment(begin,Dopen(0),barindex,Dopen(0)) coloured(255,250,250)
    
    return
    #64617 quote
    crolakstrading
    Participant
    Senior
    Hi Nicolas, Just few issues with this… not sure why when the price move up or down lower or higher ATR moves towards open price and above. please see the picture.. * D atr says 94.2 but the line is not 94.2 away from Open price 0000??
    #64680 quote
    Nicolas
    Keymaster
    Master
    Change lines 23 and 24 to:
    htr = Dopen(0)+avg[1]
    ltr = Dopen(0)-avg[1]
    crolakstrading thanked this post
    #64978 quote
    crolakstrading
    Participant
    Senior
    Hi Nicolas… that works really well… thank you so much for this! is there a way to add price number to 20 pip above line at the moment its only the line..
    drawsegment(begin,htr+20*pointsize,barindex,htr+20*pointsize) coloured(255,0,0)
    How to add the price (number) on to this like your atr line? “#ltr# – (D1atr: #converted#)”
    #65010 quote
    Nicolas
    Keymaster
    Master
    How to add the price (number) on to this like your atr line? “#ltr# – (D1atr: #converted#)”
    Well, you already have everything in hands, examples at lines 28 and 31 of this post: https://www.prorealcode.com/topic/code-conversion-neededi/page/2/#post-64556
    crolakstrading thanked this post
    #66491 quote
    crolakstrading
    Participant
    Senior
    Thank you very much Nicolas, I have been doing this strategy for past few weeks and given me 80% success on this. its  really good!! would it be a possible thing to make a screener.. lets say when its near ATR that we get a signal for that??
    #66506 quote
    Nicolas
    Keymaster
    Master
    Sure, but could you explain the strategy please? I’m sure it will be of interest of many ones here. Thank you.
    crolakstrading thanked this post
    #66571 quote
    crolakstrading
    Participant
    Senior
    Of course. we want the market to stretch very quickly to daily ATR. once reach daily ATR you can enter aggressively at ATR or 20pips below or above! please see the picture to make it clear as this is today EURUSD.  hope its clear?
Viewing 15 posts - 16 through 30 (of 36 total)
  • You must be logged in to reply to this topic.

Code conversion needed: LEDGE ATR indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Zac @zac Participant
Summary

This topic contains 35 replies,
has 3 voices, and was last updated by crolakstrading
7 years, 10 months ago.

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