BankNifty 365
BankNifty 365
BankNifty 365
0 at
https://mozilla.org/MPL/2.0/
// © World_of_Indicators
//@version=4
// Linear Regression:
// Linear regression used to identify trend, trade setup, and stop. Based on this,
Color fillings on Donchian channels is updated. That will give clear idea of
strength or weakness in any trading instruments.
// HMA:
// HMA used as alternative to identify trend, trade setup, and stop. Based on this,
Color fillings on Donchian channels is updated. That will give clear idea of
strength or weakness in any trading instruments.
// Donchian Channels:
// Inputs:
/////////////////////////////////////////////////
// Using the ratio of donchian channel from early script we can calculate factor Z
which is the estimate of the high ratio and the low ratio
// crossing it with +100 and -100 we can produce the signals with addition on non
repaint donchian ratio channel
// inside the script one can take profit for both long and short , buy again and
sell again with stop loss if needed
// by the same logic we can calculate factor to z to any channel we want once we
create the correct ratio to it
tf = input(450)
// Conditions
longCond = bool(na)
shortCond = bool(na)
longCond := crossover(z, 100)
shortCond := crossunder(z, -100)
// Count your long short conditions for more control with Pyramiding
sectionLongs = 0
sectionLongs := nz(sectionLongs[1])
sectionShorts = 0
sectionShorts := nz(sectionShorts[1])
if longCond
sectionLongs := sectionLongs + 1
sectionShorts := 0
sectionShorts
if shortCond
sectionLongs := 0
sectionShorts := sectionShorts + 1
sectionShorts
// Pyramiding
pyrl = 1
// These check to see your signal and cross references it against the pyramiding
settings above
// These check to see your signal and cross references it against the pyramiding
settings above
last_open_longCondition = float(na)
last_open_shortCondition = float(na)
last_open_longCondition := longCondition ? open : nz(last_open_longCondition[1])
last_open_shortCondition := shortCondition ? open : nz(last_open_shortCondition[1])
last_longCondition = float(na)
last_shortCondition = float(na)
last_longCondition := longCondition ? time : nz(last_longCondition[1])
last_shortCondition := shortCondition ? time : nz(last_shortCondition[1])
// Take profit
// Stop Loss
last_long_close = float(na)
last_short_close = float(na)
last_long_close := long_close ? time : nz(last_long_close[1])
last_short_close := short_close ? time : nz(last_short_close[1])
// Alerts & Signals
bton(b) =>
b ? 1 : 0
plotshape(longCondition, title="buy alert", color=color.green,
textcolor=color.green, transp=0, style=shape.triangleup,
location=location.belowbar, size=size.small, text="LONG", offset=0)
longCond1 = bool(na)
shortCond1 = bool(na)
longCond1 := isTPl and crossover(high, (1 + tp / 100) * last_open_longCondition)
and
longCondition == 0 and in_longCondition == 1
shortCond1 := isTPs and crossunder(low, (1 - tp / 100) * last_open_shortCondition)
and
shortCondition == 0 and in_shortCondition == 1
// Count your long short conditions for more control with Pyramiding
sectionLongs1 = 0
sectionLongs1 := nz(sectionLongs1[1])
sectionShorts1 = 0
sectionShorts1 := nz(sectionShorts1[1])
if longCond1
sectionLongs1 := sectionLongs1 + 1
sectionShorts1 := 0
sectionShorts1
if shortCond1
sectionLongs1 := 0
sectionShorts1 := sectionShorts1 + 1
sectionShorts1
// Pyramiding
pyrl1 = 1
last_open_longCondition1 = float(na)
last_open_shortCondition1 = float(na)
last_open_longCondition1 := longCondition1 ? open : nz(last_open_longCondition1[1])
last_open_shortCondition1 := shortCondition1 ? open :
nz(last_open_shortCondition1[1])
last_longCondition1 = float(na)
last_shortCondition1 = float(na)
last_longCondition1 := longCondition1 ? time : nz(last_longCondition1[1])
last_shortCondition1 := shortCondition1 ? time : nz(last_shortCondition1[1])
// Take profit
long_close1 = long_tp1 ? 1 : 0
short_close1 = short_tp1 ? 1 : 0
last_long_close1 = float(na)
last_short_close1 = float(na)
last_long_close1 := long_close1 ? time : nz(last_long_close1[1])
last_short_close1 := short_close1 ? time : nz(last_short_close1[1])
//Linear Lines
//Linear Stop
//HMA Lines
//HMA Stop
//Donchian 50