Inhibit Initial Plot before Conditions defined

atcsam

New member
Trying to update the Candle Pattern presented by JT_479 (really like this for Price Action)....
Trying to eliminate a plot (extended lines) before the condition is met. If you run a fit studies, there is always a bunch of garbage on the zero line until a condition it met.

I've ran out of ideas, Ignorance meter is pegged, and deferring to the Wizards.... This should be coding 101.

Here is a snippet of code I'm working with, I figure this out I can fix the rest.
This code will plot a Bull support on a Bullish Engulfing pattern.
Problem is it plots at Zero Line before a Bull Support is defined

EQPiw8t.jpg


Code:
#----------------------------------------------------------
#Bullish Engulfing - A Bottom Reversal. The bullish candle wraps around the entire body of the previous candle in a downtrend. Lowest low of the two sessions is Support.
#----------------------------------------------------------
#def Supportcount = 0;
def IsUp = close > open;
def IsDown = close < open;
def BullEngulf =
IsDescending(close, 3)[2] and
IsDown[1] and
IsUp[0] and
open[1] < close[0] and
close[1] >= open[0];
def barNumber = BarNumber();
plot BullSupport = if BullEngulf and low > low [1] then low[1] else if BullEngulf and low <= low[1] then low else Double.NaN;
def Supportcount = if (BullSupport) then 1 else 0;
BullSupport.SetPaintingStrategy(PaintingStrategy.DASHES);
BullSupport.SetDefaultColor(Color.DARK_ORANGE);
BullSupport.SetLineWeight(2);
def Bullext = if IsNaN(BullSupport)then Bullext[1] else BullSupport;
#Problem Child inhibit plot before BullSuppot defined
plot Bullextline =  Bullext;
Bullextline.SetPaintingStrategy(PaintingStrategy.DASHES);
Bullextline.SetDefaultColor(Color.DARK_ORANGE);

#----------------------------------------------------------------------------------------------
#----------------------------------------

AssignPriceColor(if  BullEngulf then Color.YELLOW else Color.CURRENT);
 
Last edited:
Solution
Trying to update the Candle Pattern presented by JT_479 (really like this for Price Action)....
Trying to eliminate a plot (extended lines) before the condition is met. If you run a fit studies, there is always a bunch of garbage on the zero line until a condition it met.

I've ran out of ideas, Ignorance meter is pegged, and deferring to the Wizards.... This should be coding 101.

Here is a snippet of code I'm working with, I figure this out I can fix the rest.
This code will plot a Bull support on a Bullish Engulfing pattern.
Problem is it plots at Zero Line before a Bull Support is defined

EQPiw8t.jpg


Code:
#----------------------------------------------------------
#Bullish Engulfing - A Bottom Reversal. The bullish candle...
Trying to update the Candle Pattern presented by JT_479 (really like this for Price Action)....
Trying to eliminate a plot (extended lines) before the condition is met. If you run a fit studies, there is always a bunch of garbage on the zero line until a condition it met.

I've ran out of ideas, Ignorance meter is pegged, and deferring to the Wizards.... This should be coding 101.

Here is a snippet of code I'm working with, I figure this out I can fix the rest.
This code will plot a Bull support on a Bullish Engulfing pattern.
Problem is it plots at Zero Line before a Bull Support is defined

EQPiw8t.jpg


Code:
#----------------------------------------------------------
#Bullish Engulfing - A Bottom Reversal. The bullish candle wraps around the entire body of the previous candle in a downtrend. Lowest low of the two sessions is Support.
#----------------------------------------------------------
#def Supportcount = 0;
def IsUp = close > open;
def IsDown = close < open;
def BullEngulf =
IsDescending(close, 3)[2] and
IsDown[1] and
IsUp[0] and
open[1] < close[0] and
close[1] >= open[0];
def barNumber = BarNumber();
plot BullSupport = if BullEngulf and low > low [1] then low[1] else if BullEngulf and low <= low[1] then low else Double.NaN;
def Supportcount = if (BullSupport) then 1 else 0;
BullSupport.SetPaintingStrategy(PaintingStrategy.DASHES);
BullSupport.SetDefaultColor(Color.DARK_ORANGE);
BullSupport.SetLineWeight(2);
def Bullext = if IsNaN(BullSupport)then Bullext[1] else BullSupport;
#Problem Child inhibit plot before BullSuppot defined
plot Bullextline =  Bullext;
Bullextline.SetPaintingStrategy(PaintingStrategy.DASHES);
Bullextline.SetDefaultColor(Color.DARK_ORANGE);

#----------------------------------------------------------------------------------------------
#----------------------------------------

AssignPriceColor(if  BullEngulf then Color.YELLOW else Color.CURRENT);

Here is one way

The image in the upper panel shows the code below's plot without a zero line. The lower panel is your code to show that the plots are the same as in the upper panel.
Screenshot-2022-11-05-171333.png
Ruby:
#----------------------------------------------------------
#Bullish Engulfing - A Bottom Reversal. The bullish candle wraps around the entire body of the previous candle in a downtrend. Lowest low of the two sessions is Support.
#----------------------------------------------------------
#def Supportcount = 0;
def IsUp   = close > open;
def IsDown = close < open;
def BullEngulf =
IsDescending(close, 3)[2] and
IsDown[1] and
IsUp[0] and
open[1] < close[0] and
close[1] >= open[0];

def barNumber = BarNumber();

def BullengulfSupport = if BullEngulf and low > low [1]
then low[1]
else if (BullEngulf) and low <= low[1]
then low 
else BullengulfSupport[1];

plot bullsupport = if BullengulfSupport == 0 then Double.NaN else BullengulfSupport;
def Supportcount = if (bullsupport) then 1 else 0;
bullsupport.SetPaintingStrategy(PaintingStrategy.DASHES);
bullsupport.SetDefaultColor(Color.DARK_ORANGE);
bullsupport.SetLineWeight(2);

def Bullext = if IsNaN(close)
then Bullext[1]
else bullsupport;
#Problem Child inhibit plot before BullSuppot defined
plot Bullextline =  Bullext;
Bullextline.SetPaintingStrategy(PaintingStrategy.DASHES);
Bullextline.SetDefaultColor(Color.DARK_ORANGE);

#----------------------------------------------------------------------------------------------
#----------------------------------------

AssignPriceColor(if  BullEngulf then Color.YELLOW else Color.CURRENT);
 
Solution

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

Thanks, so it's the "BullengulfSupport" test and IsNan(close) that I needed....
I presume this will also stop the repainting, (which I kind of like), might use a bubble or something to flash new support/ resistance levels in the making...

Now to fix the rest of the script, will post the modifications once I get it behaving.

Thanks again..
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
428 Online
Create Post

Similar threads

Similar threads

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