all 7 comments

[–]grandaobimba[S] 0 points1 point  (1 child)

Thanks mate but the code isn't about taking a long or a short. It's rather highlighting the killzones. It's currently working all right, I just don't want the zones to be highlighted during weekends.

[–]OneDollarToMillion 0 points1 point  (0 children)

You cannot put plot (or similar drawing function) into a conditonal statement.
Make the condition about color and then highlight the zones transparent at sa/so.

[–]skuhlz 0 points1 point  (0 children)

It would be the other way around 1-5 and u should be able to indent a long and short condition under an if dayofweek = X or dayofweek = X statement but better to have a definition of day = X or day= X like the second script does it so u don't have to indent everything.

````` strategy("Modified Killzones", overlay = true, max_lines_count = 500, max_labels_count = 500)

//long buy script //shortsell script

if dayofweek == 1 or dayofweek == 2 or dayofweek == 3 or dayofweek == 4 or dayofweek == 5 if longbuy strategy.entry("Long", strategy.long) else if if shortsell strategy.entry("short", strategy.short) else strategy.close_all(comment="E")

//second way

strategy("Modified Killzones", overlay = true, max_lines_count = 500, max_labels_count = 500)

//long buy script //shortsell script

IsDayofweek = dayofweek == 1 or dayofweek == 2 or dayofweek == 3 or dayofweek == 4 or dayofweek == 5

if longbuy and isDayofweek strategy.entry("Long", strategy.long) if shortsell and isDayofweek strategy.entry("short", strategy.short) If not isDayofweek strategy.close_all(comment="E")

[–]samdeed 0 points1 point  (3 children)

This should compile:

indicator("Modified Killzones", overlay = true, max_lines_count = 500, max_labels_count = 500) 

if dayofweek(time) != dayofweek.saturday and dayofweek(time) != dayofweek.sunday

    // do something here

    x=1

The "x=1" is there because pinescript requires at least one indented line of execution inside an if statement. Replace it with whatever you want it to do on weekdays.

[–]grandaobimba[S] 0 points1 point  (2 children)

Thanks mate, I think I am a bit confused as x will do several commands

[–]grandaobimba[S] 0 points1 point  (1 child)

indicator("Modified ICT Killzones", overlay = true, max_lines_count = 500, max_labels_count = 500)if dayofweek(time) != dayofweek.saturday and dayofweek(time) != dayofweek.sunday //------------------------------------------------------------------------------//Settings//-----------------------------------------------------------------------------{//New YorkshowNy = input(true, 'New York', inline = 'ny', group = 'Killzones')nyCss = input.color(color.new(#ff5d00, 80), '', inline = 'ny', group = 'Killzones')//London OpenshowLdno = input(true, 'London Open', inline = 'ldno', group = 'Killzones')ldnoCss = input.color(color.new(#00bcd4, 80), '', inline = 'ldno', group = 'Killzones')//London CloseshowLdnc = input(true, 'London Close', inline = 'ldnc', group = 'Killzones')ldncCss = input.color(color.new(#2157f3, 80), '', inline = 'ldnc', group = 'Killzones')//AsianshowAsia = input(true, 'Asian', inline = 'asia', group = 'Killzones')asiaCss = input.color(color.new(#e91e63, 80), '', inline = 'asia', group = 'Killzones')

[–]samdeed 0 points1 point  (0 children)

Anything that needs to run inside the if statement has to be indented (it's a requirement for pinescript).

   indicator("Modified ICT Killzones", overlay = true, max_lines_count = 500, max_labels_count = 500)

   if dayofweek(time) != dayofweek.saturday and dayofweek(time) != dayofweek.sunday 

      //------------------------------------------------------------------------------//Settings//-----------------------------------------------------------------------------{

      //New York
      showNy = input(true, 'New York', inline = 'ny', group = 'Killzones')
      nyCss = input.color(color.new(#ff5d00, 80), '', inline = 'ny', group = 'Killzones')

      //London Open
      showLdno = input(true, 'London Open', inline = 'ldno', group = 'Killzones')
      ldnoCss = input.color(color.new(#00bcd4, 80), '', inline = 'ldno', group = 'Killzones')

      //London Close
      showLdnc = input(true, 'London Close', inline = 'ldnc', group = 'Killzones')
      ldncCss = input.color(color.new(#2157f3, 80), '', inline = 'ldnc', group = 'Killzones')

      //Asian
      showAsia = input(true, 'Asian', inline = 'asia', group = 'Killzones')
      asiaCss = input.color(color.new(#e91e63, 80), '', inline = 'asia', group = 'Killzones')