Run Script on Command

JP48

New member
I've got a script that runs but takes a lot of time to run. I don't need it to continuously update, in fact don't want it to use today's data, just the past five days. Is there a way to not have it continuously update but only run through once when I want it to?

Thanks.
 

JP48

New member
Below is the script I'm using with the long calc times.

What I eventually want to do is have a watch list column that reports on Stochastic Slow and CCI crossings. I have a script that seems to do well with the Stochastic but the CCI is the problem right now.

I tried to find other scripts using CCI but the one I found seems to calculate the CCI not just go and get the result from the CCI study. Can that be done and if so what is the syntax to access the CCI?

Thanks,

Jim

Code:
#CCI-Stoch-Cross
#Jim Pyle

#####

input length = 14;
input over_sold = -100;
input over_bought = 100;
input showBreakoutSignals = no;


#####


# Define CCIs

def price = close + low + high;
def linDev = lindev(price, length);
def CCI = if linDev == 0 then 0 else (price - Average(price, length)) / linDev / 0.015;
def ZeroLine = 0;

def CCI_Lo = CCI crosses above over_sold;
def CCI_Hi = CCI crosses below over_bought;
def CCI_Mid = CCI crosses Zeroline;

def CCI_Lo_5 = CCI_Lo[1] or CCI_Lo[2] or CCI_Lo[3] or CCI_Lo[4] or CCI_Lo[5];
def CCI_Hi_5 = CCI_Hi[1]or CCI_Hi[2]or CCI_Hi[3]or CCI_Hi[4]or CCI_Hi[5];
def CCI_Mid_5 = CCI_Mid[1]or CCI_Mid[2]or CCI_Mid[3]or CCI_Mid[4]or CCI_Mid[5];

#####
AddLabel(yes, if CCI_Hi_5 then “a   CCI High” else if CCI_Lo_5 then “b  CCI Low” else if CCI_Mid_5 then “c  CCI Mid” else“No Crossing”,color.white);
 

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