input trailType = {default modified, unmodified};
input ATRPeriod = 28;
input ATRFactor = 5;
input firstTrade = {default long, short};
input averageType = AverageType.WILDERS;
input fib1Level = 61.8;
input fib2Level = 78.6;
input fib3Level = 88.6;
Assert(ATRFactor > 0, "'atr factor' must be positive: " + ATRFactor);
def trail = ATRTrailingStop(trailType, ATRPeriod, ATRFactor, firstTrade, averageType);
def stateLong = low > trail[1];
def stateShort = high < trail[1];
def BuySignal = Crosses(stateLong, 0, CrossingDirection.ABOVE);
def SellSignal = Crosses(stateShort, 0, CrossingDirection.ABOVE);
def ex = if BuySignal then high else if SellSignal then low else if stateLong then Max(ex[1], high) else if stateShort then Min(ex[1], low) else ex[1];
def TrailingStop = trail;
def Extremum = ex;
def f1 = ex + (trail - ex) * fib1Level / 100;
def f2 = ex + (trail - ex) * fib2Level / 100;
def f3 = ex + (trail - ex) * fib3Level / 100;
def l100 = trail + 0;
def Fib1 = f1;
def Fib2 = f2; def Fib3 = f3;
##edited by Playstation 31.05.2020##
##Criteria of price between f1 & f2 zones and swingarm trend is bullish##
##Criteria of price between f1 & f2 zones and swingarm trend is bearish##
plot data = if (close is greater than f2 and close is less than f1) and f1 > f2 then 2 else if (close is less than f2 and close is greater than f1) and f1 < f2 then 1 else 0;
AssignBackgroundColor(if data == 2 then Color.PINK else if data==1 then Color.BLUE else Color.GRAY);
Why is MES used instead of ES? And can someone explain the zone labels in the new watchlist? Thanks!
I know what it is, I'm just not sure why it's used as a base chart since there are minor bar differences between the two.@KarlWolff /MES is the micro E-mini S&P 500 and you can get exposure to the standard /ES for 1/10th of the size.
@hhjani You can join our chatroom here: https://discord.gg/HQVZUxB
@Sagar What seems to be the issue? Can you post a screenshot of the error?
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
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.
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.