blackFLAG FTS - SwingArm Trend Indicator using ATRTrailing Stop and Fibonacci Retracements

Status
Not open for further replies.
@Craighaber71 Those settings are outdated. 2, 10, 30 - Should be 255 periods. Daily 75 (estimate)

@DaGekko No. I pay attention to higher timeframes and use lower time frames to time the entry.
 
@Zeppelin I am in meetings all day. But if you review page by page or view our youtube videos, you will get the much-needed education. Yes, it will take time, but it will greatly help you longer. Some of our members, when they become available, the will point you in the right direction.
 
Thank you for your guidance @fjr1300

found some updated codes and here is what I got minus some other other ones. I think my main problem is the color in my swing arms all run together and Jose has white lines separating the different levels. Was the lines taken out on purpose and I have the correct code? thanks

g0T1YyV.png
 
@Zeppelin Rather then pasting the codes , it is easier to just click the shared links of each grid shared in the original post on this thread. That will 100% correctly plot the indicators and then you can always save that layout to ToS and tailor it to your needs by adding or reducing the amount indicators/ chaning timeframes / etc.
 
Show me a screenshot to see the end result when you have a chance. What exactly is it that I should be looking for?

Not sure what you mean? I was looking for a price rejection off zone 4, and the last candle to be an up candle if entering a long, or the last candle to be a down candle if entering a short. Like the below, price hits TrailingStop, and bounces back up.

cbzcT0n.png
 
@Zeppelin You need to update the settings, not the code. Select that the lines be shown (show plot) fib 1 to 3.) that should do it.
 
@fjr1300 ok been messing with this for hours. I finally got the lines but my candles seem to be drawn out on the whole time frame. As your looks very definitive on the rising and falling of price. Also I just noticed that your background is completely black and my is grayish gridded. Do you know how I can change this also? thanks for your feedback sir.

7DMZz1O.png
 
@Zeppelin you see the round gear or a wheel next to 5min, click on it. click on price axis, uncheck fit study and fit study markers, click apply. I think that should resolve it.
 
@mansor
  1. Yes. Change candle type to Heiken Ashi.
  2. Go to "Style / Settings / Appearance / and Unselect - GRID. Also, change background to black.

you can turn off the volume on the bottom of the chart and also deselect highlight extended hours, this will show the whole chart black. not gray for Asia / European sessions. (that is my preference for my charts).
 
@fjr1300 thanks for everything and everyone else that helped in getting this straight on my screen. I really appreciate it with all sincerity and I will be studying up on the method today and tomorrow so I can be ready hopefully to try it Monday.
 
If I understand correct, we would see the Zone 2/3/Buy Zone 4 only if there is a bounce from that zone otherwise we would just see the green or red background. Am I correct?

This is what happened to my watchlist.
Original code
zQ8V4zH.jpg


Your code and all the Zone2, Zone3 and Zone 4 info gone.
E6OAISy.jpg


Like I said, this is just for my own preference, nothing to do with how jose uses his swingarm.
Feel free to use it, or use fishstick's code, works as jose intended.
 
@lowtrade Hi - would you care to share scripts (rsi, rvol, zscore, hma, zone1/2/3/4) that show up in your original watchlist. I have a standard version of it, with green and red boxes indicating value 1.0in green box & 0.0 in red box. your wl looks neat. Thanks
 
@fjr1300 Do you only want to enter a trade at the break of a swing arm? An example of what I am asking is if the market opened and had been running a bullish pattern since market close and the swing arm did not break until say noon, would you only look to enter a trade at noon or later but not before?

Also do you make sure to take profits into support levels or just scale out in case the swing arm continues?
Thanks for feedback from anyone.
 
@mansor

RSI(7)
Code:
plot RSI = rsi(7);
AssignBackgroundColor(if RSI > 60 then Color.DARK_GREEN else if RSI < 60 then Color.DARK_RED else Color.Dark_ORANGE);

RVOL
Code:
plot c = Volume(period = AggregationPeriod.DAY) / Average(volume(period = AggregationPeriod.DAY), 20);
c.SetDefaultColor(Color.BLACK);
AssignBackgroundColor(if c > 7 then Color.Dark_Green
                      else if c > 5 then Color.Green
                      else if c > 3 then Color.Orange
                      else if c > 2 then Color.Pink
                      else Color.red);
AddLabel(yes, AsText(c, NumberFormat.TWO_DECIMAL_PLACES) + "X", Color.Black);

HMA
Code:
script ConcavityDivergence {
#
# Hull Moving Average Concavity Divergence
#  or
# The Second Derivative of the Hull Moving Average
#
# Author: Seth Urion (Mahsume)
# Version: 2020-02-23 V3
# Watchlist Column 2020-03-06 V2
#
# This code is licensed (as applicable) under the GPL v3
#
# ----------------------

declare lower;

input price = HL2;

input HMA_length = 55;
input lookback = 2;

plot HMA = HullMovingAvg(length = HMA_length, price = price);

def delta = HMA[1] - HMA[lookback + 1];
def delta_per_bar = delta / lookback;

def next_bar = HMA[1] + delta_per_bar;

def concavity = if HMA > next_bar then 1 else -1;

plot zero = 0;
zero.setdefaultcolor(Color.LIGHT_GRAY);
zero.setpaintingstrategy(PaintingStrategy.DASHES);

plot divergence = HMA - next_bar;
divergence.setDefaultColor(Color.LIME);
divergence.SetLineweight(2);

plot cx_up = if divergence crosses above zero then 0 else double.nan;
cx_up.SetPaintingStrategy(PaintingStrategy.POINTS);
cx_up.SetDefaultColor(Color.LIGHT_GREEN);
cx_up.SetLineWeight(4);

plot cx_down = if divergence crosses below zero then 0 else double.nan;
cx_down.SetPaintingStrategy(PaintingStrategy.POINTS);
cx_down.SetDefaultColor(Color.RED);
cx_down.SetLineWeight(4);

plot good_momentum = 0.32 * highest(divergence, HMA_Length * 2);
good_momentum.SetPaintingStrategy(PaintingStrategy.LINE);
good_momentum.SetStyle(Curve.SHORT_DASH);
good_momentum.SetDefaultColor(Color.GREEN);

plot bad_momentum = 0.32 * lowest(divergence, HMA_Length * 2);
bad_momentum.SetPaintingStrategy(PaintingStrategy.LINE);
bad_momentum.SetStyle(Curve.SHORT_DASH);
bad_momentum.SetDefaultColor(Color.RED);


}
plot data = ConcavityDivergence().divergence;
def HMA = ConcavityDivergence().HMA;

data.AssignValueColor(if  data > data[1] then Color.BLACK else Color.WHITE);
AssignBackgroundColor(if data >= 0 then if HMA > HMA[1] then Color.GREEN else Color.DARK_GREEN else if HMA > HMA[1] then color.DARK_ORANGE else color.DARK_RED);

VWAP
Code:
plot vwap = vwap();
AssignBackgroundColor(if close > vwap then Color.DARK_GREEN else if close < vwap then Color.DARK_RED else Color.Dark_ORANGE);

zScore
Code:
declare lower;

input price = close;
input length = 20;
input ZavgLength = 20;

#Initialize values
def oneSD = stdev(price,length);
def avgClose = simpleMovingAvg(price,length);
def ofoneSD = oneSD*price[1];
def Zscorevalue = ((price-avgClose)/oneSD);
def avgZv = average(Zscorevalue,20);

#Compute and plot Z-Score
plot Zscore = ((price-avgClose)/oneSD);
Zscore.setPaintingStrategy(paintingStrategy.HISTOGRAM);
Zscore.setLineWeight(2);
Zscore.assignValueColor(if Zscore > 0 then color.green else color.red);

plot avgZscore = average(Zscorevalue,ZavgLength);
avgZscore.setPaintingStrategy(paintingStrategy.LINE);

#This is an optional plot that will display the momentum of the Z-Score average
#plot momZAvg = (avgZv-avgZv[5]);

#Plot zero line and extreme bands
plot zero = 0;
plot two = 2;
plot negtwo = -2;
zero.setDefaultColor(color.black);

SwingArm (Change the intravel for each)
Code:
# blackFLAG FTS SwingArms
# StudyName: blackFLAG_Futures_SwingArm_ATRTrail
# My preferred setting is 28 / 5 FOR ALL TIMEFRAMES
# Edited by: Jose Azcarate
# blackFLAG Futures Trading - FOR EDUCATIONAL PURPOSES ONLY
# TWITTER: @blackflagfuture

# SwingArm Watchlist by [USER=278]@fishstick1229[/USER]
# * Updated code below is to be used for custom watchlist column only **

#Updated text display by [USER=4199]@Fishbed[/USER]

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 HiLo = Min(high - low, 1.5 * Average(high - low, ATRPeriod));
def HRef = if low <= high[1]
    then high - close[1]
    else (high - close[1]) - 0.5 * (low - high[1]);
def LRef = if high >= low[1]
    then close[1] - low
    else (close[1] - low) - 0.5 * (low[1] - high);

def trueRange;
switch (trailType) {
case modified:
    trueRange = Max(HiLo, Max(HRef, LRef));
case unmodified:
    trueRange = TrueRange(high, close, low);
}
def loss = ATRFactor * MovingAverage(averageType, trueRange, ATRPeriod);

def state = {default init, long, short};
def trail;
switch (state[1]) {
case init:
    if (!IsNaN(loss)) {
        switch (firstTrade) {
        case long:
            state = state.long;
            trail = close - loss;
        case short:
            state = state.short;
            trail = close + loss;
    }
    } else {
        state = state.init;
        trail = Double.NaN;
    }
case long:
    if (close > trail[1]) {
        state = state.long;
        trail = Max(trail[1], close - loss);
    } else {
        state = state.short;
        trail = close + loss;
    }
case short:
    if (close < trail[1]) {
        state = state.short;
        trail = Min(trail[1], close + loss);
    } else {
        state = state.long;
        trail = close - loss;
    }
}

def BuySignal = Crosses(state == state.long, 0, CrossingDirection.ABOVE);
def SellSignal = Crosses(state == state.short, 0, CrossingDirection.ABOVE);

def ex = if BuySignal then high else if SellSignal then low else if state == state.long then Max(ex[1], high) else if state == state.short then Min(ex[1], low) else ex[1];

def TrailingStop = trail;
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;

def bullAboveZone = state == state.long and close > Fib1;
def bullZone2 = state == state.long and close <= Fib1 and close > Fib2;
def bullZone3 = state == state.long and close <= Fib2 and close > Fib3;
def bullZone4 = state == state.long and close <= Fib3 and close > TrailingStop;

def bearZone2 = state == state.short and close >= Fib1 and close < Fib2;
def bearZone3 = state == state.short and close >= Fib2 and close < Fib3;
def bearZone4 = state == state.short and close >= Fib3 and close < TrailingStop;

# watchlist
assignBackgroundColor(if state == state.long then Color.green else Color.red);
AddLabel(yes, if bullZone2 then "ZONE2"  else if bullZone3 then "ZONE3"  else if bullZone4 then "BUY ZONE4" else if bearZone2 then " ZONE 2"  else if bearZone3 then " ZONE3"  else if bearZone4 then "SELL ZONE4" else " ",  if bullZone4 or bearZone4 then color.BLUE else Color.BLACK);
 
Could we add an aggregation period to the blackFLAG code that allows us to choose a higher timeframe while looking at the lower time
input agg = AggregationPeriod.DAY;
example:

FxPiIdc.jpg
 
If I understand correct, we would see the Zone 2/3/Buy Zone 4 only if there is a bounce from that zone otherwise we would just see the green or red background. Am I correct?
This is what happened to my watchlist.
Original code
Your code and all the Zone2, Zone3 and Zone 4 info gone.

Incorrect. My edit has a requirement that there must be a bounce.
For e.g. Fishstick's version is "price is within the zones".
Mine is "price is within the zones, but it must show a price rejection off the support/resistance".

Green or red background shows whether its a bullish or bearish swingarm, nothing to do with bounce.
If there's only background color and no text, it means price is not within any of the zones.

CuOprsY.png

QKdv3ls.png
 
Status
Not open for further replies.

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
250 Online
Create Post

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