Help for graphical indicators development version 10.3

Viewing 12 posts - 31 through 42 (of 42 total)
  • Author
    Posts
  • #32799 quote
    Suraj Neupane
    Participant
    New

    I found an issue regarding the arrow, I have tested back and forth with every bar but arrow could not be drawn in Monday (on daily chart).

    As I tested further problem become more specific and I found out, it does not run on money on only forex market charts (Works fine in stock market), arrow will always go back to previous bar.

    Is it the bug on prorealtime (i don’t think it is the problem with my coding because draw arrow in every bar except Monday)? Hoping to hearing from you soon.

    #33294 quote
    Despair
    Blocked
    Master

    I have a question to the “drawtext” command. I want an indicator to print a value in the upper right corner of the chart and it is suppsossed to stay fixed there also when i scroll back and forth in the chart. How can this be accomblished? What shall i use for X and Y?

    #33299 quote
    Nicolas
    Keymaster
    Master

    @Suraj
    Without your code I can’t help more. I know there is an issue on weekly chart though..

    @Despair

    Already answered in the documentation page of DRAWARROW: X,Y coordinates use respectively barindex and price, not pixels format. So you can’t have fixed anything on chart while zooming or when the time pass by ..
    You should have a look on my dashboard creation blog article, you may find suitable ideas for your needs: indicators dashboard prorealtime

    #33389 quote
    Despair
    Blocked
    Master

    Thank you so much. I will have a look at your dashboard.

    #33468 quote
    eushev
    Participant
    New

    Hello , im new to this forum  And maybe my question isnt for here . But i am looking for a coder to code MACD indicator with adjustable time frame (expample 1d candlestick chart and weekly macd .  Where i can post my request or find coder . Thanks you and sorry for bothering you guys . Happy trading .

    #34148 quote
    Elsborgtrading
    Participant
    Veteran

    Again I’m stuck and can’t see why this is failing. Perhaps someone with at sharp eye can spot the error.

    I want to draw a line between two HIGH fractal points, but only if the current one is lower than the previous one. (and vice versa for LOW fractalpoints- but first the HIGH). The line should extent until close crosses the line.

    This is how far I’ve come. the lines are just all over the place 🙁

    stopdraw=1
    MyEMA23=ExponentialAverage[23](close)
    MyEMA50=ExponentialAverage[50](close)
    MyEMA200=ExponentialAverage[200](close)
    //MyADX=ADX[14]>15
    factor1=10
    cp=3
    factor2=5
    Fractalhigh=high[cp]
    mybarhigh=barindex[cp]
    if high[cp] >= highest[2*cp+1](high) then
    fractal=high[cp]
    fractaltest=fractal[1]>fractal
    LH = 1
    
    else
    LH=0
    endif
    
    //if low[cp] <= lowest[2*cp+1](low)  then
    //LL= -1
    //else
    //LL=0
    //endif
    
    if MyEMA50+factor1<MyEMA200 and MyEMA23<MyEMA50 then
    EMAind=-1
    elsif MyEMA50-factor1>MyEMA200 then
    EMAind=1
    else
    EMAind=1
    endif
    
    if LH=1 and EMAind=1 and stopdraw then// and fractaltest then
    DRAWARROWUP(barindex[cp], high[cp]+(factor2*pipsize))coloured(0,255,0)
    if fractaltest then
    y1=Fractalhigh[1]
    x1=mybarhigh[1]
    y2=Fractalhigh
    x2=mybarhigh
    gradient=(y2-y1)/(x2-x1)
    count=count+1
    test1=y1[1]-(gradient)*count
    DRAWsegment(mybarhigh[1],y1[1],barindex+cp,y1[1]-(gradient)*count)coloured(0,0,255)
    endif
    if close<test1 then//and fractaltest then
    stopdraw=1
    
    else
    stopdraw =0
    //y1=0
    //y2=0
    endif
    //DRAWsegment(barindex-count,lower,barindex,lower)coloured(0,0,0)
    else
    count=0
    
    endif
    
    //if LL  = -1 and EMAind=-1 then
    //DRAWARROWDOWN(barindex[cp], low[cp]-(factor2*pipsize))coloured(255,0,0)
    //Fractallow=low[cp]
    //mybarlow=barindex[cp]
    //endif
    
    
    
    //2. The equation of a line through the origin with a given gradient
    //http://www.mathcentre.ac.uk/resources/uploaded/mc-ty-strtlines-2009-1.pdf
    
    
    //if LH[1] and LH then
    //y1=Fractalhigh[1]
    //x1=mybarhigh[1]
    //y2=Fractalhigh
    //x2=mybarhigh
    //gradient=(y1-y2)/(x1-x2)
    //count=count+1
    //DRAWsegment(mybarhigh[1]-count,y1[1],barindex,y1+gradient)coloured(0,0,0)
    ////DRAWsegment(barindex-count,lower,barindex,lower)coloured(0,0,0)
    //else
    //count=0
    //endif
    
    
    
    
    
    
    
    //
    //if myadx and fractalhigh[1]>fractalhigh and EMAind=1 then
    ////DRAWSEGMENT(mybarhigh[1],Fractalhigh[1],mybarhigh[0],Fractalhigh[0])coloured(0,0,255)
    ////DRAWTEXT("LONG", barindex-6, high[cp]+(factor2*4*pipsize),SansSerif,Italic, 12) coloured(0,255,0)
    ////y1=Fractalhigh[1]
    ////x1=mybarhigh[1]
    ////y2=Fractalhigh
    ////x2=mybarhigh
    ////gradient=(y2-y1)/(x2-x1)
    ////count=count+1
    ////DRAWsegment(mybarhigh[1]-count+1,y1[1],barindex,y1[1]+gradient*count)coloured(0,0,0)
    ////DRAWsegment(barindex-count,lower,barindex,lower)coloured(0,0,0)
    ////else
    ////count=0
    //endif
    //if myadx and fractallow[1]<fractallow and EMAind=-1 then
    ////DRAWSEGMENT(mybarlow[1],Fractallow[1],mybarlow[0],Fractallow[0])coloured(0,0,255)
    //DRAWTEXT("SHORT", barindex-6, high[cp]-(factor2*4*pipsize),SansSerif,Italic, 12) coloured(255,0,0)
    //endif
    //
    
    
    RETURN
    
    #40144 quote
    AVT
    Participant
    Senior

    Here is a template for creating an overlay of an indicator which one can usually not place into the charts window. It is mainly intended for scalping (non trending market) where you have your scalping chart adjusted just once (or twice if price is exploding). As usual heavy commenting (that’s just my style).

    Use it like this:

    • adjust your price chart window, import the layer
    • look at what price level your lowest bars/candles are
    • in the adjustment for the layer
    • put the value of “ZeroLine” a bit below the price level of your bars/candles
    • put the “HundredLine” at a value where you think “enough, not into my price bars”
    • adjust color not to disturb too much but be unique to see what belongs to it
    • maybe little re-adjustment of the zero and Hundred line

    When rewriting the code to your needs: You can use it for any indicator having “fixed borders”, means their values cannot exeede a certain value. Example is the RSI which can have only values between 0 and 100. If negative range is involved: do your logic thinking first, load the indicator you want to layer in a separte window with same length, and choose a price chart which has big enough values to do a 1:1 layer for comparing your logic with the original (DAX, CAC, FTSE, DOW). If the result looks ok, change the price chart to something completely different scaling (forex) and check the ratio is working.
    Rewriting for something like ATR (which has the ZeroLine as reference but can value-explode straight through the chart depending on the timeframe) should work, but needs a bit more logical thinking.

    // === RSI overlay for a chart
    // --- for PRT 10.3, July 2017, by AVT bigsister-gmt@gmx.de
    
    // === Variables Begin
    // --- variables for calculation
    //     RSIlength: strategy fixed (default: 9), added changing option
    
    // --- variables for painting
    //     user MUST define 0-Line and 100-Line position, automatic calculation is a complete mess
    //     ZeroLine: the lowest line, an RSI value cannot be less than 0
    //     HundredLine: the highest line, an RSI value cannot be higher than 100
    //     UpperBorder1, UpperBorder2: strategy fixed (default: 65), added a second one
    //     LowerBorder1, LowerBorder2: strategy fixed (default: 35), added a second one
    //     R,G,B: the values for the red, green and blue part defining an RGB Color Code
    // --- set limits to the allowed color values (thanks @Nicolas for the code)
    //     logic max(0,R): if a user pushes the ColorNumberingButton to -1,
    //     R returns the maximum value between 0 and users push
    //     which is in this case 0, because 0 is bigger than -1
    R = max(0,R)
    R = min(255,R)
    G = max(0,G)
    G = min(255,G)
    B = max(0,B)
    B = min(255,B)
    // === Variables End
    
    // === Calculation Begin
    // --- calculating the painting
    //     naming: O(verlay)[U(pper)|L(ower)]WhateverName[1-9]
    // --- get the range size between zero and hundred line, then get the ratio value for 1 unit
    // !!! works directly only for indicators which have fixed limits for their highest and lowest value
    ORange = HundredLine - ZeroLine  // rsi limits: 0-100
    OUnit = ORange / 100             // instead of normal unit=1 we get maybe a ratio unit=0.34 for forex
    
    // --- calculate the values of the border lines
    //     logic: a normal upper border of 65 has the 1-unit value of 65 which is added to the 0-line value 0,
    //            so it would be drawn at the y-axis position 65;
    //            we need the ratio unit of 65, because the distance between 0 and 100 is less than normal,
    //            (and add that to the user-defined 0-line position later when drawing)
    OUBorder1 = UpperBorder1 * OUnit
    OUBorder2 = UpperBorder2 * OUnit
    OLBorder1 = LowerBorder1 * OUnit
    OLBorder2 = LowerBorder2 * OUnit
    
    // --- calculate the value of the rsi
    //     RSI in a separate window would simply use a unit of 1 and draw its line between 0 and 100
    // --- adjust the RSI values to the calculated ratio
    ORSIval = RSI[RSIlength](close) * OUnit       // MUST be close, otherwise a mess with DRAWSEGMENT
    ORSIpreval = RSI[RSIlength](close[1]) * OUnit // DRAWSEGMENT needs a begin, that's the previous value
    // === Calculation End
    
    // === Drawing Begin
    // --- for orientation: limiting zero and 100 line (positions were given by user)
    DRAWSEGMENT(barindex-1,ZeroLine,barindex,Zeroline) coloured(R,G,B)
    DRAWSEGMENT(barindex-1,HundredLine,barindex,HundredLine) coloured(R,G,B)
    // --- the border lines
    //     border distance as ratio value calculated above, add this distance to the zero line to get its y-axis position
    DRAWSEGMENT(barindex-1,ZeroLine+OUBorder1,barindex,Zeroline+OUBorder1) coloured(R,G,B)
    DRAWSEGMENT(barindex-1,ZeroLine+OUBorder2,barindex,Zeroline+OUBorder2) coloured(R,G,B)
    DRAWSEGMENT(barindex-1,ZeroLine+OLBorder1,barindex,Zeroline+OLBorder1) coloured(R,G,B)
    DRAWSEGMENT(barindex-1,ZeroLine+OLBorder2,barindex,Zeroline+OLBorder2) coloured(R,G,B)
    // --- the rsi line
    //     rsi value as ratio value calculated above, add this rsi value to the zero line to get its y-axis position
    DRAWSEGMENT(barindex-1,ZeroLine+ORSIpreval,barindex,Zeroline+ORSIval) coloured(R,G,B)
    // === Drawing End
    RETURN
    // === Program End
    #40146 quote
    AVT
    Participant
    Senior

    Forgot a pic

    Nicolas thanked this post
    #44181 quote
    AVT
    Participant
    Senior

    @Elsborgtrading

    Is your fractal line drawing still problematic and if yes, could you paint a line into that picture you had attached to show how a line should look like (don’t understand the text you wrote). Then I could see whether I find a way.

    #91262 quote
    dan55
    Participant
    New

    Bonjour Nicolas,

    je cherche comment faire un indicateur de lignes horizontales dans chaque UT (4h à 1mn par exemple) en temps réel et non statique.

    Par exemple : dans l’UT 4H, je traces les lignes (horizontales) MM7 MM20 MM50 BandeBollinger Haut, Bande Bollinger Bas (avec texte et couleur personnalisé)

    Il faut aussi que ces lignes apparaissent égalementdans les autres UT plus petites (1h, 15mn…)

    Merci d’avance 🙂

    #91275 quote
    Vonasi
    Moderator
    Master

    dan55 – English only in the English forum please.

    #91278 quote
    dan55
    Participant
    New
    Hello Nicolas,
    
    I am looking for how to make an indicator of horizontal lines in each UT (15MN to 1mn for example) in real time and not static.
    
    For example: in the UT 15MN, I trace the lines (horizontal) MM7 MM20 MM50 BandBollinger Top, Band Bollinger Bottom (with text and custom color)
    
    It is also necessary that these lines also appear in the other smaller UTs (5/2/1MN ...) in real time (recalculation OF AVERAGE every second)
    
    Thanks in advance   
Viewing 12 posts - 31 through 42 (of 42 total)
  • You must be logged in to reply to this topic.

Help for graphical indicators development version 10.3


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Nicolas @nicolas Keymaster
Summary

This topic contains 41 replies,
has 13 voices, and was last updated by dan55
6 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/18/2016
Status: Active
Attachments: 8 files
Logo Logo
Loading...