Tutorial 205 | How to convert tutorial 23 (line break) and tutorial 173 (supertrend) into functions

  • 2 months ago
Tutorial 205 demonstrates how to convert tutorial 23 (line break) (https://markplex.com/free-tutorials/tutorial-23-creating-3-line-break-3lb-indicator-apply-normal-candlestick-charts/) and tutorial 173 (Markplex supertrend) (https://markplex.com/free-tutorials/tutorial-173-markplex-supertrend/) into functions.
Transcript
00:00Hello and welcome to tutorial 205 and in this tutorial we're going to do a couple of things.
00:06One we're going to take tutorial 23 and convert it into a function that can be called by other
00:13programs and secondly we're going to be looking at tutorial 173 and also making that into a
00:20function. In fact that is already available for GoldPass members in Q&A 80 I believe.
00:27Anyway so let's have a quick look at tutorial 23. Now tutorial 23 is something which takes
00:38tries to reproduce the line break indicator except that it does that for normal charts so you can see
00:46how it looks on a chart so it's not as perhaps quite as shorthand as a line break chart but
00:51you do still have the time element there because you've got normal bars and that program
00:58or the page has three videos, four videos that is worth going through just to see exactly how
01:08the program works. I'm not going to go through all that again I'm just simply going to look at
01:12how we did the conversion. So the first thing this is the original program function tutorial 23.
01:22We're creating a function and so we need to have a way of including an input and I'm doing that
01:29using this variable here and I'm using the numeric simple type. Now these two are actually not
01:40inputs these are going to be variables in the program but we're creating them as numeric
01:47references because we're going to be using that information when we call the function and so most
01:54of the tutorial code is exactly the same as the indicator except when we get down here to the end
02:02and in the indicator we draw boxes using a function called drawBox2. Well we're not going
02:11to do that in the indicator but what we are going to do is we're going to store into ORunLow the
02:23running low and into ORunHigh the running high and we're going to store the ORunLow into running
02:29low when it's a downline. In other words the program's telling us it's a downline and when
02:34it's an upline we're going to store the ORunHigh running high into ORunHigh. The other thing we're
02:40going to do we're going to make the tutorial return minus one if it's a downline and plus one
02:46if it's an upline. So I've got a chart here and we have the programs applied to the chart so
02:57let's see if we can just change the size of this a little bit.
03:05Okay so that will do. So here we can see the boxes being drawn on the chart and we've also got
03:10this plot and this is the plot that's in the original program. This is the plot that the
03:18function is drawing when it's called by another program and the advantage of the function of
03:22course is that you could then for example build it into a strategy or another program that you
03:29wish. So you can see that the lines the green for the up bars and the magenta in this case for the
03:36down bars and they match with the one in the actual program. So let me just show you how you
03:41would go about calling the program and quite straightforward function call. So we're just using
03:51the syntax value one equals underscore tutorial 23 fn then we've got three which is number of
03:59line breaks then we've got the o run high and o run low. So if it's minus one we plot the o run low
04:05and if it's plus one then we plot the o run high and that's as simple as it gets to to call the
04:13program. Okay so hopefully this function might be useful to you and I will make it available on
04:21the tutorial 205 web page. What I'm also going to do is show again the tutorial
04:30to 173 and show that has converted that into a function. I'll talk about that
04:39in a separate video. Thank you very much.

Recommended