Announcement

Collapse
No announcement yet.

comparing present Tick with previous Tick

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

  • comparing present Tick with previous Tick

    Hi,
    I want to do a simple study which compares the present Tick with the previous Tick - eg:

    if close (0) > close(-1)...then display a green vertical line on the 1min (or any other time frame) advanced chart
    or
    if close (0) < close(-1)...then display a red vertical line on the 1min (or any other time frame) advanced chart

    ..as above, but comparing Ticks instead. Any idea if this is possible?

    Thanks,
    Paul
    Last edited by TURLIES; 10-08-2010, 06:43 AM.

  • #2
    You want to save close(0) into a variable (e.g., prevClose), compare it to the current close(0), do your line coloring and then set the the current close(0) value to prevClose.

    PHP Code:
    var bInit false
    var 
    prevClose;
    main()
    {
      if (
    bInit == false)
      {
        
    prevClose close(0);
        
    bInit true;
      } 
      if (
    close(0) > prevClose)
      {
        
    // display green vertical line
      
    }
      else if (
    close(0) < prevClose)
      {
        
    // display red vertical line
      
    }
      
    prevClose close(0);

    [Now, I'm assuming that you don't call setComputeOnClose() in your preMain().]

    Comment


    • #3
      Spot on.

      Thanks Steve

      Comment

      Working...
      X