Search found 96 matches

Go to advanced search

by Steve Burman
Thu Feb 16, 2023 11:32 pm
Forum: Pine Script Q&A
Topic: Error message dividing lines
Replies: 9
Views: 1902
 
Jump to post

Re: Error message dividing lines

Ok that makes sense where it came from. ChatGPT will only create what you ask for and it's not accurate because it has only recently started learning pinescript but will get better over time. The script doesn't make sense to me so I don't know what you are wanting it to do. Moreover, I don't have th...
by Steve Burman
Thu Feb 16, 2023 1:20 am
Forum: Pine Script Q&A
Topic: Error message dividing lines
Replies: 9
Views: 1902
 
Jump to post

Re: Error message dividing lines

If there's no errors and it's not loading, look for a small red circle with a white exclamation mark near the top left of the chart near where the script would be situated. That is for errors related to the market rather than the script
by Steve Burman
Wed Feb 15, 2023 8:40 pm
Forum: Pine Script Q&A
Topic: Error message dividing lines
Replies: 9
Views: 1902
 
Jump to post

Re: Error message dividing lines

The syntax is wrong for version 5. We don't use double types but instead use float. Also we don't use {

Have you tried converting this from Python on some other language?
by Steve Burman
Tue Feb 14, 2023 6:42 am
Forum: Pine Script Q&A
Topic: Error message dividing lines
Replies: 9
Views: 1902
 
Jump to post

Re: Error message dividing lines

Hey Jan, Those dividing lines are not valid syntax. I've never seen them before in pinescript. What are you trying to achieve? If it's testing whether all 3 booleans are true, you can do this? if macdResult == 0 and stochResult == 0 and bollingerResult == 0 do something If it's testing only whether ...
by Steve Burman
Sun Feb 12, 2023 6:52 am
Forum: Pine Script Q&A
Topic: I'm not sure how to achieve this and I'm a newbie
Replies: 3
Views: 1031
 
Jump to post

Re: I'm not sure how to achieve this and I'm a newbie

Hey,

You can use the following

//@version=4
study("Grey Bars")
is_grey = time(timeframe.period, "1700-1800:23456", "Europe/London") this is true if it is between 1700 and 1800 Monday to Friday
barcolor(is_grey ? #808080 : na)

I hope this helps
by Steve Burman
Fri Feb 10, 2023 1:04 am
Forum: Pine Script Q&A
Topic: Disable trading after Stop Loss is triggered
Replies: 1
Views: 705
 
Jump to post

Re: Disable trading after Stop Loss is triggered

Hey JAG,

You could wrap the strategy.entry statement around an if statement such as:

if strategy.position_size == 0
strategy.entry()

I hope this helps!
by Steve Burman
Mon Feb 06, 2023 3:36 am
Forum: Pine Script Q&A
Topic: Add delay to this script before and after an economic annoucement
Replies: 4
Views: 1929
 
Jump to post

Re: Add delay to this script before and after an economic annoucement

Boomscud, I hope you were able to work it out, but in case you weren't able to find the answer, I hope this helps. Assuming unixTime is the time variable for each economic event, you can simply subtract 5hrs of unix time (1000 * 60 * 60 * 5) =18000000 from the unixTime variable and add 18000000 to t...
by Steve Burman
Mon Feb 06, 2023 1:07 am
Forum: Pine Script Q&A
Topic: Help with my first pine script
Replies: 8
Views: 6221
 
Jump to post

Re: Help with my first pine script

If you wanted to differentiate between buy and sell comments on the chart you could use the following:

// Buy condition
if (c[1] == color.lime)
strategy.entry("Long", strategy.long, comment="Buy Long")

// Sell condition
if (c[1] == color.red)
strategy.close("Long", "Sell Long")
by Steve Burman
Mon Feb 06, 2023 12:58 am
Forum: Pine Script Q&A
Topic: Help with my first pine script
Replies: 8
Views: 6221
 
Jump to post

Re: Help with my first pine script

Interesting approach using colors as the buy and sell condition. The only thing that needed fixing for it to work was the strategy.entry and strategy.close functions needed to be tabbed in 4 spaces. You also have warning messages on your plot statements which can be fixed with the following syntax: ...
by Steve Burman
Mon Feb 06, 2023 12:43 am
Forum: Pine Script Q&A
Topic: Help with my first pine script
Replies: 8
Views: 6221
 
Jump to post

Re: Help with my first pine script

Hey Phil,

I'll look into it and let you know shortly.

Go to advanced search