I want to write a code in pine script that enables me to calculate the number of pips between the high and low of only the First candle of the day. I also want to use this value in the form of a variable to set stop losses and targets.
I got this on the web but don't know how it works. Can we modify this to meet the above criteria?
getHighLowNumPips() => (high - low) / syminfo.mintick
plot(getHighLowNumPips())
I am a newbie in pine script and I am not able to write the code. Any help will be greatly appreciated :)
Thanks,
In the example below the script will calculate the number of pips according to your
getHighLowNumPips
function on the first candle of the day and ignore other candles.Note that built-in
dayofmonth
use the exchange's timezone.