Help with Darvas(?) Pinescript to TOS Scan or Indicator

Euxkan

New member
Hello to the ones with many wrinkles,
I have used a foreign charting software with a few scans set up for daily use but I no longer use the software.
TOS already had built-in scan conditions equivalent to what I have used except the one below.
I am guessing that it is part of Darvas and coded with Pinescript(?).

Can anyone with skills able to convert it to TOS scan or an indicator?

###Original###
UPPERBAND
P=15;
LL=LOWEST(L,P);
HH=HIGHEST(H,P);
NH=VALUEWHEN(1,H>HH(1),H);
BOX=HIGHEST(H,P-2)<HIGHEST(H,P-1);
TOP=VALUEWHEN(1,BarsSince(H>HH(1))==(P-2) AND ,BOX,NH);
BTM=VALUEWHEN(1,BarsSince(H>HH(1))==(P-2) AND ,BOX,LL);

I looked at halcyonguy's Pine Functions converted to a TOS script. not pine studies and I have no clue.
Thank you so much!
 
Solution
Hello to the ones with many wrinkles,
I have used a foreign charting software with a few scans set up for daily use but I no longer use the software.
TOS already had built-in scan conditions equivalent to what I have used except the one below.
I am guessing that it is part of Darvas and coded with Pinescript(?).

Can anyone with skills able to convert it to TOS scan or an indicator?

###Original###
UPPERBAND
P=15;
LL=LOWEST(L,P);
HH=HIGHEST(H,P);
NH=VALUEWHEN(1,H>HH(1),H);
BOX=HIGHEST(H,P-2)<HIGHEST(H,P-1);
TOP=VALUEWHEN(1,BarsSince(H>HH(1))==(P-2) AND ,BOX,NH);
BTM=VALUEWHEN(1,BarsSince(H>HH(1))==(P-2) AND ,BOX,LL);

I looked at halcyonguy's Pine Functions converted to a TOS script. not pine studies and I have no clue...
Hello to the ones with many wrinkles,
I have used a foreign charting software with a few scans set up for daily use but I no longer use the software.
TOS already had built-in scan conditions equivalent to what I have used except the one below.
I am guessing that it is part of Darvas and coded with Pinescript(?).

Can anyone with skills able to convert it to TOS scan or an indicator?

###Original###
UPPERBAND
P=15;
LL=LOWEST(L,P);
HH=HIGHEST(H,P);
NH=VALUEWHEN(1,H>HH(1),H);
BOX=HIGHEST(H,P-2)<HIGHEST(H,P-1);
TOP=VALUEWHEN(1,BarsSince(H>HH(1))==(P-2) AND ,BOX,NH);
BTM=VALUEWHEN(1,BarsSince(H>HH(1))==(P-2) AND ,BOX,LL);

I looked at halcyonguy's Pine Functions converted to a TOS script. not pine studies and I have no clue.
Thank you so much!

you have 4 parameters in the valuewhens. should be 3. the 2nd parameter should be a price value. yours looks to be a logic value.

not sure what you want to scan for? looks like top and btm create price levels?

do you have a link to where this pine code came from? the write up on a study can help to understand it, and help convert it.
 
Solution
you have 4 parameters in the valuewhens. should be 3. the 2nd parameter should be a price value. yours looks to be a logic value.

not sure what you want to scan for? looks like top and btm create price levels?

do you have a link to where this pine code came from? the write up on a study can help to understand it, and help convert it.
It is a Darvas lines
TOS seems to have no scan for Darvas or worked with custom study. So strange to see that rising candle never penetrates the upper Darvas line in TOS.
I wish to have indicator or scan to plot when price candle crosses upper (top) line of Darvas channel with a period.

As for the parameters, sorry there was an error with one of commas.
Corrected,
TOP=VALUEWHEN ( 1 , BarsSince (H>HH(1)) == (P-2) AND BOX, NH);
para1: 1
para2: BarsSince(H>HH(1))==(P-2) AND BOX
para3: NH,

I do not know what the codes are written with.
I tried to get the entire code and closest I have is below.
I appreciate you helping someone with no wrinkles.
input : P(5);
var : LL(0),HH(0);
var : idx1(-1),Box(false),NH(0),TOP(0),BTM(0);
var : idx2(-1),Box2(false),NL(0),TOP(0),BTM(0);

LL = Lowest(L,P);
HH = Highest(H,P);

if H > HH[1] Then
{
NH = H;
idx1 = 0;
}
Else
idx1 = idx1+1;
BOX = Highest(H,P-2) < Highest(H,P-1);
if idx1 != -1 and idx1 == P-2 and Box == true Then
{
TOP = NH;
BTM = LL;
}
if L < LL[1] Then
{
NL = L;
idx2 = 0;
}
Else
idx2 = idx2+1;
BOX2 = Lowest(L,P-2) > Lowest(L,P-1);
if idx2 != -1 and idx2 == P-2 and Box2 == true Then
{
TOP2 = NL;

BTM2 = HH;
}

Plot1((TOP+BTM)/2);
Plot2((TOP2+BTM2)/2);

input2 : p1(10),p2(20),p3(30);
var1 = iff(c>=c[1],v,0);
var2 = iff(c>=c[1],0,v);
Var3 = (Highest(v,P1)+Lowest(V,P1))/2;
var4 = (Highest(v,P2)+Lowest(V,P2))/2;
var5 = (Highest(v,P3)+Lowest(V,P3))/2;

Plot1(var1);
Plot2(var2);
Plot3(var3);
Plot4(var4);
Plot5(var5);

var6 = iff(c>c[1],v,0);
var7 = iff(c>=c[1],0,v);
Var8 = (C-L)/(H-L)*v;

Plot1(var6);
Plot2(var7);
Plot3(var8);
 
Last edited:

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
538 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