Announcement

Collapse
No announcement yet.

Gann Trend Swing Chart

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

  • Gann Trend Swing Chart

    I have designed the attached EFS file to display a one-bar swing chart loosely based on Gann's 3 day swing charts which will indicate an up or down trend and allow Swing trading.

    My problem is that I want to display the information interactively and do not want to use the setComputeOnClose() function.

    The following code snippet works perfectly if all you want are color coded bars:-

    if (aHigh_G[0] > aHigh_G[1] && aLow_G[0] > aLow_G[1]){
    // HIGHER HIGH HIGHER LOW
    setPriceBarColor( Color.white );

    } else if (aHigh_G[0] < aHigh_G[1] && aLow_G[0] < aLow_G[1]){
    // LOWER HIGH LOWER LOW
    setPriceBarColor( Color.red );

    } else if (aHigh_G[0] < aHigh_G[1] && aLow_G[0] > aLow_G[1]){
    // INSIDE DAY
    return;

    } else if (aHigh_G[0] >= aHigh_G[1] && aLow_G[0] <= aLow_G[1]){
    // OUTSIDE DAY
    if (aClose_G[0] > aOpen_G[0]){

    // OUTSIDE DAY HIGHER CLOSE
    setPriceBarColor( Color.white );

    }else if (aClose_G[0] < aOpen_G[0]){
    setPriceBarColor( Color.red );

    } else {
    return;

    }

    } else {
    return;

    }

    However when you add lines to be used as support resistance points as well as text and labels at turning points I have found it impossible for to code to work both interactively on the current bar where changes are updated immediately on each new tick and then update everything properly to all previous bars when a new bar is formed as well as have all the bars properly color coded.

    I have tried to use the code snippet above for drawing lines, text and labels and it works well on previous bars but not the current bar as soon as new ticks come in. You have to manually refresh the file to get the correct information display. As per the attached file I split the coding so that the current bar is updated with temporary lines, shapes and text which are removed with each new bar will update interactively on each new tick. I then tried to code separtely for previous bars which fails miserably and I can't understand why.

    Any help to make this coding work to the specifications I have outlined would be much appreciated.

    Robert
    Attached Files

  • #2
    Robert,

    Could you please specify you description with a snapshot. As I understand lines and text cant be drawn correctly in realtime. But I can't see the problem on a chart.

    Thank you,
    Robert

    Comment


    • #3
      Here is the image using the previously posted file gpb.efs:-

      The information is displayed incorrectly for all bars with the exception of colors. See later threads for correct display.

      Robert
      Attached Files

      Comment


      • #4
        Here is a correctly displayed image both in colors and text and shapes using gpb.r1.efs attached in a later thread.

        Robert
        Attached Files

        Comment


        • #5
          I have attached the file gpb.r1.efs used for the correct displayed info. However to acheive this I have coded only on the current bar which is fine if you do not want interactivity as each new tick comes in and setComputerOnClose() as true.

          If you do not do this then any updates on the current bar gets messed up for the graphics until you reset the chart manually.

          What really gets my guile is that color coded bars display perfectly and you do not need how to think to separate coding for the current bar and previous bars which you have to do to display text, lines, shapes etc.. both in real time and historically. This leads to a nightmare of programming and I can't get my head round how to do it.

          I would like some one to shine a light how to do it hopefully in a concise way.

          Any help will be much appreciated

          Robert
          Attached Files

          Comment

          Working...
          X