[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 505

 
Turns out loki is promising and cool!!! O_O
 
MaxZ:

Hello, Roman. It doesn't really say much... No facts. Although one man assures that three years ago he traded on such an account and opened a lock with negative free funds! :))) I sent the link in his personal message.

This is bad for brokerage companies, it seems to me. You can wait with the withdrawal and do something about it (for example, put money on the account).

It is quite possible and there is nothing harmful: the opening of a counter position for the same instrument is equivalent to closing an existing position. At the same time, funds will be released. If the brokerage company does not take margin for both of the open positions, it will gladly leave orders in the terminal for fun. There are no open positions anyway, only a record in the terminal.)
 
Noterday:

Folks, help me out with the code. I need only one trade per day to open, even if the rest of the opening conditions are in place.

Do you need to check the current day against the order opening history?


if(NewBar == True)
{
//Ваши условия открытия
}

//Функция
bool NewBar()
{
  static datetime lastbar = 0;
  datetime curbar = iTime(NULL,1440,0);
  if(lastbar != curbar)
  {
    lastbar = curbar;
    return(true);
  }
  else return(false);
}
 
VladislavVG:
It is quite possible and there is nothing harmful: the opening of a counter position for the same instrument is tantamount to closing an existing position. At the same time funds are released. If DC does not take a margin for both open positions, then the terminal will gladly leave orders for fun. After all, there are no open positions, only entries in the client terminal.)

Perhaps... Loki have always been and always will be a profiteer for DCs. Otherwise they'd all be banned! :DD

Although you can argue in this case, but you don't really want to.

You'd better tell me if you know if there are such accounts in MT4!? :)))

 
MaxZ:

Hello, Roman. It doesn't really say much... No facts. Although one man assures that three years ago he traded on such an account and opened a lock with negative free funds! :))) I sent the link in his personal message.

This is devastating for the brokerage company, it seems to me... You can wait for the drain and do something about it (put money in the account, for example).

Hi, Max! Spas! Got it!

Of course it sucks...

Although... :-)

With negative means, you can't... Sort of... :-)

I know that there are platforms, like CQG, designed for spread trading, that has an option that if you enter a spread position: one contract for an instrument goes long, for the second (or for the same - if the spread is calendar) instrument - go short, then the MARJA (margin) will be lower than for direct (individual) entries (not the spread) for these instruments. This is especially true when trading with full contracts at a REAL stockbroker, where the margin on one contract can be up to 7,500 quid! - That's CL oil.

 
MaxZ:
Turns out loki is promising and cool!!! O_O
You betcha!!! :-)
 
borilunad:
Noterday:

Folks, help me out with the code. Only one trade per day needs to be opened, even if the rest of the opening conditions are present.

Do you need to check the current day against the order opening history?

if(NewBar == True)
{
//Ваши условия открытия
}

//Функция
bool NewBar()
{
  static datetime lastbar = 0;
  datetime curbar = iTime(NULL,1440,0);
  if(lastbar != curbar)
  {
    lastbar = curbar;
    return(true);
  }
  else return(false);
}

Now read the request you answered again! :)))


Noterday:

Folks, help me out with the code. I need to open only one order per day, even if I have all other conditions.

Need to check the current day against the order opening history?

You need to compare the time of the current day (iTime(NULL, 1440, 0); this will work fine) with the time of the last trade opened (still open or closed - doesn't matter).
 
MaxZ:
Now read the request you responded to again! :)))


What are you unhappy about? One position will open according to his terms and no more will open until the next day, which was required according to his request.
 
borilunad:

What is your problem? One position will open according to his conditions and no more will open until the next day, which is what he asked you to do.

What if a trade was opened manually!? Or the terminal was rebooted!?

And think about what happens if the condition for opening is not met... The lastbar will keep today's date and the condition has not been fulfilled and will not be fulfilled until the beginning of the next day. At a minimum, the condition for opening must be higher than your "if"... And this option would only work for a tester.

 
Got it, thanks !borilunad and MaxZ