OK is greyed out, when saving a script

OptionsTrader

New member
Hey guys here is my code for some custom candlesticks I am using. I am trying to add the last condition would be ADX is rising not just above the trend level (I left a space where around line 18). I tried doing something similar to the LRV and put in: Def Trending= ADX (close, 50) - ADX (close, 9); after the DEF TRUP/TRDown. I don't get an error message but I can't press apply or ok and I'm really confused as to why. Any help would be very appreciated. Thanks
Code:
declare once_per_bar;

def NetChgAvg = MovingAverage(AverageType.WILDERS, close - close[1], 14);

def theta = GetYYYYMMDD();
def LRV = Inertia(close - ((Highest(high, 20) + Lowest(low, 20)) / 2 + ExpAverage(close, 20)) / 2, 20);

input ADXLength = 14;
input ADXTrend = 20;
input ADXaverageType = AverageType.WILDERS;
def ADX = DMI(ADXlength, ADXaverageType).ADX;
def DIPlus = reference DIPlus(length = ADXLength);
def DIMinus = reference DIMinus(length = ADXLength);
def Tr = if ADX > ADXTrend then 1 else 0;
Def TRUp = if DIPlus > DIMinus and TR then 1 else 0;
Def TRDown = If DIMinus > DIPlus and TR then 1 else 0;



def Value = MovingAverage(AverageType.EXPONENTIAL, close, 10) - MovingAverage(AverageType.EXPONENTIAL, close, 50);
def Avg = MovingAverage(AverageType.EXPONENTIAL, Value, 9);

def periodIndx = theta;
def isPeriodRolled = CompoundValue(1, periodIndx != periodIndx[1], yes);
def volumeSum;
def volumeVwapSum;
def volumeVwap2Sum;
if (isPeriodRolled) {
    volumeSum = volume;
    volumeVwapSum = volume * vwap;
    volumeVwap2Sum = volume * Sqr(vwap);
} else {
    volumeSum = CompoundValue(1, volumeSum[1] + volume, volume);
    volumeVwapSum = CompoundValue(1, volumeVwapSum[1] + volume * vwap, volume * vwap);
    volumeVwap2Sum = CompoundValue(1, volumeVwap2Sum[1] + volume * Sqr(vwap), volume * Sqr(vwap));
}
def VWAP = volumeVwapSum / volumeSum;

def bulltrend = if ((Value > 0 and Avg > 0)) and (LRV > 0 and NetChgAvg > 0) and close[1] > VWAP[1] and close > VWAP  and TRUp then 1 else 0;

def beartrend = if ((Value < 0 and Avg < 0)) and (LRV < 0 and NetChgAvg < 0) and close[1] < VWAP[1] and close < VWAP and TRDown then 1 else 0;

AssignPriceColor(if bulltrend then Color.GREEN else if beartrend then Color.RED else Color.BLUE);

#End
 
Solution
@OptionsTrader @cellsee6

There are no errors in your codes.
Generally, when "ok" is greyed out it means that it doesn't like the name you are giving it.
Save it under another name, try TEST.
Make sure whatever you use has no dashes or spaces.

If it is still greyed out, even after modifying the name that you are giving it;
we will need to see a screenshot.
In a watchlist in papermoney I have selected the custom4 item and added it to the right side.
I inserted my code (see the code below) but the OK button is greyed out. Why? I can enter the code into the live watchlist.

Code:
input length = 200;
input smooth = 9;
declare lower;
declare hide_on_intraday;
input longLength = 252;
input shortLength = 20;

def impvol = reference impvolatility * 100;
plot IV = impvol;

def clLog = log(close / close[1]);
plot HV = 100 * stdev(clLog, shortLength) * Sqrt(shortLength * longLength / (shortLength - 1));
HV.SetDefaultColor(GetColor(0));

def LowIV = Lowest(imp_volatility, length);
def HiIV = Highest(imp_volatility, length);
def IVRange = HiIV - LowIV;
def ivnet = imp_volatility - LowIV;
def Rank = round((ivnet / IVrange) * 100);
# plot SMA = Average(Rank, smooth);
plot RankIV = Rank ;
 
@OptionsTrader @cellsee6

There are no errors in your codes.
Generally, when "ok" is greyed out it means that it doesn't like the name you are giving it.
Save it under another name, try TEST.
Make sure whatever you use has no dashes or spaces.

If it is still greyed out, even after modifying the name that you are giving it;
we will need to see a screenshot.
 
Last edited:
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
564 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