- Platform
-
- Thinkorswim
Can anyone convert this for TOS? Thanks in advance.
www.tradingview.com

Darvas Box Strategy V2 by ceyhun
What Is the Darvas Box? The Darvas Box strategy was developed by Nicholas Darvas. Aside from being a well known dancer, he began trading stock in the 1950s. Based on his success in trading, he was approached to write a book on his strategy. The book, “How I Made $2,000,000 in the Stock Market,”...
Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ceyhun
//@version=4
strategy ("Darvas Box Strategy V2",overlay=true)
boxp=input(5, "BOX LENGTH")
LL = lowest(low,boxp)
k1 = highest(high,boxp)
k2 = highest(high,boxp-1)
k3 = highest(high,boxp-2)
NH = valuewhen(high>k1[1],high,0)
box1 = k3<k2
TopBox = valuewhen(barssince(high>k1[1])==boxp-2 and box1, NH, 0)
BottomBox = valuewhen(barssince(high>k1[1])==boxp-2 and box1, LL, 0)
plot(TopBox, linewidth=2, color=#00FF00, title="TopBox")
plot(BottomBox, linewidth=2, color=#FF0000, title="BottomBox")
if crossover(close,TopBox)
strategy.entry("Long", strategy.long, comment="Long")
if crossunder(close,BottomBox)
strategy.entry("Short", strategy.short, comment="Short")
Last edited by a moderator: