{"id":4604,"date":"2020-04-23T16:43:37","date_gmt":"2020-04-23T16:43:37","guid":{"rendered":"http:\/\/joapen.com\/blog\/?p=4604"},"modified":"2020-04-23T16:47:33","modified_gmt":"2020-04-23T16:47:33","slug":"average-true-value-atr-on-pine-tradingview","status":"publish","type":"post","link":"https:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/","title":{"rendered":"Average True Value (ATR) on pine (tradingview)"},"content":{"rendered":"<p>I have created this code to help me with the trades, independently of the long term trades or swing trades.<\/p>\n<h1>The code<\/h1>\n<pre>\/\/@version=1\r\n\/\/ @author = joapen.com , how I use it\r\n\/\/\r\n\/\/ If you use this code in its orignal\/modified form, do drop me a note. I would like to learn about better improvements of it \r\n\/\/ \r\n\/\/1.- Define Stop Loss\r\n\/\/2.- Check if the goal makes sense or not,\r\n\/\/3.- Compare with Bollinger bands.\r\n\/\/4.- Refine the trade...\r\nstudy(title=\"joapen-ATR-analysis\", overlay = true)\r\n\r\nnATRPeriod = input(defval = 10, title=\"# periodos\", type=integer)\r\nnATRMultip = input(defval = 1.8, title=\"factor multiplicador\", type=float)\r\n\r\nxATR = atr(nATRPeriod)\r\nnLoss = nATRMultip * xATR\r\n\/\/ the \"goal reference\" must be at least twice the stop loss\r\nnObjetivo = nATRMultip * xATR *2\r\n\r\nxATRStop = close - nLoss\r\nxATRObjetivo = close + nObjetivo\r\n\r\nplot(xATRStop, color=red, title=\"ATR Stop\")\r\nplot(xATRObjetivo, color=blue, title=\"ATR Objetivo\")<\/pre>\n<p>Any additional support is welcomed<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have created this code to help me with the trades, independently of the long term trades or swing trades. The code \/\/@version=1 \/\/ @author = joapen.com , how I use it \/\/ \/\/ If you use this code in its orignal\/modified form, do drop me a note. I would like to learn about better &#8230; <a title=\"Average True Value (ATR) on pine (tradingview)\" class=\"read-more\" href=\"https:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/\" aria-label=\"Read more about Average True Value (ATR) on pine (tradingview)\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[],"class_list":["post-4604","post","type-post","status-publish","format-standard","hentry","category-trading"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Average True Value (ATR) on pine (tradingview) -<\/title>\n<meta name=\"description\" content=\"I have created this code to help me with the trades, independently of the long term trades or swing trades. The code \/\/@version=1 \/\/ @author = joapen.com - joapen projects\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Average True Value (ATR) on pine (tradingview) -\" \/>\n<meta property=\"og:description\" content=\"I have created this code to help me with the trades, independently of the long term trades or swing trades. The code \/\/@version=1 \/\/ @author = joapen.com - joapen projects\" \/>\n<meta property=\"og:url\" content=\"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/\" \/>\n<meta property=\"og:site_name\" content=\"joapen projects\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-23T16:43:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-23T16:47:33+00:00\" \/>\n<meta name=\"author\" content=\"joapen\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"joapen\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/#article\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/\"},\"author\":{\"name\":\"joapen\",\"@id\":\"https:\\\/\\\/joapen.com\\\/blog\\\/#\\\/schema\\\/person\\\/23919df2312175fe9c4609203595b217\"},\"headline\":\"Average True Value (ATR) on pine (tradingview)\",\"datePublished\":\"2020-04-23T16:43:37+00:00\",\"dateModified\":\"2020-04-23T16:47:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/\"},\"wordCount\":34,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/joapen.com\\\/blog\\\/#\\\/schema\\\/person\\\/23919df2312175fe9c4609203595b217\"},\"articleSection\":[\"Trading\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/\",\"url\":\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/\",\"name\":\"Average True Value (ATR) on pine (tradingview) -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/joapen.com\\\/blog\\\/#website\"},\"datePublished\":\"2020-04-23T16:43:37+00:00\",\"dateModified\":\"2020-04-23T16:47:33+00:00\",\"description\":\"I have created this code to help me with the trades, independently of the long term trades or swing trades. The code \\\/\\\/@version=1 \\\/\\\/ @author = joapen.com - joapen projects\",\"breadcrumb\":{\"@id\":\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/joapen.com\\\/blog\\\/2020\\\/04\\\/23\\\/average-true-value-atr-on-pine-tradingview\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/joapen.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Average True Value (ATR) on pine (tradingview)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/joapen.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/joapen.com\\\/blog\\\/\",\"name\":\"joapen projects\",\"description\":\"Just a place to write\",\"publisher\":{\"@id\":\"https:\\\/\\\/joapen.com\\\/blog\\\/#\\\/schema\\\/person\\\/23919df2312175fe9c4609203595b217\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/joapen.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/joapen.com\\\/blog\\\/#\\\/schema\\\/person\\\/23919df2312175fe9c4609203595b217\",\"name\":\"joapen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/joapen.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/joapen-mini.jpeg\",\"url\":\"https:\\\/\\\/joapen.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/joapen-mini.jpeg\",\"contentUrl\":\"https:\\\/\\\/joapen.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/joapen-mini.jpeg\",\"width\":400,\"height\":400,\"caption\":\"joapen\"},\"logo\":{\"@id\":\"https:\\\/\\\/joapen.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/joapen-mini.jpeg\"},\"sameAs\":[\"http:\\\/\\\/www.joapen.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Average True Value (ATR) on pine (tradingview) -","description":"I have created this code to help me with the trades, independently of the long term trades or swing trades. The code \/\/@version=1 \/\/ @author = joapen.com - joapen projects","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/","og_locale":"en_US","og_type":"article","og_title":"Average True Value (ATR) on pine (tradingview) -","og_description":"I have created this code to help me with the trades, independently of the long term trades or swing trades. The code \/\/@version=1 \/\/ @author = joapen.com - joapen projects","og_url":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/","og_site_name":"joapen projects","article_published_time":"2020-04-23T16:43:37+00:00","article_modified_time":"2020-04-23T16:47:33+00:00","author":"joapen","twitter_misc":{"Written by":"joapen","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/#article","isPartOf":{"@id":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/"},"author":{"name":"joapen","@id":"https:\/\/joapen.com\/blog\/#\/schema\/person\/23919df2312175fe9c4609203595b217"},"headline":"Average True Value (ATR) on pine (tradingview)","datePublished":"2020-04-23T16:43:37+00:00","dateModified":"2020-04-23T16:47:33+00:00","mainEntityOfPage":{"@id":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/"},"wordCount":34,"commentCount":0,"publisher":{"@id":"https:\/\/joapen.com\/blog\/#\/schema\/person\/23919df2312175fe9c4609203595b217"},"articleSection":["Trading"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/","url":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/","name":"Average True Value (ATR) on pine (tradingview) -","isPartOf":{"@id":"https:\/\/joapen.com\/blog\/#website"},"datePublished":"2020-04-23T16:43:37+00:00","dateModified":"2020-04-23T16:47:33+00:00","description":"I have created this code to help me with the trades, independently of the long term trades or swing trades. The code \/\/@version=1 \/\/ @author = joapen.com - joapen projects","breadcrumb":{"@id":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/joapen.com\/blog\/2020\/04\/23\/average-true-value-atr-on-pine-tradingview\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/joapen.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Average True Value (ATR) on pine (tradingview)"}]},{"@type":"WebSite","@id":"https:\/\/joapen.com\/blog\/#website","url":"https:\/\/joapen.com\/blog\/","name":"joapen projects","description":"Just a place to write","publisher":{"@id":"https:\/\/joapen.com\/blog\/#\/schema\/person\/23919df2312175fe9c4609203595b217"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/joapen.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/joapen.com\/blog\/#\/schema\/person\/23919df2312175fe9c4609203595b217","name":"joapen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/joapen.com\/blog\/wp-content\/uploads\/2021\/04\/joapen-mini.jpeg","url":"https:\/\/joapen.com\/blog\/wp-content\/uploads\/2021\/04\/joapen-mini.jpeg","contentUrl":"https:\/\/joapen.com\/blog\/wp-content\/uploads\/2021\/04\/joapen-mini.jpeg","width":400,"height":400,"caption":"joapen"},"logo":{"@id":"https:\/\/joapen.com\/blog\/wp-content\/uploads\/2021\/04\/joapen-mini.jpeg"},"sameAs":["http:\/\/www.joapen.com"]}]}},"_links":{"self":[{"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/posts\/4604","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/comments?post=4604"}],"version-history":[{"count":2,"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/posts\/4604\/revisions"}],"predecessor-version":[{"id":4606,"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/posts\/4604\/revisions\/4606"}],"wp:attachment":[{"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/media?parent=4604"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/categories?post=4604"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joapen.com\/blog\/wp-json\/wp\/v2\/tags?post=4604"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}