Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetBar values cant be divided by another.

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

    GetBar values cant be divided by another.

    Hi. Aparently GetBar values cant be divided by another and will always output 1

    I used
    int max2 = Bars.GetBar(savedMax[savedMax.Count-2].Time);
    int min2 = Bars.GetBar(savedMin[savedMin.Count-2].Time);
    Print (min2);
    Print (max2);
    Print (min2-max2);
    Print (min2/max2);
    Print ("stop");
    and what i got was this?
    704
    683
    21
    1
    stop
    1418
    1404
    14
    1
    stop
    3317
    3282
    35
    1
    stop
    3990
    3950
    40
    1
    stop
    4020
    3998
    22
    1
    stop
    6415
    6373
    42
    1
    stop
    6517
    6450
    67
    1
    stop
    8159
    8116
    43
    1
    stop
    9114
    9043
    71
    1
    stop
    9740
    9711
    29
    1
    stop
    10568
    10546
    22
    1
    stop
    10611
    10580
    31
    1
    stop

    anyone knows how to fix this?

    EDIT: oopsy, this was supposed to go in general programming, but i guess it doesnt make much of a diffrence.
    Last edited by BigRo; 11-12-2015, 12:18 PM.

    #2
    Hello,

    I believe you are just running into trying to divide Integer's which are not able to be divided. Instead you would need to cast these as doubles or:

    Print ((double)min2/(double)max2);

    Or as a result:

    double result = (double)min2 / (double)max2;

    Please try this and see if you now get a result in your script.


    I look forward to being of further assistance .

    Comment


      #3
      9114
      9043
      71
      1,0078513767555
      stop
      9740
      9711
      29
      1,00298630419112
      stop
      10568
      10546
      22
      1,00208609899488
      stop
      10611
      10580
      31
      1,00293005671078
      stop


      chi ching
      thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      558 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      546 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X