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.
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