Renko Box Size Customization (Pine Script)
i am trying to write a pine script code on Tradingview, the aim is to adjust the renko box size automatically (something like ATR, but tradingview's ATR feature doesnt do what i want), i am thinking to make the box size 5% of the current price (or of the previous close, this makes more sense because the value would be concrete).
below is the code for the regular renko, what i am struggling is to make 'box_size' variable equal to a specific percentage of the previous close.
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
box_size = 0.5
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
appreciate any guidance in advance.
pine-script
add a comment |
i am trying to write a pine script code on Tradingview, the aim is to adjust the renko box size automatically (something like ATR, but tradingview's ATR feature doesnt do what i want), i am thinking to make the box size 5% of the current price (or of the previous close, this makes more sense because the value would be concrete).
below is the code for the regular renko, what i am struggling is to make 'box_size' variable equal to a specific percentage of the previous close.
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
box_size = 0.5
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
appreciate any guidance in advance.
pine-script
add a comment |
i am trying to write a pine script code on Tradingview, the aim is to adjust the renko box size automatically (something like ATR, but tradingview's ATR feature doesnt do what i want), i am thinking to make the box size 5% of the current price (or of the previous close, this makes more sense because the value would be concrete).
below is the code for the regular renko, what i am struggling is to make 'box_size' variable equal to a specific percentage of the previous close.
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
box_size = 0.5
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
appreciate any guidance in advance.
pine-script
i am trying to write a pine script code on Tradingview, the aim is to adjust the renko box size automatically (something like ATR, but tradingview's ATR feature doesnt do what i want), i am thinking to make the box size 5% of the current price (or of the previous close, this makes more sense because the value would be concrete).
below is the code for the regular renko, what i am struggling is to make 'box_size' variable equal to a specific percentage of the previous close.
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
box_size = 0.5
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
appreciate any guidance in advance.
pine-script
pine-script
asked Nov 13 '18 at 10:37
Leonard LiuLeonard Liu
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try this out
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
percentate_value = 0.01 // 1/100 =0.01 1%
box_size = nz(close[1]*percentate_value, 0)
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
here close[1] is previous close value
nz(close[1]percentate_value, 0) this return zero when there is not previous value else previouscloseprecentage_value
This gives the following error in pine script:line 7: Cannot call 'renko' with arguments (string, string, literal string, series); available overloads: renko(string, string, string, float) => string;
. There does not seem to be a way to pass a series asbox_size
– ragamufin
Dec 2 '18 at 1:45
As communicated ,This is tradingview built in function issue for which we cannot send modified values as an argument. Tradingview need to provide a fix for this.
– Marx Babu
Dec 3 '18 at 8:55
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279126%2frenko-box-size-customization-pine-script%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this out
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
percentate_value = 0.01 // 1/100 =0.01 1%
box_size = nz(close[1]*percentate_value, 0)
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
here close[1] is previous close value
nz(close[1]percentate_value, 0) this return zero when there is not previous value else previouscloseprecentage_value
This gives the following error in pine script:line 7: Cannot call 'renko' with arguments (string, string, literal string, series); available overloads: renko(string, string, string, float) => string;
. There does not seem to be a way to pass a series asbox_size
– ragamufin
Dec 2 '18 at 1:45
As communicated ,This is tradingview built in function issue for which we cannot send modified values as an argument. Tradingview need to provide a fix for this.
– Marx Babu
Dec 3 '18 at 8:55
add a comment |
Try this out
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
percentate_value = 0.01 // 1/100 =0.01 1%
box_size = nz(close[1]*percentate_value, 0)
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
here close[1] is previous close value
nz(close[1]percentate_value, 0) this return zero when there is not previous value else previouscloseprecentage_value
This gives the following error in pine script:line 7: Cannot call 'renko' with arguments (string, string, literal string, series); available overloads: renko(string, string, string, float) => string;
. There does not seem to be a way to pass a series asbox_size
– ragamufin
Dec 2 '18 at 1:45
As communicated ,This is tradingview built in function issue for which we cannot send modified values as an argument. Tradingview need to provide a fix for this.
– Marx Babu
Dec 3 '18 at 8:55
add a comment |
Try this out
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
percentate_value = 0.01 // 1/100 =0.01 1%
box_size = nz(close[1]*percentate_value, 0)
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
here close[1] is previous close value
nz(close[1]percentate_value, 0) this return zero when there is not previous value else previouscloseprecentage_value
Try this out
//@version=3
study("Renko", shorttitle = "Renko")
src = input(title = "Source (close or open or hl2 or hlc3 or ohlc4)", type =
string, defval = "close")
percentate_value = 0.01 // 1/100 =0.01 1%
box_size = nz(close[1]*percentate_value, 0)
renko_tickerid = renko(tickerid, src, "Traditional", box_size)
renko_close = security(renko_tickerid, period, close)
renko_open = security(renko_tickerid, period, open)
renko_high = security(renko_tickerid, period, high)
renko_low = security(renko_tickerid, period, low)
plotcandle(renko_open, renko_high, renko_low, renko_close, color = renko_open < renko_close ? green : red)
here close[1] is previous close value
nz(close[1]percentate_value, 0) this return zero when there is not previous value else previouscloseprecentage_value
answered Nov 18 '18 at 11:49
Marx BabuMarx Babu
17613
17613
This gives the following error in pine script:line 7: Cannot call 'renko' with arguments (string, string, literal string, series); available overloads: renko(string, string, string, float) => string;
. There does not seem to be a way to pass a series asbox_size
– ragamufin
Dec 2 '18 at 1:45
As communicated ,This is tradingview built in function issue for which we cannot send modified values as an argument. Tradingview need to provide a fix for this.
– Marx Babu
Dec 3 '18 at 8:55
add a comment |
This gives the following error in pine script:line 7: Cannot call 'renko' with arguments (string, string, literal string, series); available overloads: renko(string, string, string, float) => string;
. There does not seem to be a way to pass a series asbox_size
– ragamufin
Dec 2 '18 at 1:45
As communicated ,This is tradingview built in function issue for which we cannot send modified values as an argument. Tradingview need to provide a fix for this.
– Marx Babu
Dec 3 '18 at 8:55
This gives the following error in pine script:
line 7: Cannot call 'renko' with arguments (string, string, literal string, series); available overloads: renko(string, string, string, float) => string;
. There does not seem to be a way to pass a series as box_size
– ragamufin
Dec 2 '18 at 1:45
This gives the following error in pine script:
line 7: Cannot call 'renko' with arguments (string, string, literal string, series); available overloads: renko(string, string, string, float) => string;
. There does not seem to be a way to pass a series as box_size
– ragamufin
Dec 2 '18 at 1:45
As communicated ,This is tradingview built in function issue for which we cannot send modified values as an argument. Tradingview need to provide a fix for this.
– Marx Babu
Dec 3 '18 at 8:55
As communicated ,This is tradingview built in function issue for which we cannot send modified values as an argument. Tradingview need to provide a fix for this.
– Marx Babu
Dec 3 '18 at 8:55
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279126%2frenko-box-size-customization-pine-script%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown