EPS growth not show correctly

talktohe

New member
I would like to write a code for a scanner that scans stocks with minimum 25% increase in EPS annually. However, no results when the interval was selected as Month. What's wrong with the code?

Code:
Def percentage = 0.25;
def AE = if IsNaN(GetActualEarnings()) then 0 else GetActualEarnings();
Def EPS_TTM = sum(AE, 12);
Def EPS2Years = sum (AE,24) - sum (AE,12);
Def EPS3Years = sum (AE,36) - sum (AE,24);
Def PrcntChng2 = (EPS_TTM/EPS2Years)-1;
Def PrcntChng3 = (EPS2Years/EPS3Years)-1;

Plot Signal= prcntChng2 >= percentage and
                      prcntChng3 >= percentage;
 
@talktohe Here is a hint for determining if your scan logic is correct... If you place the code above in a Study and add a couple AddLabel() calls you can see whether your logic for your def calculations are resulting in the correct numbers... If I was going to debug the code for you that's what I'd probably do so give it a try...
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@rad14733 I tried to add one addlabel with the code on top of unusual volume study (default from TOS), but the code is problematic.

Def percentage = 0.25;
def AE = if IsNaN(GetActualEarnings()) then 0 else GetActualEarnings();
Def EPS_TTM = sum(AE, 12);
Def EPS2Years = sum (AE,24) - sum (AE,12);
Def EPS3Years = sum (AE,36) - sum (AE,24);
Def PrcntChng2 = (EPS_TTM/EPS2Years)-1;
Def PrcntChng3 = (EPS2Years/EPS3Years)-1;

Plot Signal= prcntChng2 >= percentage and
prcntChng3 >= percentage;

AddLabelel (yes, PrcntChng2);

input price = volume;
input choice = {default increased, decreased};
input percent = 20;
input length = 50;
def avg = average(price, length)[1];
def chg = 100*(price/avg -1);
plot scan;

switch (choice) {
case increased:
scan = chg >= percent;
case decreased:
scan = chg <= -percent;
}
 
@talktohe Define "problematic"... The code below is what I was referring to for debugging... I'm attempting to teach you to help yourself, not to solve your problems for you... It's your vision, bring it to reality... Obviously, your logic must be flawed because you aren't getting any real results...

Edited to add: Upon further review, even the Learning Center code for GetActualEarnings() doesn't work so it either only works during regular trading hours or the function is broken... I tried multiple symbols to no avail... You may need to call TOS support...

Ruby:
Def percentage = 0.25;
def AE = if IsNaN(GetActualEarnings()) then 0 else GetActualEarnings();
Def EPS_TTM = sum(AE, 12);
Def EPS2Years = sum (AE,24) - sum (AE,12);
Def EPS3Years = sum (AE,36) - sum (AE,24);
Def PrcntChng2 = (EPS_TTM/EPS2Years)-1;
Def PrcntChng3 = (EPS2Years/EPS3Years)-1;

Plot Signal= prcntChng2 >= percentage and
prcntChng3 >= percentage;

AddLabel(yes, "AE: " + AE, Color.WHITE);
AddLabel(yes, "EPS_TTM: " + EPS_TTM, Color.WHITE);
AddLabel(yes, "EPS2Years: " + EPS2Years, Color.WHITE);
AddLabel(yes, "EPS3Years: " + EPS3Years, Color.WHITE);
AddLabel(yes, "PrcntChng2: " + PrcntChng2, Color.WHITE);
AddLabel(yes, "PrcntChng3: " + PrcntChng3, Color.WHITE);
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
561 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top