Announcement

Collapse
No announcement yet.

Count of consecutive BarBgColor

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

  • Count of consecutive BarBgColor

    I have an EFS that paints each Bar Background Color red or green. I would like to add coding to count and return the number of consecutive red or green bars. So if the bars on a chart starting from the latest and going backwards are say, 5 green, 12 red, 3 green, 8 red etc I would like to plot the numbers 5, 12, 3, 8 etc underneath and export them with DDE.

    Any help will be appreciated.

  • #2
    this might take a bit of work....

    what I would do is store all of the colors into an array that matches the number of bars on the chart. That way you can look back in the array to determine how many colors there are and then write the info to a CSV file.

    This is how I would do it because I find working with arrays are easier.
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      Thank you Brad for your suggestion.

      I am very familiar with the DDE aspect of EFS since I am using it all the time, but not with other coding. Maybe if I simplify my need it will be easier for someone to assist me.

      Currently I am manually monitoring the 30 Dow Stocks with 3 min charts. I focus my attention to trade whenever the last barbgcolor changes color to either green or red eyeballing the length of the previous color bars. I would like to increase the stock universe to include S&P 500 stocks but it will be impossible to be monitoring the last bar background color manually.

      So if I could add some coding inside the EFS that counts the number of bars of the latest background color, then whenever I get the number 1 it will trigger my trades. If in addition I could get the number of bars of the previous background color it will assist me in the money management of the trade.

      Once I have either one number or two returned by the EFS then it is easy for me to do the rest.

      Thank you all in advance for your time.

      Comment

      Working...
      X