Indicator Miscellaneous Questions - page 10

 
whroeder1:

I changed few things - hope it will work - I will know for sure it in next Monday.

Thanks for your time.

 

Maybe I did not understand your comment correctly. Sorry.
I tried below code - but it does not solve my issue.

( I have another idea that I will try it soon - but I need to ask that I know what is wrong in that part of code. So once you mentioned that info to me, then I solved my issue - but now I can't solve my this issue. )

if( DayOfWeek() != 0 || DayOfWeek() != 1 ) { ... }

Thanks in advance.

( I am working on it - hope I will solve it soon )

 

Not Sunday or not Monday means Sunday is true (Sunday is not Monday) and Monday is also true (Monday is not Sunday) and all others are not either. Always true.

Not Sunday and not Monday would work. After Monday would also work.

 

There is something that I do not understand correctly.
And I think this issue brings additional issues.

What I want to do? - It's simple - I just want to that part of code won't work in the Monday.

I need to search for something useful information in the forums here or there...

Thanks for your time.

 
Max Enrik:

I just want to that part of code won't work in the Monday.

Your original code should do that.

The code will only run on a intraday chart, on any day except monday

Remember that this:

if(Period()<=PERIOD_D1)
  {
   if(DayOfWeek()!=1)
     {
      function1();
      function2();
     }
  }

Is the same as this:

if(Period()<=PERIOD_D1 && DayOfWeek()!=1)
  {
   function1();
   function2();
  }

So both conditions need to be satisfied

 
honest_knave:

Your original code should do that.


Maybe below image can help me to clarify my issue.

That below code does not work correctly before I change timeframe please check out below image ( just found that difference few minutes ago ).

if(DayOfWeek()==5)
  {
   Print("Friday");
  }

initial issue


First part of code in your comment that I still use it.

Thanks for your comment.

 

You can right click on that and open the txt file of the log to see if it may be in there,sometimes some line can get skipped.

Sometimes dropping in a sleep(10) can help.

If you want to check otherwise you can add the playsound so you can hear in stead of see if the code was triggered or not.

if(DayOfWeek()==5)
  {
   Print("Friday");
   PlaySound("Alert2.wav");
  }
 
Marco vd Heijden:

You can right click on that and open the txt file of the log to see if it may be in there,sometimes some line can get skipped.
Sometimes dropping in a sleep(10) can help.
If you want to check otherwise you can add the playsound so you can hear in stead of see if the code was triggered or not.

Thanks for your comment.

I just confused and I need to try once again separately.

Soon...

 

I hope my below example code can help me that I explained more clearly my issue.

Q:  Is there anything wrong in my example code, please?

int OnInit()
  {
   Print("Outside");

   ObjectCreate("Object Outside",OBJ_LABEL,0,0,0);
   ObjectSetInteger(0,"Object Outside",OBJPROP_XDISTANCE,20);
   ObjectSetInteger(0,"Object Outside",OBJPROP_YDISTANCE,20);
   ObjectSetString(0,"Object Outside",OBJPROP_TEXT,"Outside");

   if(DayOfWeek()==5)
     {
      Print("Inside");

      ObjectCreate("Object Inside",OBJ_LABEL,0,0,0);
      ObjectSetInteger(0,"Object Inside",OBJPROP_XDISTANCE,20);
      ObjectSetInteger(0,"Object Inside",OBJPROP_YDISTANCE,40);
      ObjectSetString(0,"Object Inside",OBJPROP_TEXT,"Inside");
     }
  }

( looks like there is no anything wrong - but when you will try it - you will see what I want to say )

Thanks in advance.

 

Where is the code? i don't see any ?

Or do you mean this:

if(DayOfWeek()==5)
  {
   Print("Friday");
  }

It's correct according to the the documentation:

DayOfWeek

Returns the current zero-based day of the week (0-Sunday,1,2,3,4,5,6) of the last known server time.

int  DayOfWeek();

Returned value:

Current zero-based day of the week (0-Sunday,1,2,3,4,5,6).

Note

At the testing, the last known server time is modelled.


We had talked a bit about it earlier.

Here is the example i had given it's slightly different but i am sure you get the idea:

      switch(TimeDayOfWeek(TimeCurrent()))
        {
         case 0:// Sunday

            break;

         case 1:// Monday

            break;

         case 2:// Tuesday

            break;

         case 3:// Wednesday

            break;

         case 4:// Thursday

            break;

         case 5:// Friday

            break;

         case 6:// Saturday

            break;
        }