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

Top