You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to write a code that calculates the average range in earnings of 52 weeks.
However, I encounter issues and I can't seem to write it out due to my lack of knowledge in Thinkscript.
I get stuck on finding the range of the previous earnings, I think it has got to do with defining the date of the earnings. Below is the code that's as far as I get.
Kindly appreciate if anyone is able to help out thanks for reading
Cheers :)
#====================================================
def ear= HasEarnings(EarningTime.BEFORE_MARKET)[1];
def countdown = if ear then getyyYYMMDD() - getyYYYMMDD() else double.nan;
def a = if ear then getyyyymmdd() else double.nan;
def hod = if a then high(period = aggregationperiod.day) else double.nan;
def lod = if a then low(period = aggregationperiod.day) else double.nan;
Hi, I'm trying to write a code that calculates the average range in earnings of 52 weeks.
However, I encounter issues and I can't seem to write it out due to my lack of knowledge in Thinkscript.
I get stuck on finding the range of the previous earnings, I think it has got to do with defining the date of the earnings. Below is the code that's as far as I get.
Kindly appreciate if anyone is able to help out thanks for reading
Cheers :)
#====================================================
def ear= HasEarnings(EarningTime.BEFORE_MARKET)[1];
def countdown = if ear then getyyYYMMDD() - getyYYYMMDD() else double.nan;
def a = if ear then getyyyymmdd() else double.nan;
def hod = if a then high(period = aggregationperiod.day) else double.nan;
def lod = if a then low(period = aggregationperiod.day) else double.nan;
def range = if a then hod-lod else double.nan;
AddLabel(yes, "range" + range, Color.white);
#====================================================
The text was updated successfully, but these errors were encountered: