Trading one day of the week (at a time)
Author: rmandel00
Creation Date: 8/20/2010 7:09 AM
profile picture

rmandel00

#1
I know how to put an instruction to allow a trade on one day of the weeek, for example:
if (Date[bar].DayOfWeek == DayOfWeek.Monday)
as part of a buy signal will only enter trades on Monday. I can edit the code manually
and change Monday to any other day of the week but I would like to do this a little more
elegantly.

I would like to have a parameter slider that allows me to change the day of the week to
test any particular day for an entry but the logic of it escapes me. I have tried a few
different ways, by defining a slider as an integer from 1 to 5 and then equating
each day of the week to a different number. Alas, I don't get it and my programming
logic doesn't seem to eliminate those little red squiggles and error messages. If someone
can give me a snippet of code that would allow me to carry out this function I would be most
appreciative.
Thanks,
Rich Man
profile picture

Eugene

#2
Here you go:
CODE:
Please log in to see this code.
profile picture

rmandel00

#3
Thanks Eugene.
profile picture

Eugene

#4
You're welcome.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).