Search
  • Onward Strategies

Think Scripts for the Bulls & Bears

Updated: Aug 5

RSI 2 Think script

plot Data = close;


input length = 2;

input over_Bought = 90;

input over_Sold = 10;

input price = close;

input averageType = AverageType.WILDERS;


def NetChgAvg = MovingAverage(averageType, price - price[1], length);

def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);

def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;


plot RSI = 50 * (ChgRatio + 1);


AddLabel(yes, rsi, if rsi >= over_Bought or rsi <= over_Sold then Color.RED else Color.BLACK);


Previous OPEN/HIGH/CLOSE Script

AggregationPeriod.DAY;

input length = 1;

input displace = -1;

input showOnlyLastPeriod = yes;

plot PrevDayHigh;

plot PrevDayLow;

plot PrevDayClose;


if showOnlyLastPeriod and !IsNaN(high(period = aggregationPeriod)[-1]) and !IsNaN(low(period = aggregationPeriod)[-1]) and !IsNaN(close(period = aggregationPeriod)[-1])

{

PrevDayHigh = Double.NaN;

PrevDayLow = Double.NaN;

PrevDayClose = Double.NaN;

}

else

{

PrevDayHigh = Highest(high(period = aggregationPeriod)[-displace], length);

PrevDayLow = Highest(low(period = aggregationPeriod)[-displace], length);

PrevDayClose = Highest(close(period = aggregationPeriod)[-displace], length);

}

PrevDayHigh.SetDefaultColor(CreateColor(0,255,255));

PrevDayHigh.SetPaintingStrategy(PaintingStrategy.LINE);


PrevDayLow.SetDefaultColor(CreateColor(0,255,255));

PrevDayLow.SetPaintingStrategy(PaintingStrategy.LINE);


NETCHANGE Intraday Script

#HINT: chart labels for DAILY net and percent change, and DAILY volume regardless of whether on daily or intra-day chart. Also, volume is color coded to denote whether today's daily volume is above or below average daily volume.


input Volume_Avg_periods = 50;


def aggregationPeriod = AggregationPeriod.DAY;

def prevPrice = close(period = aggregationPeriod)[1];

def price = close(period = aggregationPeriod);

def priceChg = price - prevprice;

def PctChg = (Price - prevprice) / prevPrice;


addlabel(yes, "DailyNetChg: " + priceChg + " Daily%Chg: " + aspercent(PctChg),if priceChg > 0 then (createColor(51,204,0)) else if priceChg < 0 then color.RED else color.LIGHT_GRAY);



def vol = volume(period = aggregationPeriod);

def volAvg = average(volume(period = aggregationPeriod), Volume_Avg_periods);

addlabel(yes, "DailyVolume: " + vol,if vol > volAvg then (createColor(51, 204, 0)) else if vol < volAvg then color.RED else color.LIGHT_GRAY);








26 views
Onward-Strat_Logo-Redo_1_W.png
SIGN UP AND
STAY UPDATED!
  • Instagram
  • Twitter
  • YouTube
  • LinkedIn

Get FREE daily market updates.

© 2020 by Onward Strategies