Opening Range Breakout with Fib

Forums ProRealTime English forum ProBuilder support Opening Range Breakout with Fib

Viewing 1 post (of 1 total)
  • #241847

    Dear coders, I am new to ProRealtime, coming from ThinkOrSwim.

    Could you please convert this code. It is very important to me 😉

    MultiTimeFrame would be excellent! Thanks.

    ++++++++++++++++++++++++++++++++++++++++++++

    #Opening Range Fibs
    #Using the first candle to create Fib Support/Resist Levels
    #Added Options to Hide/Show lines

    def na = double.nan;

    input ORBegin = 0930;
    input OREnd = 1000;
    def dayend = 1600;

    input cloud = yes;

    Input FibExt1 = 1.000;
    Input FibExt2 = 1.618;
    Input FibExt3 = 2.000;
    Input FibExt4 = 2.618;
    Input FibExt5 = 3.618;
    Input FibExt6 = 4.236;
    Input ShowORH = yes;
    Input ShowORL = yes;
    Input ShowFibMid = yes;
    Input ShowFibExt1 = yes;
    Input ShowFibExt2 = yes;
    Input ShowFibExt3 = yes;
    Input ShowFibExt4 = yes;
    Input ShowFibExt5 = yes;
    Input ShowFibExt6 = yes;

    input ShowTodayOnly = Yes;
    def s = ShowTodayOnly;

    input extend_lines = yes;

    Def daytime = if (secondsfromtime(ORBegin)>=0 and secondstilltime(dayend)>0 ) then 1 else 0;
    def daytimex = (isnan(close) and daytime);
    def currentday = getday()==getlastday();

    def daysafter = getday() > getlastday();
    def daysbefore = getday() <= getlastday();

    Def ORActive = if secondsfromtime(ORBegin) >= 0 and secondstilltime(OREnd) > 0 then 1 else 0;
    Def today = if s == 0 OR getday()==getlastday() AND secondsfromtime(ORBegin)>=0 then 1 else 0;

    Def ORHigh = if daysafter then na
    else if (extend_lines and isnan(close)) then ORHigh[1]
    else if ORHigh[1] == 0 or ORActive[1] == 0 AND ORActive == 1 then high
    else if ORActive AND high > ORHigh[1] then high
    else ORHigh[1];

    Def ORLow = if daysafter then na
    else if (extend_lines and isnan(close)) then ORlow[1]
    else if ORLow[1] == 0 or ORActive[1] == 0 AND ORActive == 1 then low
    else if ORActive AND low < ORLow[1] then low
    else ORLow[1];

    Def ORWidth = ORHigh – ORLow;

    Def fib_mid = (ORHigh+ORLow)/2;
    Def fib_ext_up1 = ORHigh + ORWidth*(FibExt1 – 1);
    Def fib_ext_down1 = ORLow – ORWidth*(FibExt1 – 1);
    Def fib_ext_up2= ORHigh + ORWidth*(FibExt2 – 1);
    Def fib_ext_down2 = ORLow – ORWidth*(FibExt2 – 1);
    Def fib_ext_up3= ORHigh + ORWidth*(FibExt3 – 1);
    Def fib_ext_down3 = ORLow – ORWidth*(FibExt3 – 1);
    Def fib_ext_up4= ORHigh + ORWidth*(FibExt4 – 1);
    Def fib_ext_down4 = ORLow – ORWidth*(FibExt4 – 1);
    Def fib_ext_up5= ORHigh + ORWidth*(FibExt5 – 1);
    Def fib_ext_down5 = ORLow – ORWidth*(FibExt5 – 1);
    Def fib_ext_up6= ORHigh + ORWidth*(FibExt6 – 1);
    Def fib_ext_down6 = ORLow – ORWidth*(FibExt6 – 1);
    #
    # Define all the plots:
    #
    Plot ORH = if ORActive OR today < 1 OR !ShowORH then double.nan else ORHigh;
    Plot ORL = if ORActive OR today < 1 or !ShowORL then double.nan else ORLow;
    Plot FibMid = if ORActive OR today < 1 or !ShowFibMid then double.nan else fib_mid;
    Plot FibExtUp1 = if ORActive OR today < 1 or !ShowFibExt1 then double.nan else fib_ext_up1;
    Plot FibExtDown1 = if ORActive OR today < 1 or !ShowFibExt1 then double.nan else fib_ext_down1;
    Plot FibExtUp2 = if ORActive OR today < 1 or !ShowFibExt2 then double.nan else fib_ext_up2;
    Plot FibExtDown2 = if ORActive OR today < 1 or !ShowFibExt2 then double.nan else fib_ext_down2;
    Plot FibExtUp3 = if ORActive OR today < 1 or !ShowFibExt3 then double.nan else fib_ext_up3;
    Plot FibExtDown3 = if ORActive OR today < 1 or !ShowFibExt3 then double.nan else fib_ext_down3;
    Plot FibExtUp4=if ORActive OR today < 1 then double.nan else fib_ext_up4;
    Plot FibExtDown4=if ORActive OR today < 1 then double.nan else fib_ext_down4;
    Plot FibExtUp5=if ORActive OR today < 1 then double.nan else fib_ext_up5;
    Plot FibExtDown5=if ORActive OR today < 1 then double.nan else fib_ext_down5;
    Plot FibExtUp6=if ORActive OR today < 1 then double.nan else fib_ext_up6;
    Plot FibExtDown6=if ORActive OR today < 1 then double.nan else fib_ext_down6;

    ORH.setdefaultcolor(color.light_gray);
    ORH.setStyle(curve.Long_DASH);
    ORH.setlineweight(1);
    ORL.setdefaultcolor(color.light_gray);
    ORL.setStyle(curve.Long_DASH);
    ORL.setlineweight(1);
    FibMid.setdefaultcolor(color.gray);
    FibMid.setStyle(curve.SHORT_DASH);
    FibMid.setlineweight(1);
    FibExtUp1.setdefaultcolor(color.gray);
    FibExtUp1.setStyle(curve.SHORT_DASH);
    FibExtUp1.setlineweight(1);
    FibExtDown1.setdefaultcolor(color.gray);
    FibExtDown1.setStyle(curve.SHORT_DASH);
    FibExtDown1.setlineweight(1);
    FibExtUp2.setdefaultcolor(color.gray);
    FibExtUp2.setStyle(curve.SHORT_DASH);
    FibExtUp2.setlineweight(1);
    FibExtDown2.setdefaultcolor(color.gray);
    FibExtDown2.setStyle(curve.SHORT_DASH);
    FibExtDown2.setlineweight(1);
    FibExtUp3.setdefaultcolor(color.gray);
    FibExtUp3.setStyle(curve.SHORT_DASH);
    FibExtUp3.setlineweight(1);
    FibExtDown3.setdefaultcolor(color.gray);
    FibExtDown3.setStyle(curve.SHORT_DASH);
    FibExtDown3.setlineweight(1);
    FibExtUp4.setdefaultcolor(color.gray);
    FibExtUp4.setStyle(curve.SHORT_DASH);
    FibExtUp4.setlineweight(1);
    FibExtDown4.setdefaultcolor(color.gray);
    FibExtDown4.setStyle(curve.SHORT_DASH);
    FibExtDown4.setlineweight(1);
    FibExtUp5.setdefaultcolor(color.gray);
    FibExtUp5.setStyle(curve.SHORT_DASH);
    FibExtUp5.setlineweight(1);
    FibExtDown5.setdefaultcolor(color.gray);
    FibExtDown5.setStyle(curve.SHORT_DASH);
    FibExtDown5.setlineweight(1);
    FibExtUp6.setdefaultcolor(color.red);
    FibExtUp6.setStyle(curve.SHORT_DASH);
    FibExtUp6.setlineweight(1);
    FibExtDown6.setdefaultcolor(color.red);
    FibExtDown6.setStyle(curve.SHORT_DASH);
    FibExtDown6.setlineweight(1);

    AddCloud(ORH, FIBmid, Color.dark_GREEN, Color.dark_GREEN);
    AddCloud(FIBmid, ORL, Color.dark_RED, Color.dark_RED);

    AddChartBubble((showFibExt1), FibExt1 *1, “1,00 0%”, Color.dark_GREEN, yes);
    AddChartBubble((showFibExt2), FibExt2 *1, “1.618 0%”, Color.dark_RED, yes);

     

Viewing 1 post (of 1 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login