need help plotting these arrows ias a higher agg in a lower time frame chart https://tos.mx/nRGF2qR
wont allow me to
#StudyName: RSI_Laguerre_Lines_wTargets
#Version/Date: v1 5/30/17
#TOS.mx Link:
#Type: [Study]
#Description: RSI in Laguerre Time MTF plotted on Upper chart
#Author: jcseattle
#Copyright: Copyright jcseattle/amalia 2016. All rights reserved.
#Copyleft: This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. See <http://www.gnu.org/licenses/>
#Requested By: ""
#History: Ver Date Auth Change
#First draft v1 5/30/17 jcseattle - No changes
# Notes :Based off original script in
# RSI in Laguerre Time MTF Option_v3
# Mobius
# V02.07.2014
# translation of J Elher's code
# Annotation : ""
# Trading Notes : ""
# Start Code
input MTF = no;
input timeframe = AggregationPeriod.FIFTEEN_MIN ;
def na = Double.NaN;
script R {
input gamma = .2;
input usecandletype = {candle_hybrid, default candle};
input usehigheraggperiod = {default "Current", "Higher"};
input outputformat = {default Rounded, "Not Rounded"};
;#Hint outputformat: 'Not Rounded' is used for notes, bonds (eg: 109'110), forex, etc type format.
input atrlength = 21;
input agg = AggregationPeriod.ten_MIN;
input overbought = .8;
input oversold = .2;
def o;
def h;
def l;
def c;
def CU1;
def CU2;
def CU;
def CD1;
def CD2;
def CD;
def L0;
def L1;
def L2;
def L3;
plot RSI;
plot OS;
plot OB;
def error = usehigheraggperiod == usehigheraggperiod."Higher" and GetAggregationPeriod() > agg;
switch (usehigheraggperiod) {
case Current:
if usecandletype == usecandletype.candle_hybrid {
o = (open + close[1]) / 2;
h = Max(high, close[1]);
l = Min(low, close[1]);
c = (o + h + l + close) / 4;
} else {
o = open;
h = high;
l = low;
c = close;
}
case Higher:
if error {
o = Double.NaN;
h = Double.NaN;
l = Double.NaN;
c = Double.NaN;
} else {
if usecandletype == usecandletype.candle_hybrid {
o = (open(period = agg) + close(period = agg)[1]) / 2;
h = Max(high(period = agg) , close(period = agg)[1]);
l = Min(low(period = agg) , close(period = agg)[1]);
c = ((open(period = agg) + close(period = agg)[1]) / 2
+ Max(high(period = agg), close(period = agg)[1])
+ Min(low(period = agg) , close(period = agg)[1])
+ close(period = agg)) / 4;
} else {
o = open(period = agg);
h = high(period = agg);
l = low(period = agg);
c = close(period = agg);
}
}
}
L0 = (1 – gamma) * c + gamma * L0[1];
L1 = -gamma * L0 + L0[1] + gamma * L1[1];
L2 = -gamma * L1 + L1[1] + gamma * L2[1];
L3 = -gamma * L2 + L2[1] + gamma * L3[1];
if L0 >= L1
then {
CU1 = L0 - L1;
CD1 = 0;
} else {
CD1 = L1 - L0;
CU1 = 0;
}
if L1 >= L2
then {
CU2 = CU1 + L1 - L2;
CD2 = CD1;
} else {
CD2 = CD1 + L2 - L1;
CU2 = CU1;
}
if L2 >= L3
then {
CU = CU2 + L2 - L3;
CD = CD2;
} else {
CU = CU2;
CD = CD2 + L3 - L2;
}
RSI = if IsNaN(close) then Double.NaN
else if CU + CD <> 0
then CU / (CU + CD) else 0;
OS = if IsNaN(close)
then Double.NaN else oversold;
OB = if IsNaN(close)
then Double.NaN
else overbought;
def mid = if IsNaN(close) then Double.NaN else 0.5;
def lineh = 1.2;
def linel = -.2;
# End Code Basic RSI Laguerre - Author: Mobius
}
def Up = if R() crosses above R().OS then 1 else 0;
def u = if R() crosses above R().OB then 1 else 0;
def Dn = if R() crosses below R().OB then 1 else 0;
def d = if R() crosses below R().OS then 1 else 0;
def Green = if Up
#or u
then low else 0;
def Red = if Dn
#or d
then high else 0;
def showLines = 1;
def trendchange = if Green then low else if Red then high else trendchange[1];
def PL = if !IsNaN(trendchange)
then trendchange
else PL[1];
plot pivotLine = if PL > 0
then PL
else Double.NaN;
pivotLine.SetPaintingStrategy(PaintingStrategy.LINE);
pivotLine.SetHiding(!showLines);
input showArrows = yes;
plot ArrUp = if showArrows and Green then low else 0;
ArrUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
ArrUp.SetDefaultColor(Color.GREEN);
plot ArrDn = if showArrows and Red then high else 0;
ArrDn.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
ArrDn.SetDefaultColor(Color.RED);
pivotLine.AssignValueColor(if R() < R().OB then Color.RED else if R() > R().OS then Color.GREEN else Color.BLACK);
input ShowLabels = yes;
#Multipliers for ATR targets
input firsttgt = 1.618;
input secondtgt = 3.447;
input thirdtgt = 4.25;
input ATRLength = 8;#default is 14
def agg = if GetAggregationPeriod() > AggregationPeriod.FIFTEEN_MIN then GetAggregationPeriod() else AggregationPeriod.FIFTEEN_MIN;#You can edit this to just (GetAggregationPeriod())
def ATR = Average(TrueRange(High(period = agg),Close(period = agg),Low(period = agg)),ATRLength);
#addlabel(ShowLabels, "ATR = " + Round((ATR) / TickSize(),0)*TickSize(), Color.GRAY);
input showStrategy = yes;
def co = if PL[1] and R()[1] > R().OS[1] then 1 else 0;
def firstlongtarget = if co then (PivotLine + ATR*firsttgt) else 0;
def secondlongtarget = if co then (PivotLine + ATR*secondtgt) else 0;
def thirdlongtarget = if co then (PivotLine + ATR*thirdtgt) else 0;
def sto = if PL and R() < R().OB then 1 else 0;
def firstshorttarget = if sto then (PivotLine - ATR*firsttgt) else 0;
def secondshorttarget = if sto then (PivotLine - ATR*secondtgt) else 0;
def thirdshorttarget = if sto then (PivotLine - ATR*thirdtgt) else 0;
# Internal Script Reference
# Author: Mobius
def LineLimit = 30;
def Detrend = 0;
def OnExpansion = yes;
def data = firstlongtarget;
def bar = 0;
def ShowAllPlots = 0;
def ThisBar = HighestAll(bar) - Detrend;
def cLine = if ShowAllPlots == 0
then if bar == ThisBar
then data
else Double.NaN
else data;
def cond1 = CompoundValue(1, if IsNaN(data)
then cond1[1]
else data, data);
def P = if ShowAllPlots == 0
then if ThisBar - LineLimit <= bar
then HighestAll(cLine)
else Double.NaN
else cLine;
plot firstLTarget = if OnExpansion and
IsNaN(data[-1])
then cond1
else Double.NaN;
firstLTarget.SetDefaultColor(Color.GREEN);
#addlabel(ShowLabels, if R() > R().OS then "Long Target = " + Round((firstLTarget) / TickSize(),0)*TickSize() else "", Color.GREEN);
#AddChartBubble(IsNaN(close) and !isNaN(close[1]),
## firstLTarget,
# "First Target = " + Round((firstLTarget) / TickSize(),0)*TickSize(),
# Color.GREEN,
# yes);
def difflongtarget = if close < firstlongtarget then (firstlongtarget - close) else (close - firstlongtarget);
#addLabel(ShowLabels, if R() > R().OS then "Diff 1st L tgt = " + (Round((difflongtarget) / TickSize(),0)*TickSize()) else "", Color.LIGHT_GREEN);
def LineLimit3 = 30;
def Detrend3 = 0;
def OnExpansion3 = yes;
def data3 = secondlongtarget;
def bar3 = 0;
def ShowAllPlots3 = 0;
def ThisBar3 = HighestAll(bar) - Detrend;
def cLine3 = if ShowAllPlots3 == 0
then if bar3 == ThisBar3
then data3
else Double.NaN
else data3;
def cond3 = CompoundValue(1, if IsNaN(data3)
then cond3[1]
else data3, data3);
def P3 = if ShowAllPlots3 == 0
then if ThisBar3 - LineLimit3 <= bar3
then HighestAll(cLine3)
else Double.NaN
else cLine3;
plot secondLTarget = if OnExpansion3 and
IsNaN(data3[-1])
then cond3
else Double.NaN;
secondLTarget.SetDefaultColor(Color.GREEN);
#addlabel(ShowLabels, if R() > R().OS then "2nd Long Target = " + Round((secondLTarget) / TickSize(),0)*TickSize() else "", Color.GREEN);
#AddChartBubble(IsNaN(close) and !isNaN(close[1]),
# secondLTarget,
# "2nd Long Target = " + Round((secondLTarget) / TickSize(),0)*TickSize(),
# Color.GREEN,
# yes);
def difflongtarget2 = if close < secondlongtarget then (secondlongtarget - close) else (close - secondlongtarget);
#addLabel(ShowLabels, if R() > R().OS then "Diff 2nd L tgt = " + Round((difflongtarget2) / TickSize(),0)*TickSize() else "", Color.LIGHT_GREEN);
def LineLimit9 = 30;
def Detrend9 = 0;
def OnExpansion9 = yes;
def data9 = thirdlongtarget;
def bar9 = 0;
def ShowAllPlots9 = 0;
def ThisBar9 = HighestAll(bar9) - Detrend9;
def cLine9 = if ShowAllPlots9 == 0
then if bar9 == ThisBar9
then data9
else Double.NaN
else data9;
def cond9 = CompoundValue(1, if IsNaN(data9)
then cond9[1]
else data9, data9);
def P9 = if ShowAllPlots9 == 0
then if ThisBar9 - LineLimit9 <= bar9
then HighestAll(cLine9)
else Double.NaN
else cLine9;
plot thirdLTarget = if OnExpansion9 and
IsNaN(data9[-1])
then cond9
else Double.NaN;
thirdLTarget.SetDefaultColor(Color.GREEN);
#addlabel(ShowLabels, if R() > R().OS then "3rd Long Target = " + Round((thirdLTarget) / TickSize(),0)*TickSize() else "", Color.GREEN);
#AddChartBubble(IsNaN(close) and !isNaN(close[1]),
# thirdLTarget,
# "3rd Long Target = " + Round((thirdLTarget) / TickSize(),0)*TickSize(),
# Color.GREEN,
# yes);
def difflongtarget9 = if close < thirdlongtarget then (thirdlongtarget - close) else (close - thirdlongtarget);
#addLabel(ShowLabels, if R() > R().OS then "Diff 3rd L tgt = " + Round((difflongtarget9) / TickSize(),0)*TickSize() else "", Color.LIGHT_GREEN);
def LineLimit2 = 30;
def Detrend2 = 0;
def OnExpansion2 = yes;
def data2 = firstshorttarget;
def bar2 = 0;
def ShowAllPlots2 = 0;
def ThisBar2 = HighestAll(bar2) - Detrend2;
def cLine2 = if ShowAllPlots2 == 0
then if bar2 == ThisBar2
then data2
else Double.NaN
else data2;
def cond2 = CompoundValue(1, if IsNaN(data2)
then cond2[1]
else data2, data2);
def P2 = if ShowAllPlots2 == 0
then if ThisBar2 - LineLimit2 <= bar2
then HighestAll(cLine2)
else Double.NaN
else cLine2;
plot firstSTarget = if OnExpansion2 and
IsNaN(data2[-1])
then cond2
else Double.NaN;
firstSTarget.SetDefaultColor(Color.RED);
#addlabel(ShowLabels, if R() < R().OB then "1st Short Target = " + Round((firstSTarget) / TickSize(),0)*TickSize() else "", Color.RED);
#AddChartBubble(IsNaN(close) and !IsNaN(Close[1]),
# firstSTarget,
# "Short Target = " + Round((firstSTarget) / TickSize(),0)*TickSize(),
# Color.RED,
# no);
def diffshorttarget = if close < data2 then (data2 - close) else (close - data2);
#addLabel(ShowLabels, if R() < R().OB then "Diff 1st S tgt = " + Round((diffshorttarget) / TickSize(),0)*TickSize() else "", Color.LIGHT_RED);
#
def LineLimit4 = 30;
def Detrend4 = 0;
def OnExpansion4 = yes;
def data4 = secondshorttarget;
def bar4 = 0;
def ShowAllPlots4 = 0;
def ThisBar4 = HighestAll(bar4) - Detrend4;
def cLine4 = if ShowAllPlots4 == 0
then if bar4 == ThisBar4
then data4
else Double.NaN
else data4;
def cond4 = CompoundValue(1, if IsNaN(data4)
then cond4[1]
else data4, data4);
def P4 = if ShowAllPlots4 == 0
then if ThisBar4 - LineLimit4 <= bar4
then HighestAll(cLine4)
else Double.NaN
else cLine4;
plot secondSTarget = if OnExpansion4 and
IsNaN(data4[-1])
then cond4 #
else Double.NaN;
secondSTarget.SetDefaultColor(Color.RED);
#Round((close + (atr)) / TickSize(), 0) * TickSize()
#addlabel(ShowLabels, if R() < R().OB then "2nd Short Target = " + Round((secondSTarget) / TickSize(),0)*TickSize() else "", Color.RED);
#AddChartBubble(IsNaN(close) and !IsNaN(Close[1]),
# secondSTarget,
## "2nd Short Target = " + Round((secondSTarget) / TickSize(),0)*TickSize(),
# Color.RED,
# no);
def diffshorttgt2 = if close < secondshorttarget then (secondshorttarget - close) else (close - secondshorttarget);
#addLabel(ShowLabels, if R() < R().OB then "Diff 2nd S tgt = " + Round((diffshorttgt2) / TickSize(),0)*TickSize() else "", Color.LIGHT_RED);
def LineLimit8 = 30;
def Detrend8 = 0;
def OnExpansion8 = yes;
def data8 = thirdshorttarget;
def bar8 = 0;
def ShowAllPlots8 = 0;
def ThisBar8 = HighestAll(bar8) - Detrend8;
def cLine8 = if ShowAllPlots8 == 0
then if bar8 == ThisBar8
then data8
else Double.NaN
else data8;
def cond8 = CompoundValue(1, if IsNaN(data8)
then cond8[1]
else data8, data8);
def P8 = if ShowAllPlots8 == 0
then if ThisBar8 - LineLimit8 <= bar8
then HighestAll(cLine8)
else Double.NaN
else cLine8;
plot thirdSTarget = if OnExpansion8 and
IsNaN(data8[-1])
then cond8
else Double.NaN;
thirdSTarget.SetDefaultColor(Color.RED);
#addlabel(ShowLabels, if R() < R().OB then "3rd Short Target = " + Round((thirdSTarget) / TickSize(),0)*TickSize() else "", Color.RED);
#AddChartBubble(IsNaN(close) and !isNaN(close[1]),
# thirdSTarget,
# "3rd Short Target = " + Round((thirdSTarget) / TickSize(),0)*TickSize(),
# Color.RED,
# no);
def diffshorttarget3 = if close < thirdshorttarget then (thirdshorttarget - close) else (close - thirdshorttarget);
#addLabel(ShowLabels, if R() < R().OB then "Diff 3rd S tgt = " + Round((diffshorttarget3) / TickSize(),0)*TickSize() else "", Color.LIGHT_RED);
input MTF = no;
input timeframe = AggregationPeriod.FIFTEEN_MIN ;
input MTF = yes;
input timeframe = AggregationPeriod.FIVE_MIN ;
i copied the code from the studies and it will not allow me to paste it in to send in this forum
I highlighted the script , copied it and when i tried to paste it in here nada, if it is such a big deal to get help as a vip member in here i will go elsewhere, not the end of the world
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
D | need help removing extra arrows | Questions | 1 | |
![]() |
Need help plotting arrows | Questions | 1 | |
R | Need help adding arrows to price trend | Questions | 2 | |
I | Need help with ATH script | Questions | 1 | |
J | I need help scripting color Zero Line above/below candle | Questions | 4 |
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.