Announcement

Collapse
No announcement yet.

Pivot / Trend Lines

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pivot / Trend Lines

    Hello,
    I have an indicator that has code in easy language that I would like to use on my esignal charts. It will draw trend lines on the chart - I will paste it below; can this be tailored for esignal? MY charts are all black background, so perhaps green for upward slope line and red for down? (original eh?)

    Here it is:

    Inputs: maxlookback(100);

    var: counter(0),
    counter2(0),
    HHBack(0),
    HHback2(0),
    HHback3(0),
    LLBack(0),
    LLback2(0),
    LLback3(0),
    bottform(0),
    topform(0),
    dir(0),
    sgMRObott(0),
    sgMROtop(0),
    HHTopTime(0),
    HHTopDate(0),
    HHTopVal(0),
    LLBottomDate(0),
    LLBottomTime(0),
    LLBottomVal(0),
    maxlength(0),
    tlAexists(0),
    tlBexists(0),
    hh(0),
    hl(0);

    if barnumber = 1 then
    dir = 1;

    maxlength = MRO(dir = 1, maxlookback, 1);
    counter = 0;
    while counter < maxlength
    begin
    if high[counter +1] > H and H[counter] <= H then
    begin
    HHback = counter+1;
    counter = maxlength + 1;
    end else
    begin
    counter = counter + 1;
    end;
    end;


    maxlength = MRO( dir = 1, maxlookback, 3);
    counter = 0;
    while counter < maxlength
    begin
    if lowestbarfirst(L, counter) = highestbarfirst(H,
    counter) and lowestbarfirst(L, counter) <> 0 and
    lowestbarfirst(L, counter)<>0 then
    begin
    HHback2 = counter;
    counter = counter + maxlength;
    end else
    begin
    counter = counter + 1;
    end;
    end;

    maxlength = MRO(dir = 1, maxlookback, 3);
    counter = 0;
    while counter <= maxlength
    begin
    if C[counter] >= L[Lowestbarfirst(L, maxlength)] and
    C[counter] <=H[Lowestbarfirst(L, maxlength)] and
    lowestbarfirst(L, counter)<>0 then
    begin
    HHback3 = counter;
    counter = counter + 1;
    end else
    begin
    counter = counter + 1;
    end;
    end;

    HHback = MaxList(HHback, HHback2, HHback3);


    If (C[1] <= H[lowestbarfirst(L,HHback+1)] and C >
    H[lowestbarfirst(L,HHback+1)]) or
    (C[1] <= H[lowestbarfirst(L,MRO(dir = 1, HHback+1,
    1))] and C > H[lowestbarfirst(L,MRO(dir = 1, HHback+1,
    1))]) then
    begin
    bottform = 1;
    end else
    begin
    bottform = -1;
    end;

    if dir[2] = 1 and dir[1] = -1 and C <= H[1] then
    begin
    bottform = -1;
    end;

    if dir[2] = -1 and dir[1] = -1 and L[1] < L[2] and C<=
    H[1] then
    bottform = -1;


    maxlength = MRO(dir = -1, maxlookback, 1);
    counter = 0;
    while counter < maxlength
    begin
    if Low[counter +1] < L and L[counter] >= L then
    begin
    LLback = counter+1;
    counter = maxlength + 1;
    end else
    begin
    counter = counter + 1;
    end;
    end;

    maxlength = MRO(dir = -1, maxlookback, 3);
    counter = 0;
    while counter < maxlength
    begin
    if lowestbarfirst(L, counter) = highestbarfirst(H,
    counter) and lowestbarfirst(L, counter) <> 0 and
    highestbarfirst(H, counter)<>0 then
    begin
    LLback2 = counter ;
    counter = maxlength + 1;
    end else
    begin
    counter = counter + 1;
    end;
    end;


    maxlength = MRO(dir = -1, maxlookback, 3);
    counter = 0;
    while counter <= maxlength
    begin
    if C[counter] <= H[Highestbarfirst(H, maxlength)] and
    C[counter] >=L[Highestbarfirst(H, maxlength)] and
    highestbarfirst(H, counter)<>0 then
    begin
    LLback3 = counter;
    counter = counter + 1;
    end else
    begin
    counter = counter + 1;
    end;
    end;


    LLback = MaxList(LLback, LLback2, LLback3);


    If (C[1] >= L[highestbarfirst(H,LLback+1)] and C <
    L[highestbarfirst(H,LLback+1)]) or
    (C[1] >= L[highestbarfirst(H,MRO(dir = -1, LLback+1,
    1))] and C < L[highestbarfirst(H,MRO(dir = -1,
    LLback+1, 1))]) then
    begin
    topform = 1;
    end else
    begin
    topform = -1;
    end;

    if dir[2] = -1 and dir[1] = 1 and C >= L[1] then
    begin
    topform = -1;
    end;

    if dir[2] = 1 and dir[1] = 1 and H[1] > H[2] and C>=
    L[1] then
    topform = -1;


    {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
    sgMROtop = MRO(topform = 1, 100, 1) ;

    sgMRObott = MRO(bottform = 1, 100, 1);

    If sgMROtop > sgMRObott then
    dir = 1
    else if sgMROtop < sgMRObott then
    dir =-1;

    {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{}}}}}}}} }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

    If dir[1] = -1 and dir = 1 then
    begin

    HHTopDate = Date;
    HHTopTime = time;
    HHTopVal = H;
    end;

    If dir[1] = 1 and dir = 1 then
    begin
    if H <= HHTopVal[1] then
    begin
    HHTopVal = HHTopVal[1];
    HHTopDate = HHTopDate[1];
    HHTopTime = HHTopTime[1];
    end else
    begin
    if H > HHTopVal[1] then
    begin
    HHTopVal = H;
    HHTopDate = date;
    HHTopTime = time;
    end;

    end;
    end;


    If dir[1] = 1 and dir = -1 then
    begin
    LLBottomDate = Date;
    LLBottomTime = time;
    LLBottomVal = L;
    end;

    If dir[1] = -1 and dir = -1 then
    begin
    if L >= LLBottomVal[1] then
    begin
    LLBottomVal = LLBottomVal[1];
    LLBottomDate = LLBottomDate[1];
    LLBottomTime = LLBottomTime[1];
    end else
    begin
    if L < LLBottomVal[1] then
    begin
    LLBottomVal = L;
    LLBottomDate = date;
    LLBottomTime = time;
    end;

    end;
    end;

    if dir[1] = -1 and dir = 1 then
    begin
    value1 = TL_New(LLBottomDate, LLBottomTime,
    LLBottomVal, Date, Time, H);
    tl_setcolor(value1, blue);
    tl_setsize(value1, 1);
    tlAexists = 1;
    end;

    if dir[1] = 1 and dir = 1 and highestbarfirst(H,
    mro(dir = -1, maxlookback,1))=0 and tlAexists = 1 then
    begin
    TL_SetEnd(Value1, Date, Time, H);
    end;


    if dir[1] = 1 and dir = -1 then
    begin
    value2 = TL_New(HHTopDate, HHTopTime, HHTopVal, Date,
    Time, L);
    tl_setcolor(value2, magenta);
    tl_setsize(value2, 1);
    tlBexists = 1;
    end;
    if dir[1] = -1 and dir = -1 and lowestbarfirst(L,
    mro(dir = 1, maxlookback,1))=0 and tlBexists = 1 then
    begin
    TL_SetEnd(Value2, Date, Time, L);
    end;

    =====

  • #2
    TraderJen,

    With this much code, you may want to contact one of our EFS Consultants who may be able to help convert this for you. Thanks.

    Comment


    • #3
      Code

      Hi,
      OK, I thought it might be fairly straightforward to convert over; can you tell by looking at it if such a formula already exists on the file sharing area?
      I can provide you with a screen shot of what it looks like in a chart if that would be helpful and you let me know how to do that.
      Thanks,
      Jen

      Comment


      • #4
        TraderJen,

        Some of the programmers who contribute to this community are probably more qualified to answer your question regarding whether the code you provided already exists. In regards to posting some images, it's pretty easy. Here's how...

        You'll first want to start by taking picture of the chart you wish to upload to File Share. Please read this FAQ to see how this is done.

        Once the file has been uploaded to file share, you can include it in the post by choosing the "IMG" button at the top of the text window. Just enter the url of the image in fileshare to the Explorer User Prompt. The image will then be included in the post for all to see.

        Step 1





        Step 2



        Once the post is published, the image will be included in the body of the post. Please let me know how this works for you.

        Comment


        • #5
          Screen Shot

          Thanks for the directions;
          here is a screen shot of a chart from a fellow trader, with the formula I would like to get. Please see the angled lines - fuscia for the downward sloped line, and blue for the upward sloped lines.

          thanks again,
          Jen
          Attached Files

          Comment


          • #6
            Will try again; got error that file was too large:
            Attached Files

            Comment


            • #7
              Can anyone advise if there is an existing formula in esignal that would create the straight lines (fuscia for the downward sloped line, and blue for the upward sloped lines.) in the below chart?

              I'd really like to use them, thank you.

              Comment

              Working...
              X