Alert setting is not possible in Standard Deviation Channel

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #101433 quote
    Partha Banerjee
    Participant
    Junior

    Hello Nicolas, as you know PRT does not allow alert setting on standard error and standard deviation channels for which one solution could have been using your manual LR channels, however the actual PRT standard error and standard deviation channels do not match with your LR Channel. Do you have a code for these 2 dynamic channels starting from a fixed candle/ bar which will exactly match with standard PRT standard error and standard deviation channels please so that I can set the alert?

    I have attached the images for your reference and your PRT code below please.

    Many thanks.

    //Parameters :
    // Len = 127
    // percent = 0.0016
     
    //once j=0
    de48=DPO[Len*2](close)
    if de48=de48[1] and de48[1]=de48[2] and de48[2]<>de48[3] then
    flag=1
    endif
     
    n=(Len*2)-4
    p=(n/2)-1
    d100=DPO[n](close)
    moy100=close-d100
    co=(moy100-moy100[1]+(close[p])/n)*n
    if flag=1 and flag[1]=0 then
    test=linearregression[Len](co)
    test1=linearregressionslope[Len](co)
    a=test1
    b=test-test1*Len
    endif
     
    if flag=0 then
    reg=a*j+b
    upperchan = reg + reg*percent
    lowerchan = reg - reg*percent
    //reg=undefined
    //upperchan=undefined
    //lowerchan=undefined
    else
    j=j+1
    reg=a*j+b
    upperchan = reg + reg*percent
    lowerchan = reg - reg*percent
    endif
     
    RETURN reg as "channel center", upperchan as "upper channel", lowerchan as "lower channel"
    Standard-deviation-channel-and-LR-Channel.jpg Standard-deviation-channel-and-LR-Channel.jpg
    #101449 quote
    Nicolas
    Keymaster
    Master

    This code is not mine. I suggest you use this one instead: Standard Deviation & Standard Error Linear Regression Channel

    I know that it moves with each new candle as it is based on period. We could change the code to start from a precise time/date in the past if this is what you want, just tell me.

    Alert cannot be programmed, still, so you’ll have to use the alert tool from the platform, in any case.

    #101493 quote
    Partha Banerjee
    Participant
    Junior

    Hello Nicholas,
    You are really a good man, always ready to help others. Thank you so much for your fast and reliable response.
    Thank you for the code, however it is not same as the standard ones available in PRT is/are not matching with that of your as captured in the image.

    I have use, Standard error channel with Nb standard error as 1.62 (green dotted line) but when I set Deviation multiplier as 1.62 in your channel, it is not matching (image 1).

    However, when I set Deviation multiplier as 0.46 in your channel, it is matching (image 2). But when the bars are moving your channel is getting shifted from the standard one as it is not staying anchored to the starting bar, as shown in image 3.

    Also needs to anchor your channel to the starting point so that the number of bars need not be changed every 1 minute bar.

    Appreciate your help please.
    Many thanks.

    image-1.jpg image-1.jpg image-2.jpg image-2.jpg image-3.jpg image-3.jpg
    #101510 quote
    Nicolas
    Keymaster
    Master

    I don’t know which version of the channel indicator you are using, but the one I provided the link above is perfectly matching the one from the platform (attached picture).

    If you confirm you can use this one, I can change the calculation to make it anchor on specific date and time. Thanks.

    standard-deviation-channel-prorealtime.png standard-deviation-channel-prorealtime.png
    #101536 quote
    Partha Banerjee
    Participant
    Junior

    Many thanks Nicholas. I understand your point. Using your link I have downloaded the indicator whose code is as below. For the PRT Chart version I am using the one which is coming with IG Markets’ broker platform. The version is v10.3 – 1.8.0_45 as captured in the image. However, all good. Please anchor the channels to it fixed starting point. Many thanks for the code in advance.

    SD_SR_Chart-ver.jpg SD_SR_Chart-ver.jpg
    #101581 quote
    Nicolas
    Keymaster
    Master

    I released a new version of the channel with anchored date and time in the library, download it from there: Anchored Standard Deviation & Standard Error Linear Regression Channel

    You’ll have to define in the settings the precise date and time of candlestick of where to start the calculation of the channel.

    #101596 quote
    Partha Banerjee
    Participant
    Junior

    Hello Nicholas, This is great. Many thanks for the same, however the very basic purpose of creating an ALERT on the channels is still not working. I have created the ALERT as shown in the enclosed, but system is not sensing the ALERT and hence not triggering. Appreciate your support please. Also the new anchored channels could not be truncated so that a new channel could be started. It should have an end date and time to terminate the old channel. Regards,

    SD_SR_Chart-Alert_notworking.jpg SD_SR_Chart-Alert_notworking.jpg
    #101810 quote
    Partha Banerjee
    Participant
    Junior

    Hello Nicholas,
    Any idea on how to make the ALERT work on the channels please?
    Regards,

    #102141 quote
    Partha Banerjee
    Participant
    Junior

    Hello Nicholas,

    Can I conclude that it is not possible?

    Regards,

    #102143 quote
    Nicolas
    Keymaster
    Master

    Sorry but I don’t actively monitor each topic I answered to.

    That’s indeed not possible to set alert on objects (I used objects to plot the channel). In this case we have to calculate each point of the segments and return them in the indicator, that way you should be able to set alert on them (when price crosses the segments).

    I didn’t realize you wanted to have an end date for the channel too. I will look into that.

    #102149 quote
    Nicolas
    Keymaster
    Master

    This version has EndDate and EndTime and you should be able to set alerts on price crossing one of the returned values of the indicator, first one is the upper line, second one the lower line.

    //PRC_StdSte LinRegChannAnchored | indicator
    //Standard Deviation and Standard Error with date&time anchor
    //moded version with end date and time and channels values returned
    //to set alerts with the alert tool
    //Linear Regression Channel
    //28.06.2019
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    defparam drawonlastbaronly=true
    defparam calculateonlastbars=1000
    // --- settings
    AnchorDate = 20190624 //Date anchor YYYYMMDD format
    AnchorTime = 100000 //Time anchor HHMMSS format
    
    EndDate = 20190705 //Date anchor YYYYMMDD format
    EndTime = 080000 //Time anchor HHMMSS format
    
    ChannelType = 1 //1= Standard Deviation ; 2= Standard Erro
    NbDeviation = 1 //Deviation multiplier
    colorRed = 255
    colorGreen = 255
    colorBlue = 0
    // --- end of settings
    
    if date=anchordate and time=anchortime then
    startbar=barindex
    endif
    if date=enddate and time=endtime then
    endbar=barindex
    endif 
    
    lookback = max(1,endbar-startbar)
    
    if lookback>0 and date>=AnchorDate  then
    sumx = 0
    sumy = 0
    sumxy = 0
    sumx2 = 0
    
    for cmpt = lookback downto 0 do
    tmpx = cmpt
    tmpy = close[cmpt]
    sumy = sumy+tmpy
    sumx = sumx+tmpx
    sumx2 = sumx2 + (tmpx*tmpx)
    sumxy = sumxy + (tmpy*tmpx)
    next
    
    n = lookback+1
    
    if (sumx2 = sumx * sumx) then // protection to avoid infinite values
    b = sumxy - sumx * sumy
    else
    b = (n * sumxy - sumx * sumy) / (n * sumx2 - sumx * sumx)
    endif
    a = (sumy - b * sumx) / n
    
    drawline(startbar,a+b*lookback,endbar,a+b*0) coloured(colorRed,colorGreen,colorBlue)
    
    //channel
    if ChannelType = 1 then //Standard Deviation
    dat = std[lookback]*NbDeviation
    else
    dat = ste[lookback]*NbDeviation
    endif
    drawline(startbar,(a+b*lookback)+dat,endbar,a+b*0+dat) coloured(colorRed,colorGreen,colorBlue)
    drawline(startbar,(a+b*lookback)-dat,endbar,a+b*0-dat) coloured(colorRed,colorGreen,colorBlue)
    
    coeff = ((a+b)-(a+b*lookback))/(max(1,endbar-startbar))
    endif
    
    return ((a+b*lookback)+dat)+(barindex-startbar)*coeff coloured(100,100,100,0) as "upper line",((a+b*lookback)-dat)+(barindex-startbar)*coeff coloured(100,100,100,0) as "lower line"
    #102233 quote
    Partha Banerjee
    Participant
    Junior

    Hello Nicholas,
    This is brilliant. Many thanks for the same. However the channel is extending to the left infinitely hence creating a confusion to its start date and time as enclosed. Can we truncate the channel from extending to its left please.
    Regards,

    StdDev-StdErr-Channel-Left-Extended.jpg StdDev-StdErr-Channel-Left-Extended.jpg
    #102242 quote
    Nicolas
    Keymaster
    Master

    Not possible to extend it only on one side. You have the choice, between segments like it used to be or like this..

    We could add a vertical line at the starting date, so you could visualize where it starts, or a text/symbol for instance..

    #102315 quote
    Partha Banerjee
    Participant
    Junior

    Many thanks Nicolas.

    #102333 quote
    Nicolas
    Keymaster
    Master

    Here is a new version with a vertical line at the first bar of the channel (it contains also a bug fix, so use this version now).

    //PRC_StdSte LinRegChannAnchored | indicator
    //Standard Deviation and Standard Error with date&time anchor
    //moded version with end date and time and channels values returned
    //to set alerts with the alert tool
    //Linear Regression Channel
    //28.06.2019
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    
    defparam drawonlastbaronly=false
    defparam calculateonlastbars=1000
    // --- settings
    AnchorDate = 20190710 //Date anchor YYYYMMDD format
    AnchorTime = 100000 //Time anchor HHMMSS format
    
    EndDate = 20190710 //Date anchor YYYYMMDD format
    EndTime = 103000 //Time anchor HHMMSS format
    
    ChannelType = 1 //1= Standard Deviation ; 2= Standard Erro
    NbDeviation = 1 //Deviation multiplier
    colorRed = 255
    colorGreen = 255
    colorBlue = 0
    // --- end of settings
    
    if date=anchordate and time=anchortime then
    startbar=barindex
    endif
    if date=enddate and time=endtime then
    endbar=barindex
    endif
    
    lookback = max(1,endbar-startbar)
    
    if lookback>0 and date>=AnchorDate and date<=enddate and time<=endtime then
    sumx = 0
    sumy = 0
    sumxy = 0
    sumx2 = 0
    
    for cmpt = lookback downto 0 do
    tmpx = cmpt
    tmpy = close[cmpt]
    sumy = sumy+tmpy
    sumx = sumx+tmpx
    sumx2 = sumx2 + (tmpx*tmpx)
    sumxy = sumxy + (tmpy*tmpx)
    next
    
    n = lookback+1
    
    if (sumx2 = sumx * sumx) then // protection to avoid infinite values
    b = sumxy - sumx * sumy
    else
    b = (n * sumxy - sumx * sumy) / (n * sumx2 - sumx * sumx)
    endif
    a = (sumy - b * sumx) / n
    
    drawline(startbar,a+b*lookback,endbar,a+b*0) coloured(colorRed,colorGreen,colorBlue)
    
    //channel
    if ChannelType = 1 then //Standard Deviation
    dat = std[lookback]*NbDeviation
    else
    dat = ste[lookback]*NbDeviation
    endif
    drawline(startbar,(a+b*lookback)+dat,endbar,a+b*0+dat) coloured(colorRed,colorGreen,colorBlue)
    drawline(startbar,(a+b*lookback)-dat,endbar,a+b*0-dat) coloured(colorRed,colorGreen,colorBlue)
    drawvline(startbar)
    
    coeff = ((a+b)-(a+b*lookback))/(max(1,endbar-startbar))
    endif
    
    return ((a+b*lookback)+dat)+(barindex-startbar)*coeff coloured(100,100,100,0) as "upper line",((a+b*lookback)-dat)+(barindex-startbar)*coeff coloured(100,100,100,0) as "lower line"
Viewing 15 posts - 1 through 15 (of 23 total)
  • You must be logged in to reply to this topic.

Alert setting is not possible in Standard Deviation Channel


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 22 replies,
has 2 voices, and was last updated by Partha Banerjee
6 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/26/2019
Status: Active
Attachments: 9 files
Logo Logo
Loading...