I actually have an indicator that starts making its process with the first bar of each day with ‘ActualDay = Time[0].Day;’. For now without declaring any DateTime “variable” previously on the top of the code.
But now I need the indicator starts its process on each Wednesday and I’m trying to change this line of code for other where be specified the Wednesday but I’m not getting the correct syntax to do that.
All the examples I found here in the forum was about if-statements like ‘if(Time[0].DayOfWeek == DayOfWeek.Monday’, and I couldn’t find anything different than comparison processes about this topic, so as I couldn’t find in the Forum any similar example like the one I need, then I tried with different ways like:
[FONT=Arial]Time[0] == DayOfWeek.Wednesday;[/FONT]
[FONT=Arial]ActualDay = Time[0]. DayOfWeek.Wednesday[/FONT]
[FONT=Arial]… public class CustomIndicator : Indicator { ... private DateTime dayWednesday; … protected override void OnBarUpdate() { dayWednesday = Time[0] Time[0] == DayOfWeek.Wednesday …[/FONT]
Could you please show me what would be the way to get this working?
And another question would be, is there a way to maybe specify a DateTime (private DateTime dayWednesday) in the variables list and then just do something like ‘ActualDay = Time[0].dayWednesday’ and in this way only replace ‘Time[0].Day’ by ‘Time[0].dayWednesday’ to be able to switch from one to another when needed in a quick way.
Thank you
Comment