Showing posts with label is. Show all posts
Showing posts with label is. Show all posts

Sunday, 20 October 2024

Pine Script [OUTDATED V4] Tutorial Lesson 5 TradingView Script Alerts

hey guys this is Matt welcome back to
zen and the art of trading today's video
is gonna be extremely short I'm just
going to explain to you guys how to add
alerts to your scripts so you can add
this alert functionality to scripts that
you create or scripts that you download
from other people say you find a script
on tradingview that you like they look
off but it doesn't generate alerts by
adding this functionality to the script
you can basically turn any script out
there into an alert generating script so
I'm gonna be building off lesson 4 so if
you haven't watched that video I'll
leave a link in the video description
and go back and watch how we did this
the script just generates RSI signal so
when the RSI goes overboard or oversold
it just plots as visual signals to the
chart so I'm just gonna rename this to
lesson 5 now this is going to be
extremely simple we're just adding one
line of code here and this is going to
send out an alert if this particular
candle meets our conditions so all you
need to type here is alert condition
open parenthesis and now this function
here takes three inputs takes a boolean
input which is the trigger for the alert
if the boolean is true then the alert is
sent out it takes a title which is for
the pop-up box and the email heading and
it takes a message which is like the
body the text body of the alert so I'll
explain all this as I go first of all
the bully and we're going to combine
these two boolean values here into one
so what we're going to do here is were
going to say if the RSI is overbought or
the RSI is oversold , this alert will be
triggered now the title of the alert is
going to be RSI signal and then we'll
put another comma and then the message
is going to be set to RSI signal
detected for and now trading view added
this
this new cool alert functionality here
where you can use these placeholders
special placeholders in order to inject
certain information from the chart so
you can inject the closing price at a
time etc if you hit the question mark
here it'll do it have a whole list of
things so what we're going to use here
is probably just the ticker the ticker
will do so you can see here that if you
were to use all of this text this is
what it would replace as so you can
reference the exchange or the in forex
this case the broker you can list the
ticker symbol the currency pair in our
case you could have the price on there
and volume and there's a whole bunch of
things you can choose from so I'll leave
that for you to look through in today's
example we're just going to be using
ticker so if I just throw that in there
hit save that's literally it this script
is now ready to generate email and pop
up alerts SMS alerts push notifications
all of that stuff straight to your phone
whenever one of these signals is
generated so it's amazingly simple it's
what my fit one of my favorite things
about trading view is how simple they
make this stuff and just quickly before
I move on I just thought I should better
point out the fact that if you hover
your mouse over a function did you run
familiar with it'll tell you exactly
what inputs it takes so you can see here
it takes a condition a title and a
message and if you hold down ctrl or
command on a Mac and you click on the
function it will pop up this help box
which will explain in great detail what
the function does so now if you hit the
create alert button the way that you
would set an alert for the script is you
just come down here and click the name
of your script and that's it it's ready
to go you select your options here
notify an app show pop-up etc you can
play a sound whatever you like and you
can change the message down here so yeah
that's up to you that's personal all of
this is personal preference but up here
in under options you can set how the
alert is triggered so you can set set it
trigger only once and that means that if
the signal shows up on your chart you
get one alert and then the alert will
disable itself once per bar means that
it will repeat every time there's a new
bar so if you get multiple signals like
this it'll send out an alert on this one
then you won't get an alert for these
this to these two candles here but then
you get another one here another one
another one all in a row so that's
pretty helpful for day trading but if
you are trading in the higher time
frames it just gets annoying so you
probably don't want to have that set my
favorite one to use is once per bar
closed so this will only trigger see
once per bar will trigger even before
the candle closes so if you get an alert
here say that this next candle went
overboard and then you got an alert st.
was overbought but then the candle
closed and the signal was invalidated
you still get an alert even though the
setup didn't really occur so once per
bar closed is my personal favorite
setting to use that means it will only
send out alerts for confirmed signals
and once per minute it's
self-explanatory
and that's it all you do is hit create
it'll be added to your list of alerts
let me clear out some of these inactive
alerts and there you go done simple as
that so if I just quickly change these
settings to the traditional RSI values
just for this example hit OK and create
a new alert
I'll take show pop-up so we'll get an
actual pop-up to my screen I'll change
this to that change it to once per bar
closed and hit create then once this
candle closes here we should get an
alert sent to our charting platform and
my phone so let's wait and see what
happens
three two one dawn and there we go
there's our alert and I can hear my
screen beeping in the background she's
probably gonna wake my girlfriend up
it's a bit early here in the morning so
whoops forgot about that but anyway
that's it done so that's the end of this
lesson
good luck with your trading good luck
with your coding and I'll see you in the
next lesson where we'll go over how to
detect
patterns see there have a great day
goodbye
[Music]

How to use the STUDY Function • Pine Script [OUTDATED V4] Tutorial

hey traders my name is Matthew from
Pines crib month and in this video today
I'm going to show you some content from
my PI inscript mastery course where I'm
going to break down the study annotation
function and explain all the various
parameters that we have to work with
but before we begin I should mention
that if you enjoy this content
there's plenty more available over at
pine script mastery com including a free
basics course for beginners so go and
check that out if it's something that
interests you but for now let's get into
the content
so hey coders welcome to the very first
pan script coding lesson in this course
this lesson is going to cover the study
annotation function which is this guy
down here so I'm going to explain what
this does and how to use it what all the
input parameters do so this study
function is what pine strip refers to as
a annotation function so similar to this
as an annotation comment which tells
it's a compiler directive it tells the
pine Script compiler what version of
pine strips are using in this case
version 4 the latest version as of
making this course the study function
does a similar thing it tells pine
script all of the code that follows this
study annotation function is to be
treated as a study script for in other
words an indicator script as opposed to
a strategy script so if we were to make
a strategy script we would have access
to different functions such as all these
strategy calls but we're not doing that
today we're going to cover strategy much
later in the course
so today we're just working with the
study function so first of all what
inputs does the study annotation
function take it takes two titles it
takes an overlay our boolean input it
takes a text format input it takes a
precision input a scale input and a max
bars back input so those are the
parameters we have to work with and I'll
explain what each of them do one by one
so the first input parameter is a title
and this is the only input parameter
that is required so if you don't have
this title and you try to save your
script
it won't work we'll get an error so this
first title input is the name of the
script and you can call it whatever you
want so in this case I'm going to call
it pine script mastery course study
example and hit save and you'll see up
here our script name has now changed to
PS MC study example now you don't need
to have the
title equals here we could just do that
and that would also work but just for
clarity's sake I'm gonna leave that in
because we also have access to the short
title so I'll show what that does now
short title is set to let's call this
study and now if I hit save that'll
change the name of our script to just
study and so the reason there's two
titles is that the main title is for
explaining in detail what your script
name is the short title is for an
abbreviation on your chart so for
example I have indicated called the
ultimate pullback indicator but that's a
long name to have it clutters up your
chart a fair bit so what I have used the
short title for is to abbreviate it to
UPI and so when you use my ultimate
pullback indicator that's all you get on
your child is UPI
so that's the purpose of the short
titles to abbreviate any long skip names
you come up with so that's those two
input parameters the next input
parameter is overlay so by default
overlay is set to false and what this
means is that our script will draw into
its own window pane its own box as you
can see here it's drawing in its own
oscillator type box so this is useful
for scripts like the RSI stochastics
even volume that sort of thing but if
you want to draw onto your actual chart
you have to set this to true so if I set
this to true and I hit save first of all
I need to remove the script this
parameter to update and if we click add
to chart the script is now drawing the
closing price to the chart instead of
into its own oscillator box so it's save
again and I remove the script add it
back now it's in its own box so that's
what the overlay our parameter does the
next import is the format input so this
is for setting how the values number
values are formatted when they're drawn
to your chart so we only have to
formatting options if you type format
control space technically three inherit
price and volume by default it's set to
inherit which will
inherit your chart access formatting but
you can override this with whichever
formatting type you want so if we set
this to format volume and hit save you
can see that it is now drawing a 1 down
here I changed this to say 20,000 hit
save you'll see that it now puts a K on
the end and if we would have changed
this to say 20,000 420 and we hit save
now it says 20.4 2k that's useful for
creating indicators like your volume
indicator or anything that works with
volume and that sort of thing because if
you set this to price and hit save then
we'll get the exact number there so for
most scripts you're going to want this
exact number but for other scripts
especially ones working with volume this
formatting volume format can be helpful
so I'll leave this is inherit for now so
if I set this back to plot the closing
price and we move on I will show you
what the next input does which is
precision so the next input parameter is
precision and this specifies how much
precision to go into with your decimal
values so if you were to set this to 2
it's going to cut all these decimal
digits in the indicator value and it's
going to round the number up to the
nearest two digits so if I hit save
you'll see that this number will just
become zero point six nine and then as
it gets closer to 70 it rounds up to 70
there so we only have two decimal digits
and that's what precision does we go all
the way to 1 and then we'll just get 0.7
because it's rounding up zero point 6 9
to 7 so for most instruments on your
chart most markets precision of 5 is
about as much as you will ever need but
you can go higher if you want to we
could go to 6 I'm not sure what the
maximum precision is but it's a lot
there we have a precision of 10 that
might be helpful for analyzing
cryptocurrency markets maybe like
satoshis on some cryptocurrency markets
but by default this is set to whatever
your price
is so I'll leave that as five now and
we'll move on to the next input
parameter which is scale now this
parameter tells pine script which scale
to attach your indicator values to so we
have a number of options here by default
that's set to your main price scale but
if I type in scale and then control
space that'll bring up the list of
scales we have to choose from so if I
set the scale to scale dot left and I
save the chart save this script and I
remove the script from my chart add it
back on now you can see that the
indicator values are plotting to the
left scale so that's what this input
parameter does it allows you to move
which scale that your indicator value is
attached to so the final input parameter
we can work with is max bars back so if
you type in max underscore bars on the
score back this determines how far back
your script can reference historical
bars so I set this to 5 now our script
can only reference the past 5 historical
bars so that will be the maximum amount
of historical values we can go back so
it's very unlikely you will ever have to
use this input parameter I'm not even
sure why it's included but I'm sure
there's a reason for it
maybe for saving the amount of memory
that a script uses when calculating its
values if your script is failing to
execute because it's running into plan
scripts computer resource limitations
may be evil to use this feature but that
is all of these study annotation input
parameters we have to work with for your
average indicator you will only really
be working with these three values your
main title your short title and overlay
that's the most common three inputs I
use in my own scripts anyway so that's
it for this lesson I hope you found that
helpful if you did and you want to learn
more about Pyne scripts head over to pan
skip mastery com here you'll find my
advanced pan script courses and my
basics course which is free so if you
want to learn more about behind script
head over here and you'll find out a
little bit more about me and a little
bit more about Pine script I hope you
found this lesson interesting and
helpful I'll see you the next one
[Music]

PineConnector TradingView Automation MetaTrader 4 Setup Guide

what's up Traders I'm Kevin Hart and in today's video I'm going to be showing you how to install Pine connecto...