NexusFi: Find Your Edge


Home Menu

 





Displaying squeeze in multiple timeframes


Discussion in ThinkOrSwim

Updated
    1. trending_up 1,595 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 2 attachments




 
Search this Thread

Displaying squeeze in multiple timeframes

  #1 (permalink)
Indigow
Dallas, TX
 
Posts: 1 since Mar 2019
Thanks Given: 0
Thanks Received: 0

My tos study is supposed to show status of squeeze on multiple time frames in labels.
It suddenly stopped displaying for time-frames in min and hours. Monthly, Weekly, and Daily are displaying correctly.
If you could help, I really appreciate it. Thank you.




input period = aggregationPeriod.DAY;
DefineGLobalColor("In Squeeze", color.red);
DefineGlobalCOlor("Not In Squeeze", color.dark_green);

script SymbolSqueeze {

input aP = aggregationPeriod.DAY;
def nBB = 2.0;
def Length = 20.0;
def factor = 1.5;
def price1 = close( period = aP);
def UpperBand = MovingAverage(AverageType.Simple, data = price1, length = length) + nBB * stdev(data = price1, length = length);
def shift = factor * MovingAverage(AverageType.Simple, TrueRange(high( period=aP), close( period=aP), low( period=aP)), length);
def average = MovingAverage(AverageType.Simple, price1, length);
def Avg = average;
def Upper_Band = MovingAverage(AverageType.Simple, price1, length)+ shift;
plot BolKelDelta = UpperBand-Upper_Band;
}

def currentPeriod = getAggregationPeriod();
def s1;

if period >= currentPeriod {
s1 = SymbolSqueeze( aP = period);
} else {
s1 = double.nan;
}

AddLabel(!isNan(s1),if period == aggregationPeriod.MONTH then "M"
else
if period == aggregationPeriod.WEEK then "W"
else
if period == aggregationPeriod.FOUR_DAYS then "4D"
else
if period == aggregationPeriod.THREE_DAYS then "3D"
else
if period == aggregationPeriod.TWO_DAYS then "2D"
else
if period == aggregationPeriod.DAY then "D"
else
if period == aggregationPeriod.FOUR_HOURS then "4H"
else
if period == aggregationPeriod.TWO_HOURS then "2H"
else
if period == aggregationPeriod.HOUR then "60m"
else
if period == aggregationPeriod.THIRTY_MIN then "30m"
else
if period == aggregationPeriod.TWENTY_MIN then "20m"
else
if period == aggregationPeriod.FIFTEEN_MIN then "15m"
else
if period == aggregationPeriod.TEN_MIN then "10m"
else
if period == aggregationPeriod.FIVE_MIN then "5m"
else
if period == aggregationPeriod.FOUR_MIN then "4m"
else
if period == aggregationPeriod.THREE_MIN then "3m"
else
if period == aggregationPeriod.TWO_MIN then "2m"
else
if period == aggregationPeriod.MIN then "1m"
else "", if s1 > 0 then GlobalColor("Not In Squeeze") else GlobalColor("In Squeeze"));

Reply With Quote




Last Updated on April 1, 2019


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts