Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

Fun with ThinkScript

Posted by robert 
Re: help modifying this script
May 31, 2023 04:51PM
RichieRick Wrote:
-------------------------------------------------------
> And again, right here.
>
> Just a quick note.
> For you guys looking for help with your scripts.
> You'd probably be better served to surf over to
> usethinkscript.com. There are only a few folks
> here lurking the board that dabble in script
> writing. Most of the real thinkscript folks are
> over at usethinkscript.com. Post your questions
> there about scripts and I'm sure you'll get lots
> of responses.
>
> R


Thanks
Re: help modifying this script
August 07, 2023 10:03AM
Thanks , Yes I did , I am VIP member there , I do not have a solution yet and that script it's not private , other guys posted script from here there , but , thanks anyway thumbs upthumbs upthumbs up
Re: Fun with ThinkScript
September 17, 2023 01:04PM
Tanman, I'm over the moon about finding your net volume code and for the very same reasons you cited. I don't understand how everyone accepts volume being aggregated from positive and negative volume so ham-handedly.

Quick question: you color code what I take to be net negative volume in red and position it positively in the volume panel. Does that reflect a constraint in TOS regarding negative volume? I was hoping to see net negative volume display below the zero line.



Edited 1 time(s). Last edit at 09/17/2023 01:10PM by ms3333.
Fair value gap thinkscript help
April 04, 2024 04:03PM
Can someone modify a fair value gap indicator to change the color of the candle (paint bar) on the candle that creates the fair value gap instead of having lines and clouds all over the screen? The code I am using is posted below.

Also, add it to a watchlist for multiple time frames so I can spot it easily across multiple assets if one forms? Thank you

# FVG Fair Value Gaps Bearish & Bullish Levels
# @TradeForOpp 5/6/2022
#Mod by Sam4COK @ Samer800 08/2022

input ShowLines = yes;
input ShowCloud = yes;
input ChartTime = no;
input threshold = 0.01;
input aggregation = AggregationPeriod.FIFTEEN_MIN;

def na = Double.NaN;
script nz {
input data = 1;
input repl = 0;
def ret_val = if IsNaN(data) then repl else data;
plot return = ret_val;
}
#//IMBALANCE
#//Data
def L1;
def H3;
def H1;
def L3;
if ChartTime
then {
L1 = low;
H3 = high[2];
H1 = high;
L3 = low[2];
} else {

L1 = low(period = aggregation);
H3 = high(period = aggregation)[2];
H1 = high(period = aggregation);
L3 = low(period = aggregation)[2];
}

def fvgBullPctg = if AbsValue((H3 - L1) / H3) > threshold / 100 then 1 else 0;
def FVGUp = if H3 < L1 then 1 else 0;
def plotFVGU = if FVGUp and fvgBullPctg then H3 else na;
def plotFVGUL = if FVGUp and fvgBullPctg then L1 else na;
def plotFVGU2 = plotFVGU[-1];
def plotFVGUL2 = plotFVGUL[-1];
def midFVGUp = (plotFVGU2 + plotFVGUL2) / 2;

def fvgBearPctg = if AbsValue((H1 - L3) / L3) > threshold / 100 then 1 else 0;
def FVGDown = if L3 > H1 then 1 else 0;
def plotFVGD = if FVGDown and fvgBearPctg then L3 else na;
def plotFVGH = if FVGDown and fvgBearPctg then H1 else na;
def plotFVGD2 = plotFVGD[-1];
def plotFVGH2 = plotFVGH[-1];
def midFVGDown = (plotFVGD2 + plotFVGH2) / 2;

#--------------------------------------------------------------
def LastTF = CompoundValue(1, if IsNaN(plotFVGU2) then LastTF[1] else plotFVGU2, plotFVGU2);
def LastBF = CompoundValue(1, if IsNaN(plotFVGUL2) then LastBF[1] else plotFVGUL2, plotFVGUL2);
def LastMidUP = CompoundValue(1, if IsNaN(midFVGUp) then LastMidUP[1] else midFVGUp, midFVGUp);
#--------------------------------------------------------------

plot HLine = LastTF ;
plot LLine = LastBF ;
plot MLine = LastMidUP ;
HLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HLine.SetDefaultColor(CreateColor(49, 121, 245));
HLine.SetHiding(!ShowLines);
LLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LLine.SetDefaultColor(CreateColor(49, 121, 245));
LLine.SetHiding(!ShowLines);
MLine.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MLine.SetDefaultColor(CreateColor(144, 191, 249));

AddCloud(if ShowCloud and (LLine == LLine[1] or LLine == LLine[-1]) then LLine else na , HLine, CreateColor(144, 191, 249));

#--------------------------------------------------------------
def LastTFL = CompoundValue(1, if IsNaN(plotFVGD2) then LastTFL[1] else plotFVGD2, plotFVGD2);
def LastBFL = CompoundValue(1, if IsNaN(plotFVGH2) then LastBFL[1] else plotFVGH2, plotFVGH2);
def LastMidDN = CompoundValue(1, if IsNaN(midFVGDown) then LastMidDN[1] else midFVGDown, midFVGDown);
#--------------------------------------------------------------

plot HLineL = LastTFL ;
plot LLineL = LastBFL ;
plot MLineL = LastMidDN;
HLineL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
HLineL.SetDefaultColor(CreateColor(194, 24, 91));
HLineL.SetHiding(!ShowLines);
LLineL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LLineL.SetDefaultColor(CreateColor(194, 24, 91));
LLineL.SetHiding(!ShowLines);
MLineL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
MLineL.SetDefaultColor(CreateColor(244, 143, 177));

AddCloud(if ShowCloud and (HLineL == HLineL[1] or HLineL == HLineL[-1]) then HLineL else na , LLineL, CreateColor(244, 143, 177));


##########################
Re: Fair value gap thinkscript help
April 04, 2024 04:04PM
Sorry, only registered users may post in this forum.

Click here to login