Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 772

 
Vitaly Muzichenko:

I wouldn't use Monday, I would just use number of days back. And I would get the values at every new bar, so as not to load the Expert Advisor with calculations at every tick.

It works like this:

double iPointOrderStep = -1;

//************************************************************************************************/
double iPointOrderStep()
{
      if (iPointOrderStep<0 (сюда добавить условие "или Понедельник"))
         {
            double Awerage30 = (int)((ATR(Symbol(),PERIOD_D1,21,1))/Point());
            double Awerage7 = (int)((ATR(Symbol(),PERIOD_D1,5,1))/Point());

            iPointOrderStep = NormalizeDouble(((Awerage30+Awerage7)/2/6),0);
            return (iPointOrderStep);
         } else return (iPointOrderStep);
}
//************************************************************************************************/

Unfortunately, I don't know how to set "days ago" parameter.

I have a piece of code for defining a new bar

//************************************************************************************************/
bool fNewBar()
{
   static datetime NewTime=0;
      if(NewTime!=Time[0])
      {
            if(NewTime==0)
            {
               NewTime=Time[0];
               return(false);
            }      
         NewTime=Time[0];
         return(true);
      }
   return(false);     
}
//************************************************************************************************/

As far as I understand, it defines a new bar on the current timeframe, while I need it on D1.

I don't know how to use it...

I would be glad to help :)

 
Alexander Layzerevich:

It turned out like this :

Unfortunately, I can't figure out how to set the "number of days ago" parameter.

I have a piece of code for defining a new bar

I understand that it defines a new bar on the current timeframe, and I need it on D1.

I don't know how to use it...

I would be glad to receive your help :)

Yes, use it on every bar, it makes no difference, the error there is +-0.000001 points in total.

 
Vitaly Muzichenko:

Yes use it on every bar, what's the difference, there's +-0.000001 point error in total.

Thought this variant would suit me (if the code is written correctly :) ) :

//************************************************************************************************/
if (fNewBar())
   {
      if (DayOfWeek() == 1 && Hour() == 4) { iPointOrderStep = -1;}
   }
//************************************************************************************************/

I.e. if event "Monday" happened and time 4:00, then we will reset value to zero. And then according to the code, if the value is less than zero, we will get a new one and write it into the buffer, etc.

 
Greetings all, I am a newbie, advise what to do, do I have to refund $300.26 (real account) or not, I want to stop using ECN Pool MT4 for a while?
Files:
354355.png  5 kb
 
Logic:
Greetings all, I am a newbie, can you tell me what to do, do I have to pay back the $300.25 or not?

I think this is a discussion about programming, not finances.

 
Alexander Layzerevich:

I think the discussion here is about programming, not finance.

Can you direct me to the right forum thread, because I can't seem to find my way around a lot of things?
 
Logic:
Can you direct me to the right forum thread, because I can't seem to find where?

That's a question to ask the DC. In general, close the account, it should be easy to clear.

 
Konstantin Nikitin:

You have to ask the DC. In general, close the account, it should be easy to clear.

What brokerage company?
 
Alexander Layzerevich:

I have a piece of code for defining a new bar

I understand it's defining a new bar on the current timeframe, but I need it on D1.

I don't know how to use it...

replace Time[0] by iTime(_Symbol,PERIOD_D1,0);

 
Logic:
what is the dealing desk?

The one you used to trade with, or a broker (dealing centre).

Reason: