Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I identify "First bar of day"

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

    #31
    double to int convertion

    Appreciate help in this:

    I´m trying to input an incrementing value into the SUM method that counts when [
    VolratioDS[0]>Threshold], and then resets. I need to use a dataseries value as input (I asume). But since these are doubles and the method expects an int input, I get stuck.

    When I try to pass the dataseries value (CountDS) to an int variable (count) I once again get stuck cos I "cannot convert double to int".

    Is there way to make the SUM method accept the double input, to make the dataseries an int, or to convert the dataseries double to a variable int? Any other solution?


    if (VolratioDS[0]>Threshold)
    {
    if (Crossover == false)
    {
    CountDS.Set(1);
    count = CountDS[0];
    CumvolDS.Set(SUM(VoldiffDS, count)[0]);
    Crossover = true;
    if (CumvolDS[0]>0)
    {
    Plotpos.Set(CumvolDS[0]);
    }
    else
    {
    Plotneg.Set(CumvolDS[0]);
    }
    }
    else
    {
    CountDS.Set(CountDS[0]+1);
    count = CountDS[0];
    CumvolDS.Set(SUM(VoldiffDS, count)[0]);

    if (CumvolDS[0]>0)
    {
    Plotpos.Set(CumvolDS[0]);
    }
    else
    {
    Plotneg.Set(CumvolDS[0]);
    }
    }
    }
    else
    {
    Crossover = false;
    count = 0;
    CountDS.Set(0);
    Plotpos.Set(0);
    Plotneg.Set(0);
    }



    //Fredrik

    Comment


      #32
      Lots of answeres on this if I wasn´t so lazy to ask first : ). However, I doubt I did this the most efficient way;

      CountDS.Set(CountDS[0]+1);
      countd = CountDS[0];
      counti = System.Convert.ToInt32(countd);
      CumvolDS.Set(SUM(VoldiffDS, counti)[0]);
      if (CumvolDS[0]>0)

      Comment


        #33
        FREEN, you should also be able to cast it to an int -

        Code:
         
        CumvolDS.Set(SUM(VoldiffDS, (int)countd)[0]);

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        597 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        555 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X