Announcement

Collapse
No announcement yet.

How to calculate %change between ask and close on premarket without print

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

  • How to calculate %change between ask and close on premarket without print

    Good day. I need calculate % difference between ask and close but column "Ask change (percent)" not suitable because it start to show information only after first trade. i tried to wrote some code to searching this %differs on premarket but it not work:
    function preMain()
    {
    setPriceStudy(true);
    setStudyTitle("Difference");
    }
    var Last ;
    var Ask;
    var Difference;

    function main() {
    Last = getMostRecentTrade();
    Ask =getMostRecentAsk();
    Difference= (Ask-Last)/Last*100;
    return(Difference);
    }
    when I insert this code in column it show only "0"
    What i doing wrong?
    And how to display %change for stocks without print?
    Many thanks.
    Sincerely, Konstantin.

  • #2
    How to calculate %change between ask and close on premarket without print

    Good day. I need calculate % difference between ask and close but column "Ask change (percent)" not suitable because it start to show information only after first trade. i tried to wrote some code to searching this %differs on premarket but it not work:
    function preMain()
    {
    setPriceStudy(true);
    setStudyTitle("Difference");
    }
    var Last ;
    var Ask;
    var Difference;

    function main() {
    Last = getMostRecentTrade();
    Ask =getMostRecentAsk();
    Difference= (Ask-Last)/Last*100;
    return(Difference);
    }
    when I insert this code in column it show only "0"
    What i doing wrong?
    And how to display %change for stocks without print?
    Many thanks.
    Sincerely, Konstantin.

    Comment

    Working...
    X